MyBB Community Forums

Full Version: Add a hook to usercp.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is it possible to add a hook to usercp.php

Additional Information
Additional Contact Information


Fields?????
Sounds like you just want to add some custom profile fields: ACP -> Configuration -> Custom Profile Fields
Thanks buddy but I want to connect my plugin to those fields and prevent people from posting URLs
Then just use:

$plugins->add_hook("usercp_do_profile_start", "my_function");

function my_function()
{
global $mybb;
// . . .
if (preg_match($regex, $mybb->input['profile_fields']['fid4'])) {
// filter here
}
}

You'll need to replace 'fid4' with 'fidX' X being the id of your new custom profile fields.
Buddy I am using this to filter postbit message but what do I have to filter or connect to in there?
if(preg_match($regex, $post->data['message'], $match)
I edited my answer. I had you on the wrong hook. Sorry.
OMG dude I love you thanks very much you have just saved the DAY.
Saludos desde EspaƱa!

How to show an error message on the same page when this code has executed? I am referring to inline error

$message->set_error('ERROR'); doesn't work????