MyBB Community Forums

Full Version: Requests for hooks
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Where would i post that or who would i tell where a hook would be handy?

Currently without some serious hackery there are a few things you cant do very neatly yet. I found one thing in particular disturbing, that you cant add a very good way to block registrations with a plugin.

This is all concerning the member.php file.
From what i can see "member_register_start" (line 276) is called when the form is created to fill out (user name, password etc). And then later "member_do_register_start" (line 80) is called when the actual registration begins. The trouble is at line 135 where errors is reset with $errors = "";

You can set an error before that but it will be overwritten. And there is no other hook to take care of it.

I would propose a hook just before line 155 "if(is_array($errors))". Something like $plugins->run_hooks("member_do_register_after_checks"); or similar. If i understand this right, it will always kill the registration if an error is set there, so this would be a perfect place, since all the internals are through and available to plugin authors.

Thanks in advance for any answers Smile
datahandler_user_validate [ ./inc/datahandlers/user.php ]

I've used this one for my plugin which requires you to fill in your Bday And Gender on Registration, You can create an inline_error while using this hook.
"block registrations"

Can I ask how you want to block registrations and on what basis? I believe you can do it with existing hooks.
Thanks LeX, but that hook is called from datahandlers. The datahandler is all over the place, and i want something VERY specific in the members registration.

Advanced spam protection is the reason for blocking. Essentially I am doing a few bot checks. So when my plugin says it is a bot that tries to register I want to block them from completing the registration, which means in turn they can't post, which also means no spam.

So where would i request a hook?
Simon Moon Wrote:Thanks LeX, but that hook is called from datahandlers. The datahandler is all over the place, and i want something VERY specific in the members registration.

Advanced spam protection is the reason for blocking. Essentially I am doing a few bot checks. So when my plugin says it is a bot that tries to register I want to block them from completing the registration, which means in turn they can't post, which also means no spam.

So where would i request a hook?

That hook is only used while creating a new account ... =/
The hook is in a place where it is called from at least 2 other places. With that it will cause trouble.

Besides my general question is how to get a hook included. This is only one example of a hook i think would be a good addition. This little project is the reason why i look at the hooks at all and i would like to contribute my work to the public, but i am not gonna go and support a nasty hack when a good hook placement would fix the problem.
Then use this in an if statement
if(strpos($_SERVER['REQUEST_URI'], 'member.php'))
{
....
}
And you can add hooks by yourself using
$plugins->run_hooks("<HOOKNAME>");
Yes this is a work around for using a hook not really meant for that Smile Works, but still a pretty ugly hack don't you think? I added the hook now by myself for my local copy, but thats just back to hacking the php source code as usual, and i could add the code right in tehre when i already do that stuff... So i wanted to know who do i talk to for requesting a new hook to be added to the mybb codebase?
No its a perfectly fine solution.

We also don't include extra hooks unless its a absolutely-will-die-with-out-it-no-other-solution because they require more processing power for each hook called.
Quote:Advanced spam protection is the reason for blocking. Essentially I am doing a few bot checks. So when my plugin says it is a bot that tries to register I want to block them from completing the registration, which means in turn they can't post, which also means no spam.

I am very curious what extra measures you are using to detect bots that the captcha doesn't accomplish.

I also think the use of REQUEST_URI is fine.

Quote: but i am not gonna go and support a nasty hack when a good hook placement would fix the problem.

I applaud your effort and wished more developers of mybb plugins thought the same. Consider though if you can create the plugin without core file changes and without adding hooks then you have the best solution.
Pages: 1 2 3