WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#5805 closed defect (bug) (invalid)

wp_blacklist_check-hook doesn't pass all the arguments it should

Reported by: webaholic Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

Developing an anti-spam plugin I struggled at the wp_blacklist_check - hook. Codex says there will be some arguments I should get (like email, text, etc.) but I only got the author name.

Researching why I didn't get anything more I found the following:

do_action('wp_blacklist_check', $author, $email, $url, $comment, $user_ip, $user_agent);

while do_action is limited to 2 arguments:

function do_action($tag, $arg = '') { [...] }

This should be changed into something like

do_action('wp_blacklist_check', array($author, $email, $url, $comment, $user_ip, $user_agent));

I think.

Change History (1)

#1 @darkdragon
10 years ago

  • Milestone 2.3.4 deleted
  • Resolution set to invalid
  • Status changed from new to closed
  • Version 2.3.3 deleted

You need to read more about add_action and do_action(). The calls are correct.

You have to do this instead.

function myspamcheck_blacklist_check($author, $email, 
                                     $url, $comment,
                                     $user_ip, $user_agent)
{
    // whatever
}

add_action('wp_blacklist_check', 'myspamcheck_blacklist_check', 6);
Note: See TracTickets for help on using tickets.