MyBB Community Forums

Full Version: About running hooks
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
$plugins->run_hooks("member_do_register_start");

i see that in the members.php file

if i want i can add a hook to that

$plugins->add_hook("member_do_register_start", 'kill_the_user');

Question

I have a custom php file that ads stuff to the database etc...i want to add a

$run_hooks("user_eats");

so that later on i can do

$plugins->add_hook("user_eats", 'kill_the_user');



what is the procedure for doing that ...i mean do i need a function called
"user eats" ..what should or shouldn't that function do

please help as in this area im still learningBig Grin
The line should be:
$plugins->run_hooks("user_eats");
(make sure $plugins is "visible" from where you're running the code)

You don't need to do anything more than that.
"user_eats" would just be the identifier for the hook, you don't need a function with that name since you will register a function to that identifier later and that is the function which will be called when the hook it run.
thanks all sorry bout posting in the wrong section