Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: add_action not running when do_action is called


westpointer
Participant

@westpointer

OK, here’s some quick and dirty TESTING code. In a file that is located in mu-plugins, I have:

function my_hello_world($groupid, $mypostarray) {

print_r($groupid);

echo ‘Hello World‘;

print_r($mypostarray);

die;

}

add_action( ‘groups_new_form_topic_post’, ‘my_hello_world’, 1, 2 );

When it runs, I should see the variables listed along with “Hello World”. (The page dies before going back to the forum post listing). But the code inside the function is not executed.

If instead, I modify bp-groups.php to be:

do_action( ‘groups_new_forum_topic_post’, $group_obj->id, $forum_post );

/* Brent mod */

my_hello_world($group_obj->id, $forum_post);

the function runs. I see “Hello World” and the arrays printed.

Skip to toolbar