PDA

View Full Version : Request: Members/Non-Members templates..how?


dssart
05-20-2002, 01:45 AM
Hi everyone,

I've been trying to figure this one out for awhile on my own, but can't get it 100%. I need a separate forum template for registered members. I have an app I want to launch via a button, but only want registered users to see the button, or be able to use it. If anyone can tell me exactly how to do it ( I'm guessing I need to edit the global.php file and insert the name of the 2nd template somewhere ) my thanks will go out to you.

dssart

Logician
05-20-2002, 09:02 AM
if ($bbuserinfo[usergroupid]==X)
{
$special_button='<a href="http://site.com/yoururl.html"><img src="http://www.site.com/images/yourimage.gif" border="0"></a>';
}
else
{
$special_button='';
}

(Replace X with the usergroup id that can see the button)

Now insert variable $special_button to any template you want.

Enjoy! ;)

Logician

dssart
05-20-2002, 08:15 PM
Thanks buddy! can I insert this anyplace in global.php3?

Logician
05-20-2002, 09:11 PM
not anyplace, but let's say many places :)

To be safe, you better insert it just BEFORE the last line:
?>

dssart
05-20-2002, 09:18 PM
:) O.K...also, I haven't changed my usergroups..members would be number 2 correct?

dssart
05-21-2002, 12:15 AM
Can't get it to work..nothing at all shows up. I tried changing usergroup ids to every number, nothing..tried placing it in different areas of global.php3, nothing..I know the board is seeing it..I took a bit of code out to see if the board would recognize an error and it did.

Logician
05-21-2002, 08:04 AM
Unless you used the button in header or footer templates, it should work. To use it eg. in header template apply the code, right before:

// ###################### Start templates #######################

in global.php.
(Tested and working here)

If it does not work for you, please post exactly the code you inserted, where you inserted, template name you applied and how you applied to that template..

Regards,

dssart
05-21-2002, 10:25 PM
O.K., I can't get it still..I was planning to use it in my footer template so it shows up at the bottom of all pages of registered users..here's the footer template:

</td>
</tr>
</table>
<!-- /content area table -->
<!--Do not remove this copyright notice -->
<br>
<div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#999966">
Powered by: vBulletin Version $templateversion<br>
$special_button<br>
Copyright &copy;2000, 2001, Jelsoft Enterprises Limited.<br>
$copyrighttext </font></div><br>
<!-- Do not remove this copyright notice -->

dssart
05-21-2002, 10:29 PM
Here's global.php3, I have my actual website URL inserted where appropriate..

// ###################### Referrer Stuff #########################

// Referer stuff
if ($bbuserinfo['userid']==0 and $usereferrer and !$bbreferrerid and $referrerid) {
if ($r_id = $DB_site->query_first("SELECT userid FROM user WHERE userid = '".addslashes($referrerid)."'")) {
vbsetcookie("bbreferrerid",$r_id[userid]);
}
}

if ($bbuserinfo[usergroupid]==3)
{
$special_button='<a href="http://mywebsite.com"><img src="http://mywebsite.com/forum/database.gif" border="0"></a>';
}
else
{
$special_button='';
}

// ###################### Start templates #######################

Logician
05-22-2002, 07:34 AM
This code is ok and works.. If it does not work for you, check:

1- usergroupid: Does it usergroup 3 you want to show the button. Double check..In my board board members are usergroup 2 for instance..Change it to 6 and see if you (Admin) can see the button

2- Your url: http://mywebsite.com/forum/database.gif? Valid?

Regards,
Logician

dssart
05-22-2002, 08:54 PM
Logician,

That was it my man! But, my question is..what is the right usergroup I should enter here? I mean assuming I had the correct number in the past, I should have been able to see it regardless, me having admin rights, don't you think so?

If not, how can I get the right usergroup number for members. I haven't added or subtracted usergroups from my original installation. What was the usergroup id for members in a vanilla installation?

Thanks alot for your help..

Logician
05-23-2002, 05:18 AM
Very likely it's 2, have you tried that?

To be sure:

Login Admin CP/ USER GROUPS/ Modify / Find the user group you want in the list, right mouse click on its edit menu, choose open in new browser window and check the address bar. You'll see at the end of line as: "usergroupid=X"

I mean assuming I had the correct number in the past, I should have been able to see it regardless, me having admin rights, don't you think so?

Nope certainly NOT! :) If you set it to 2 only usergroup with 2 can see it. If you want to display it to eg. usergroup 2 AND 6 you have to modify the line:

if ($bbuserinfo[usergroupid]==2 AND $bbuserinfo[usergroupid]==6)


;)

E
05-23-2002, 08:58 AM
if ($bbuserinfo[usergroupid!=0) {
$button=" ";
} else {
$button="<a href=\"application.url\"><img src=\"button.url\"></a>;
}

E
05-23-2002, 09:00 AM
if u want the button on forum homepage...
open up root/index.php

and find
//check usergroup of user to see if they can use PMs

Above add

//Show application button
if ($bbuserinfo[usergroupid!=0) {
$button=" ";
} else {
$button="<a href=\"application.url\"><img src=\"button.url\"></a>;
}


now open up forumhome template.. and add $button wherever u want it too show

dssart
05-23-2002, 07:41 PM
Thanks you guys,

You've been a great help..I think I've got it, but if not ( speaking in my best Schwarzenneger accent ) Ahhhl be baahk..