Log in

View Full Version : no permission message based on usergroup


raagaswaram
05-19-2009, 01:46 AM
can anyone help me to display different no permission error message based on usergroup instead of displaying default one to all user groups

Lynne
05-19-2009, 04:02 AM
Look in the API (link in Quick Links) for the function "standard_error" and you should see how to modify the message. Then just put a condition around each error based on the usergroup:
if (is_member_of($vbulletin->userinfo, x,y)) {
error 1
} else if (is_member_of($vbulletin->userinfo, a,b)) {
error 2
} else {
error 3
}

raagaswaram
05-19-2009, 05:29 PM
Look in the API (link in Quick Links) for the function "standard_error" and you should see how to modify the message. Then just put a condition around each error based on the usergroup:
if (is_member_of($vbulletin->userinfo, x,y)) {
error 1
} else if (is_member_of($vbulletin->userinfo, a,b)) {
error 2
} else {
error 3
}

hey,
sorry where is the quick links (API)?

Lynne
05-19-2009, 06:15 PM
Quick Links is in the navbar on the right side under the search bar.

raagaswaram
05-20-2009, 02:48 AM
ye but which template or file to edit? also userinfo or usergroup?

Lynne
05-20-2009, 03:24 AM
You'll have to figure out which hook location to use based on where you are using this code (if you are making a plugin) or if you are showing/not showing some info based on the codition, you will have to figure out which template (To find the template to modify, do this - vboptions > General Settings > Add Template Name in HTML Comments > set to Yes . Then go back to your page and view the source code and you will see the name of the template called around your part of the code. Sometimes the template is the one mentioned at the very top of the page source). You never said where you are using this, so I can't offer advice. When in debug mode, you can see a list of all the plugins used on the page on the bottom of the page as well as all the templates.

And you use $vbulletin->userinfo in that particular function. That function, is_member_of, is also in the API. You can go see what variables are accepted in there and that passing the userinfo is an OK thing (the userinfo contains the usergroup for the user).

raagaswaram
05-20-2009, 04:00 AM
im using when downloading an attachment or when a user trying to enter premium section of a forum

Lynne
05-20-2009, 03:35 PM
OK. So are you going to be using the code in a plugin or a template? What are you trying to hide/show from people? You need to figure out what template or variable you are trying to hide/show.

raagaswaram
05-21-2009, 01:20 AM
no permission when trying to download an attachment

Lynne
05-21-2009, 02:20 AM
Any attachment? You can simply set it so users in a usergroup aren't allowed to download the attachment in the Attachment Manager. Or you could probably use the "attachment_start" hook location to send an error based on the usergroupid as posted above.

raagaswaram
05-22-2009, 04:55 AM
ye any attachment and i want to do it based on usergroup so each usergroup will get differnt no permission message.
so what i have to edit language phrase or attachment template?

Lynne
05-22-2009, 02:55 PM
First, you need to find where the error message is posted from - is it in a template? I have no idea what message you are talking about, so I can't help at all with that. But, if you can find where it is coming from, I can help you out.

Do this..... get the error message to appear. Do what I posted above to put the template name in the source code and then find the template that is spitting out the error message. Let us know the template name. While you are at it, get an image of this error message you are talking about so I know what it is you are wanting to change.