News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Customize 'Who's Online'

Started by maximumrock, April 05, 2011, 06:09:29 PM

Previous topic - Next topic

maximumrock

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

IchBin™

You can comment out the other array items if you only want to show members.

Code (find in Sources/Who.php) Select
$context['show_methods'] = array(
'all' => $txt['who_show_all'],
'members' => $txt['who_show_members_only'],
'guests' => $txt['who_show_guests_only'],
);



Code (change to this) Select
$context['show_methods'] = array(
//'all' => $txt['who_show_all'],
'members' => $txt['who_show_members_only'],
//'guests' => $txt['who_show_guests_only'],
);
IchBin™        TinyPortal

maximumrock

#2
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?

MoreBloodWine

#3
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'],
     );
}
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


maximumrock

thanks again. i will mess with it tonight..

MoreBloodWine

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.
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


maximumrock

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'],



MoreBloodWine

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'],

Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


maximumrock

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

MoreBloodWine

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.
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


maximumrock

ohh ok.. thx alot..

here is my original one without any edits..

MoreBloodWine

#11
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 ;-)
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


maximumrock


MoreBloodWine

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.
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


maximumrock

dude, no worries at all.. in no rush.... thx for the heads up..

HunterP

Quote from: IchBin™ on April 06, 2011, 12:07:02 PM
Code (find in Sources/Who.php) Select
$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?

maximumrock

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..

maximumrock

Hey MoreBlood. just wondering if you got a chance to look that over yet?

thx

jrstark

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.

Owdy

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';
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

Advertisement: