/** * Tasks to handle after posting a message. * * @param string $form_id * An identifier for the current form. This must be the same form id * as the one that was used when calling {@link spamhurdles_api_init()}. */ function spamhurdles_api_after_post($form_id) { global $PHORUM; // Retrieve the spam hurdles data from the form. $data = spamhurdles_api_get_formdata($form_id); // Let the spam hurdles run after post tasks. spamhurdles_hurdle_call('after_post', $data, $data['hurdles']); }
/** * Extend the PM sending form with spam hurdles data. */ function phorum_mod_spamhurdles_tpl_pm_editor_before_textarea() { global $PHORUM; // Initialize the form, unless we have spamhurdles data in the // request already. if (!isset($_POST['spamhurdles_pm'])) { $data = spamhurdles_api_init('pm', spamhurdles_get_hurdles_for_form('pm')); $data['use_editor_block'] = 'pm'; } else { $data = spamhurdles_api_get_formdata('pm'); if ($data === NULL) { trigger_error('No "spamhurdles_pm" data field was found in the POST request. ' . 'This should not happen.', E_USER_ERROR); } } // Output the required form data. print spamhurdles_api_build_form($data); // Prepare the data that needs to be added after the form. // We will display it from the before_footer hook, but since // we have the spam hurdles data at hand here, it's easiest // to format the after form data here. $PHORUM['DATA']['SPAMHURDLES_BEFORE_FOOTER'] .= spamhurdles_api_build_after_form($data); }