The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 909 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Form Tools
Functions for Hooks Module - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Modules / Other (https://forums.formtools.org/forumdisplay.php?fid=8)
+--- Forum: Modules (https://forums.formtools.org/forumdisplay.php?fid=16)
+--- Thread: Functions for Hooks Module (/showthread.php?tid=2399)



Functions for Hooks Module - EdgarAllenPoe - Mar 12th, 2013

I am working on a project that hooks to the code hook "ft_get_submission,end" and I have come up with a few functions that I use and may be helpful to others. I know they work with this code hook, they may work with others.

Store a value to a given field (column) for the current record(submission)
PHP Code:
function store_value($table_prefix$form_id$submission_id$column_name$value)
{
  
$query "
      UPDATE 
{$table_prefix}form_{$form_id} 
      SET 
$column_name = $value 
      WHERE submission_id = 
$submission_id
        "
;
  @
mysql_query($query);


Get a value of a given field (column) from the current record(submission)
PHP Code:
function retrieve_value($table_prefix$form_id$submission_id$column_name)
{
  
$query "  
  SELECT * 
  FROM  
{$table_prefix}form_{$form_id} 
  WHERE submission_id = 
$submission_id
  LIMIT 1
    "
;
// mysql_fetch_assoc() gets an associative array that represents a result row, where the array keys are the field names.
  
$result mysql_query($query);
  
$retrieved_row mysql_fetch_assoc($result);
  return 
$retrieved_row[$column_name];


I use the following to help with debbuging when I need to see what is happening with a variable
PHP Code:
function show_popup($message)
{
echo 
'<script type="text/javascript"> 
window.onload=function(){alert("' 
$message '");} 
</script>'
;


Please let me know if I can improve on these in any way.


RE: Functions for Hooks Module - Joe - Mar 12th, 2013

Thanks for sharing!