
Jason
Staff
/ Moderator

Nov 30, 2011, 10:50 AM
Post #4 of 4
(197 views)
Shortcut
|
|
Re: [gkornbluth] Calculation in a form
[In reply to]
|
Can't Post
|
|
Hi Jerry, Here is a basic frame you can start from:
<?php /* Plugin Name: Description: Version: 1.00 Requires at least: 2.08 */ addAction('record_postsave', 'pluginName_functionName', null, 4); function pluginName_functionName($tableName, $isNewRecord, $oldRecord, $recordNum) { $pluginTableName = "tableThePluginIsFor"; if ($tableName != $pluginTableName) { return; } $record = mysql_get($pluginTableName, $recordNum); } ?> First thing is you'll need to replace pluginName_functionName with the name of the function that is going to be executed after a record is saved. We tend to use the convention of pluginName_functionName to avoid naming collisions. Next, assign the name of your section to the variable $pluginTableName. This will ensure that the function is only executed when a record is saved in a specific section. Finally, the next line assigns $record with the value of the record that was just saved. You will also have access to everything that was in the $_REQUEST array from this function as well. Hope this helps get you started. --------------------------------------------------- Jason Sauchuk - Programmer interactivetools.com Hire me! Save time by getting our experts to help with your project. http://www.interactivetools.com/consulting/
|