Make WordPress Core

Opened 19 years ago

Closed 17 years ago

#1510 closed enhancement (wontfix)

API Hooks - Variable Referencing [CODE]

Reported by: athomas's profile athomas Owned by:
Milestone: Priority: normal
Severity: normal Version: 1.5.1.2
Component: General Keywords: reference
Focuses: Cc:

Description

I was wondering if it would be possible to turn on variable referencing for plugin developers. It would certainly make our lives much easier.

For example, we've developed a plugin to stop spam trackbacks but we'd also like to have wordpress NOT email the administrator when a spam trackback has been encountered and processed. With the current API that's impossible. But if you were to change line 1003 under the do_action function in wp-includes/functions.php from

$string = call_user_func_array($function_name, $the_args);

to

$string = call_user_func_array($function_name, array(&$the_args));

then we could solve our problem. When the comment_post hook is called we could have our plugin do:

function tb_email_disable($comment_ID, &$approved) {

  ...check to see if comment is tb spam...
  $approved='spam';
  return;
}
add_action('comment_post','tb_email_disable',1,2);

This would then allow the the wp_notify_moderator and wp_notify_postauthor to be bipassed whenever a spam trackback is detected.

There are many more instances where this would be very useful. Right now, this is the only solution I can think of, but if you have any suggestions that would be great.

-andy

See the php manual for more info on the suggested enhancement. This post is also an interesting read.

Change History (3)

#1 @athomas
19 years ago

  • Summary changed from API Hooks - Variable Referencing to API Hooks - Variable Referencing [CODE]

#2 @markjaquith
19 years ago

Spam Karma 2 manages to avoid e-mailing the admin for spams received...

#3 @rob1n
17 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

As MarkJaquith said, SK2 does this fine. This may also have a detrimental effect on existing plugins.

Note: See TracTickets for help on using tickets.