MyBB Community Forums
How to return a false to datahandler:user on a custom plugin - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Development (https://community.mybb.com/forum-68.html)
+---- Thread: How to return a false to datahandler:user on a custom plugin (/thread-220729.html)



How to return a false to datahandler:user on a custom plugin - gungrave41 - 2018-11-18

How to return a false to datahandler:user on a custom plugin

Basically I made a custom hook to ''datahandler_user_validate" that checks if a custom registration field data (exists or been used), namely "Student ID" which is an optional field (can be left blank). But if the guest inputs something and filters falls into false, the plugin should stop "datahandler_user_insert" from querying the INSERT_USER and instead return an error / return false.

any help is appreciated...

Oh. what a bummer, I actually solved my problem by using arguments

$args = $plugins->add_hook("datahandler_user_validate", "db_override");
function db_override($args)
{
$args->set_error($reply);
return false;
}

Fixes my day....