1
thelorax
Q & D Way to Determine if User is Anonymous or Admin
  • 2006/2/19 3:35

  • thelorax

  • Just popping in

  • Posts: 4

  • Since: 2006/2/19


What's the quickest way to determine if the user is logged on (i.e. NOT anonymous)?

How about - for users that are NOT anonymous, is user an authorized admin?

I can see the member kernel is the key, but I can't quite decypher how to use it for this.

(Yup! I'm a newbie.)

2
famaTV
Re: Q & D Way to Determine if User is Anonymous or Admin
  • 2006/2/19 7:56

  • famaTV

  • Just popping in

  • Posts: 8

  • Since: 2005/9/14


Here is a simple example ...

if he is a user and an admin, show the admin control panel link, else (if he is an annonymous) show him only the home page url

you may put this in your theme

<tr>
<{if $xoops_isuser}>
<{if $xoops_isadmin}> <a href="<{$xoops_url}>/admin.php">(Admin Area)</a><{/if}>
<{/if}>
</tr>

<tr>
<{if !$xoops_isuser}> <a href="<{$xoops_url}>/">Home</a><{/if}>
</tr>

You may see an example (although its in arabic) in my website http://www.famaTV.net (look at the top header below the logo)

Regards,
famaTV

3
Anonymous
Re: Q & D Way to Determine if User is Anonymous or Admin
  • 2006/2/19 12:02

  • Anonymous

  • Posts: 0

  • Since:


Hi famaTV,

Long time! thank you for your XOOPS supporting.

4
thelorax
Re: Q & D Way to Determine if User is Anonymous or Admin
  • 2006/2/19 15:42

  • thelorax

  • Just popping in

  • Posts: 4

  • Since: 2006/2/19


Thank you for the quick reply. I figured it was something like that. But, I'm a moron. And, I can't get it to work. I'm trying to put it in a module, so here's the relevant part of the index.php...

if (!$xoops_isuser)
{
echo file_get_contents("segments/notxoops.html);
}

else
{
echo file_get_contents("segments/isxoops.html");

if ($xoops_isadmin())
{
echo file_get_contents("segments/isadmin.html");
}
}

---------------
When I'm logged on, and when I'm not, I still get the contents of notxoops.html.

What I'm trying to do is make it so I have item level control of what's displayed (vice displaying a whole block or module based upon user permissions). Any advice would be much appreciated.

Thanks again, in advance!

Login

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits