function action_hook($h, $t, $r, $p) { $actions = get_recaptcha_actions(); if (is_array($actions) && in_array($t, $actions)) { if (!validate_recaptcha()) { elgg_make_sticky_form($t); register_error(elgg_echo('elgg_recaptcha:message:fail')); // workaround for https://github.com/Elgg/Elgg/issues/8960 elgg_unregister_plugin_hook_handler('forward', 'system', 'uservalidationbyemail_after_registration_url'); forward(REFERER); } } }
$body .= elgg_view('input/checkbox', array('name' => "params[{$attr}]", 'value' => 1, 'checked' => (bool) $vars['entity']->{$attr})); $body .= $l . '</label></div>'; if ($count == $break1 || $count == $break2) { $body .= '</div><div class="elgg-col elgg-col-1of3">'; } } $body .= '</div>'; echo elgg_view_module('main', $title, $body); } // actions to protect $actions = array(); foreach (_elgg_services()->actions->getAllActions() as $action => $info) { $actions[] = $action; } sort($actions); $checked_actions = get_recaptcha_actions(); $title = elgg_echo('elgg_recaptcha:setting:recaptcha_actions'); $body = elgg_view('output/longtext', array('value' => elgg_echo('elgg_recaptcha:setting:recaptcha_actions:help'), 'class' => 'elgg-subtext')); $body .= '<ul>'; foreach ($actions as $action) { $body .= '<li><label>'; $options = array('name' => 'recaptcha_options', 'value' => $action, 'default' => false, 'class' => 'recaptcha-action'); if (in_array($action, $checked_actions)) { $options['checked'] = 'checked'; } $body .= elgg_view('input/checkbox', $options); $body .= $action; $body .= '</label></li>'; } $body .= '</ul>'; // store a comma delimited string