Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Jun 2002
Posts: 37
User
User
Offline
Joined: Jun 2002
Posts: 37
I see that there is 3 options for showing the user list in the navigation menu:

1. Show to noone
2. Show to everyone
3. Show only to registed users

My question, is it possible to add "Show only to administrator or moderators only"?

Thanks in advance!

Sponsored Links
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
welcome

you can use a bandaid approach and edit the navigation menu to do that


- Allen wavey
- What Drives You?
Joined: Jun 2002
Posts: 37
User
User
Offline
Joined: Jun 2002
Posts: 37
I wonder how one would be able to convience InfoPop to hard code this into threads for the next release? Hmm...

Now... how would one even approach this harck? Anyone has an example or insight into this?

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
Hi Jerry,

In your ubbt.inc.php file find this:

code:

// -------------------------------------------------
// Are we showing the user list to reged users only?
if ( ($config['userlist'] == '2') || ($config['userlist'] == '1') ){




and change it to this:

code:

// -------------------------------------------------
// Are we showing the user list to reged users only?
if ( ($user['U_Status'] == "Administrator") || ($user['U_Status'] == "Moderator") ){





I think that should do it.

Let me know if it doesn't.

Joined: Jun 2002
Posts: 37
User
User
Offline
Joined: Jun 2002
Posts: 37
That was quick!

Let me try it out. I'll let you know if there is any problems. Thanks!

Sponsored Links
Joined: Jun 2002
Posts: 37
User
User
Offline
Joined: Jun 2002
Posts: 37
This is what I tried. Did a little mod myself

code
// -------------------------------------------------
// Are we showing the user list to reged users only?
if ($config['userlist'] == '1'){
$template['members_link'] = " | <a href="$phpurl/showmembers.php?Cat=$Cat&page=1" target="_top">{$ubbt_lang['USER_LIST']}</a>";
}
else if ( ($user['U_Status'] == "Administrator") || ($user['U_Status'] == "Moderator") ){
$template['members_link'] = " | <a href="$phpurl/showmembers.php?Cat=$Cat&page=1" target="_top">{$ubbt_lang['USER_LIST']}</a>";
}

-------------

It didn't work...

Joined: Jun 2002
Posts: 37
User
User
Offline
Joined: Jun 2002
Posts: 37
Also I've noticed that this site is set to show the userlist only to registerd users. Well, as an anonymous user, I was able to get the userlist by adding this to the address bar:

https://www.ubbdev.com/threads/php/showmembers.php?Cat=&page=1

To me, this is a bad thing. Our forum (when it's up), we are hopping we can show the userlist only to Admins and Moderators.

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
Yes it's done that for a while.

In your showmembers.php file place this:

if ( ($user['U_Status'] != "Administrator") && ($user['U_Status'] != "Moderator") ){
exit;
}

right after this line:

$user = $userob -> authenticate("U_TimeOffset");


That should keep all else from viewing the page.

Joined: Jun 2002
Posts: 37
User
User
Offline
Joined: Jun 2002
Posts: 37
Got it! It now displays a blank screen but at least it's preventing non Admin & Moderators from viewing the userlist.

Thanks!

Would it be possible to display an error or no access message instead of the blank screen?

Joined: Mar 2002
Posts: 305
Enthusiast
Enthusiast
Offline
Joined: Mar 2002
Posts: 305
Use this:

code:
if( ($user['U_Status'] != 'Administrator') && ($user['U_Status'] != 'Moderator') ) {
$html -> not_right ("You must be logged in, and be a valid administrator or moderator to access this.",$Cat);
}



[:"red"]Lisa[/]
Sponsored Links
Joined: Jun 2002
Posts: 37
User
User
Offline
Joined: Jun 2002
Posts: 37
Hello Lisa_P!

Thanks for the input! Here's what I got when I tried your code:

Fatal error: Call to a member function on a non-object in d:\php\ubbthreads\showmembers.php on line 44

Line 44 is:
code:
$html -> not_right ("You must be logged in, and be a valid administrator or moderator to access this.",$Cat);




Joined: Mar 2002
Posts: 305
Enthusiast
Enthusiast
Offline
Joined: Mar 2002
Posts: 305
Well now, that's not what you wanted is it?!?!

Let's try some better instructions:

Right after the first lines of code:
code:
// Require the library
require ("main.inc.php");
require ("languages/$w3t_language/showmembers.php");



Place this (it's going after the Require stuff, and before " if(!$config['userlist']) { exit; }"
code:

// -----------------
// Get the user info
$userob = new user;
$user = $userob -> authenticate();
$html = new html;

// -----------------------------
// Make sure they should be here
if ($user['U_Status'] != 'Administrator'){
$html -> not_right ("You must be logged in, and be a valid administrator to access this.",$Cat);
}



[:"red"]Lisa[/]
Joined: Jun 2002
Posts: 37
User
User
Offline
Joined: Jun 2002
Posts: 37
Thanks Lisa! Works great now!


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
isaac
isaac
California
Posts: 1,157
Joined: July 2001
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)