Log in

View Full Version : usergroup based error messages


Lionel
09-14-2006, 11:14 AM
Is there a way to customize the generic error messages?
If for example someone is trying to access a page that can be seen only by a certain group, I'd like for the error message to be more specific, to be able to put links and things in there.

It's been only 6 years I've been trying to do this, since the 2.20 days.

paul41598
09-14-2006, 07:36 PM
Well, this is the half ass way of doing it. I could probably get something better going, (like maybe a hook) just not right this second.

However the generic msg uses a function called print_no_permission() located in functions.php So whenever you see this function in any of the files where you want the error msg to occur you could replace that function with something else.

For Example:

- I have custom permissions on one of my forums set to "Cannot View Forum" so when a user clicks on it, they get the generic msg. However I want a custom error message instead.

- I can open up forumdisplay.php and look for this code:

// get permission to view forum
$_permsgetter_ = 'forumdisplay';
$forumperms = fetch_permissions($foruminfo['forumid']);
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']))
{
print_no_permission()

}


Then I can simply replace: print_no_permission()

with something like:

eval(standard_error("I'm Sorry, You Don't Have Permission<br /><br /> <b>Contact An Admin</b>"));

Lionel
09-14-2006, 09:31 PM
It's a little more involved in my case. I want to use it for specific usergroups with vbadvanced and other groups based hack.

If you do that hook, you'll be like God sent to me.

Lionel
09-23-2006, 01:34 AM
Thank you. I got it