1
dickinsd
Restrict Whos Online block to webmaster only??
  • 2004/11/17 2:46

  • dickinsd

  • Quite a regular

  • Posts: 278

  • Since: 2004/11/14


Hello, can anyone tell me how to restrict the Whos online block?

I can set it to either be there, or not be there, if I show this block, it is universal, and everyone can see it, I only want the webmaster to be able to view this block.

Does anyone have any tips?

I have tried going into admin menu and choosing blocks, choosing webmaster from the top drop down menu and then saying yes to the block in question, but this seems to allow everyone to see it!

Appreciate any tips!

Dave


2
ackbarr
Re: Restrict Whos Online block to webmaster only??

The dropdown menus in System -> Blocks do not control who can see what block. If you read its label it says:

Quote:

Show blocks visible in: [Module] Group [Group List]


If you what to adjust which groups can see which blocks, you'll want to go to System -> Groups, and modify the groups that should not see the block.

One word of caution before you run out to do so. The who's online block is not completely real-time, it's written to remove stale records a fraction of the times it is displayed in the page. This means that if it is only displayed for webmasters it will be updated even less than normal, usually causing your number of users online to appear much higher than it really is. A better trick is to add the block to the page, but hide it in the smarty templates. Please note that this is highly theme specific and may need to be modified before it works on your site. The concepts are still the same however.

Using the default theme, let's say you want the "Who's Online" block to display on the left sidebar.

Modify the file /themes/default/theme_blockleft.html, changing this:
<div class="blockTitle"><{$block.title}>div>
<
div class="blockContent"><{$block.content}>div>

to:
<{if $block.title eq "Who's Online"}>
  <{if 
$xoops_isadmin eq 1}>
<
div class="blockTitle"><{$block.title}>div>
<
div class="blockContent"><{$block.content}>div>
  <{/if}>
<{else}>
<
div class="blockTitle"><{$block.title}>div>
<
div class="blockContent"><{$block.content}>div>
<{/if}>

The change above causes the Who's Online block to be run on each page, but only displayed for admins. Of course, if you later decide that you want to move the block to the right sidebar you'd need to make these same changes to /themes/default/theme_blockright.html

3
dickinsd
Re: Restrict Whos Online block to webmaster only??
  • 2004/11/18 2:04

  • dickinsd

  • Quite a regular

  • Posts: 278

  • Since: 2004/11/14


Thanx for reply,

Sounds like thats what I need to do, and thanx for info about the module.

Dave

Login

Who's Online

321 user(s) are online (279 user(s) are browsing Support Forums)


Members: 0


Guests: 321


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits