![]() |
Request: Members/Non-Members templates..how?
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 |
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 |
Thanks buddy! can I insert this anyplace in global.php3?
|
not anyplace, but let's say many places :)
To be safe, you better insert it just BEFORE the last line: ?> |
:) O.K...also, I haven't changed my usergroups..members would be number 2 correct?
|
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.
|
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, |
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 ©2000, 2001, Jelsoft Enterprises Limited.<br> $copyrighttext </font></div><br> <!-- Do not remove this copyright notice --> |
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 ####################### |
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 |
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.. |
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" Quote:
if ($bbuserinfo[usergroupid]==2 AND $bbuserinfo[usergroupid]==6) ;) |
PHP Code:
|
if u want the button on forum homepage...
open up root/index.php and find PHP Code:
PHP Code:
|
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.. |
All times are GMT. The time now is 04:08 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|