Is there any way i could customize what regular users see on "Who's Online" screen......i have SMF 2.0 RC5
on the screen, there is a drop down box that i can do for myself to view only Everyone, Members Only, and Guests.
I want everyone to be able to only have option to see "members only"......Any way to do that?
thx,
Max
You can comment out the other array items if you only want to show members.
$context['show_methods'] = array(
'all' => $txt['who_show_all'],
'members' => $txt['who_show_members_only'],
'guests' => $txt['who_show_guests_only'],
);
$context['show_methods'] = array(
//'all' => $txt['who_show_all'],
'members' => $txt['who_show_members_only'],
//'guests' => $txt['who_show_guests_only'],
);
Thanks!! those 2 thing u posted look the same? i cant see a difference in code,
what part would i change on on the 2nd one?
Quote from: maximumrock on April 07, 2011, 05:41:25 PM
Thanks!! will admins still be able to view all guests and such??
No because his suggestion cuts them out all together.
You might have to use something like this... provided I formatted it right.
Find:
$context['show_methods'] = array(
'all' => $txt['who_show_all'],
'members' => $txt['who_show_members_only'],
'guests' => $txt['who_show_guests_only'],
);
Replace With:
if($context['user']['is_admin']){
$context['show_methods'] = array(
'all' => $txt['who_show_all'],
'members' => $txt['who_show_members_only'],
'guests' => $txt['who_show_guests_only'],
);
}else{
$context['show_methods'] = array(
// 'all' => $txt['who_show_all'],
'members' => $txt['who_show_members_only'],
// 'guests' => $txt['who_show_guests_only'],
);
}
thanks again. i will mess with it tonight..
Quote from: maximumrock on April 07, 2011, 06:21:16 PM
thanks again. i will mess with it tonight..
Welcome and like I said, provided I wrote it right that should allow everyone to see only members with the exception to site admin being allowed to see everyone.
Moreblood.... No luck on that one. BUT the drop down box is locked to show show "members only".......not sure why it still shows guests when i log on as a regular member...So you are definitely on the right track..
Only thing i notice thats odd is these 2 lines (on the code you gave me to replace with) in dreamweaver code view, show up as "yellow/orange" instead of mostly RED like the others.. Could that be something you think?
// 'all' => $txt['who_show_all'],
// 'guests' => $txt['who_show_guests_only'],
Maybe the code originally posted that I modified was just for the drop box and not the actual display. One way to tell would be to implement my code and then check the drop box on admin, then logged out a guest / regular member. Again, provided I wrote it right.
The // just comments them out from PHP reading it, in reality you can just remove the two lines with the preceding //'s.
Quote from: maximumrock on April 07, 2011, 09:13:39 PM
Moreblood.... No luck on that one. BUT the drop down box is locked to show show "members only".......not sure why it still shows guests when i log on as a regular member...So you are definitely on the right track..
Only thing i notice thats odd is these 2 lines (on the code you gave me to replace with) in dreamweaver code view, show up as "yellow/orange" instead of mostly RED like the others.. Could that be something you think?
// 'all' => $txt['who_show_all'],
// 'guests' => $txt['who_show_guests_only'],
I logged in as admin and everything normal is it was originally to me.. but when i go back onto a guest/regular acct, Only change is just the drop box only shows "members only" but guests are still viewable
Quote from: maximumrock on April 07, 2011, 11:55:36 PM
I logged in as admin and everything normal is it was originally to me.. but when i go back onto a guest/regular acct, Only change is just the drop box only shows "members only" but guests are still viewable
Again, that's because it's for just the dropbox... attach your Who.template.php file and I'll fix it up for ya so the lists display based on values in the drop box.
ie. As admin everything shows as is does now fine, but if logged out as guest / regular user only members show in the drop box as well as the actual list of users.
ohh ok.. thx alot..
here is my original one without any edits..
Quote from: maximumrock on April 08, 2011, 10:23:25 AM
ohh ok.. thx alot..
here is my original one without any edits..
DL now get this back to you in about an hr or so if thats alright. Got some other stuff I need to finish ;-)
sounds good! thx!
Quote from: maximumrock on April 08, 2011, 06:56:34 PM
sounds good! thx!
Something came up and I need to run out of the house for a few hrs so I'll get to this when I'm back, in the meantime if someone else wanted to jump on it that's fine because the basic codes already there with the if statement I posted before for the drop box. It's just a matter of placement.
dude, no worries at all.. in no rush.... thx for the heads up..
Quote from: IchBin™ on April 06, 2011, 12:07:02 PM
$context['show_methods'] = array(
'all' => $txt['who_show_all'],
'members' => $txt['who_show_members_only'],
'guests' => $txt['who_show_guests_only'],
);
By default, "guests" is selected. How can i make "Members" the default selection?
Good question Hunter. On the code that moreblood first provided to me.. that did give me the only option for "members" but didnt take effect on the who's online list....... Maybe his solution to me will help you too..
Hey MoreBlood. just wondering if you got a chance to look that over yet?
thx
Is there any way to remove mentions of who is reporting a post? I'd like to protect whistleblowers. I'm using 1.1.13.
Quote from: jrstark on April 29, 2011, 01:57:47 PM
Is there any way to remove mentions of who is reporting a post? I'd like to protect whistleblowers. I'm using 1.1.13.
Sure, just edit the lang file.
Who.english.php
$txt['whoall_reporttm'] = 'Reporting a topic to a moderator.';
to
$txt['whoall_reporttm'] = 'Drinking Pepsi';
Very cool, thanks!
If you are using SMF 2, remember empty SMF cache after lang file edit (if you dont edit it via admin panel) :)
Quote from: HunterP on April 10, 2011, 12:55:20 PM
Quote from: IchBin™ on April 06, 2011, 12:07:02 PM
$context['show_methods'] = array(
'all' => $txt['who_show_all'],
'members' => $txt['who_show_members_only'],
'guests' => $txt['who_show_guests_only'],
);
By default, "guests" is selected. How can i make "Members" the default selection?
Took a while (ofcourse I haven't bee looking for this all the time), but I found it :
File : Who.php
Function: Who()
// Fallback to top filter?
if (isset($_REQUEST['submit_top']) && isset($_REQUEST['show_top']))
$_REQUEST['show'] = $_REQUEST['show_top'];
// Does the user wish to apply a filter?
if (isset($_REQUEST['show']) && isset($show_methods[$_REQUEST['show']]))
{
$context['show_by'] = $_SESSION['who_online_filter'] = $_REQUEST['show'];
$conditions[] = $show_methods[$_REQUEST['show']];
}
// Perhaps we saved a filter earlier in the session?
elseif (isset($_SESSION['who_online_filter']))
{
$context['show_by'] = $_SESSION['who_online_filter'];
$conditions[] = $show_methods[$_SESSION['who_online_filter']];
}
else
$context['show_by'] = $_SESSION['who_online_filter'] = 'all';
Change the last line into :
$context['show_by'] = $_SESSION['who_online_filter'] = 'members';
And "members" will be the default selection.
Quote from: HunterP on October 16, 2011, 01:23:15 PM
Change the last line into :
$context['show_by'] = $_SESSION['who_online_filter'] = 'members';
And "members" will be the default selection.
Thank you. I've been hunting that down for a week now ;D
A little update. Sometimes when the dropdownbox shows "members", all visitors (members and guests) are being displayed. When selecting all (or guests) and reselecting "Members" again, it's OK. I figured out that one line needs to be added :
// Does the user wish to apply a filter?
if (isset($_REQUEST['show']) && isset($show_methods[$_REQUEST['show']]))
{
$context['show_by'] = $_SESSION['who_online_filter'] = $_REQUEST['show'];
$conditions[] = $show_methods[$_REQUEST['show']];
}
// Perhaps we saved a filter earlier in the session?
elseif (isset($_SESSION['who_online_filter']))
{
$context['show_by'] = $_SESSION['who_online_filter'];
$conditions[] = $show_methods[$_SESSION['who_online_filter']];
}
else
{
$context['show_by'] = $_SESSION['who_online_filter'] = 'members'; // was 'all'
$conditions[] = $show_methods[$_REQUEST['show']];
}
When I added the last line :
$conditions[] = $show_methods[$_REQUEST['show']];
It finally seems to work OK.