Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: May 2004
Posts: 31
User
User
Offline
Joined: May 2004
Posts: 31
If I wanted to put a link at the top along with the rest of the links, but only wanted people from 'x' usergroup see it, how would I go about doing this?

Kind of like the admin link that only admins have access to. Well, mods do to but to a different section.

Sponsored Links
Joined: Sep 2003
Posts: 488
Code Monkey
Code Monkey
Joined: Sep 2003
Posts: 488
In ubbt.inc.php

FIND THIS:

Code
         // ------------------------------------------------------------------ <br />         // If they are an admin or moderator they get a link to the admin sec <br />           $target = ""; <br />           if ( ($user['U_Status'] == "Administrator") || ($user['U_Status'] == "Moderator") ) { <br />              $target = "target=\"_top\""; <br />              $adminlink = "<a href = \"$phpurl/admin/login.php?Cat=$Cat\" $target>{$ubbt_lang['ADMIN_MENU']}</a> | "; <br />           }  



ADD BELOW IT, THIS:

Code
           $grouplink = ""; <br />           if ($user['U_Groups'] == "-X-") { <br />              $target = "target=\"_top\""; <br />              $grouplink = "<a href = \"URL GOES HERE\" $target>LINK NAME</a> · "; <br />           }  


Fill in the obvious details.

Then add $grouplink to ubbt_registerednav.tmpl alongside with the other links. Just make sure it isn't the very last link since it has a seperator after it.

Joined: May 2004
Posts: 31
User
User
Offline
Joined: May 2004
Posts: 31
You guys are amazing. I could only wish that my brain was wired in such a way to understand all this.

Thanks Twisty!!

Joined: May 2004
Posts: 31
User
User
Offline
Joined: May 2004
Posts: 31
Hmm, did all this and it's not showing up.

I'm assuming this is all right?

Code
$grouplink = "";<br />           if ($user['U_Groups'] == "-1-") {<br />              $target = "target=\"_top\"";<br />              $grouplink = "<a href = \"http://www.webpage.com\" $target>LINK NAME</a> | ";<br />           }  


Also, do I just put "$grouplink" (without quotes) in the ubbt_registerednav.tmpl somewhere? That's what I did but it's not showing up.

Joined: Sep 2003
Posts: 488
Code Monkey
Code Monkey
Joined: Sep 2003
Posts: 488

Last edited by Twisty; 08/17/2004 7:28 PM.
Sponsored Links
Joined: May 2004
Posts: 31
User
User
Offline
Joined: May 2004
Posts: 31
Bingo! That did it.

Thanks once again, Twisty!

Joined: May 2004
Posts: 31
User
User
Offline
Joined: May 2004
Posts: 31
It works but *everyone* can now see the link, regardless of which group they are in. Should I be putting in the group_id number or the name (ie Administrator)?

Joined: Sep 2003
Posts: 488
Code Monkey
Code Monkey
Joined: Sep 2003
Posts: 488
Actually you know what bro? That still isn't correct. *This* is what you want right here...

Code
           $grouplink = ""; <br />           if ( ($user['U_Groups']) && (strstr($user['U_Groups'],"-1-") ) ) { <br />              $target = "target=\"_top\""; <br />              $grouplink = "<a href = \"http://www.webpage.com\" $target>LINK NAME</a> · "; <br />          }   


I rarely ever mess with group stuff so I'm a li'l rusty with it. But don't worry, I'll get you set up sooner or later

Joined: May 2004
Posts: 31
User
User
Offline
Joined: May 2004
Posts: 31
No worries at all, Twisty! I'm just thankful there are people like yourself that are willing to help us technologically challenged folks.

And it's working perfectly now. I logged in as one of my users and the link is gone, as it should be. Thanks!!

Joined: Sep 2003
Posts: 488
Code Monkey
Code Monkey
Joined: Sep 2003
Posts: 488
'K no prob

Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
The other thing that you might need - depending on the the script - is to add U_Groups to the authenticate function - it's not called in every script.

If this is in the menubar, You might want to go into the authenticate() function in ubbt.inc.php and add U_Groups to the query there - so that $user['U_Groups'] will be avilable in every script.


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Gizmo
Gizmo
Portland, OR, USA
Posts: 5,833
Joined: January 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)