1
skippern
If xoops is admin?
  • 2006/1/25 11:50

  • skippern

  • Just popping in

  • Posts: 27

  • Since: 2005/12/5


Hi!

I have a problem I hope someone can help me with. In an modules template (html) I can write this line <{if $xoops_isadmin == 1}> etc. My question is, can I write the same in an php page if I only want the admin to see (for an example) a link, or do I have to write something else? Or is it impossible?

2
Catzwolf
Re: If xoops is admin?
  • 2006/1/25 11:55

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


if ( $xoopsUser->isAdmin() )
{
echo "show admin stuff";
} else {
echo "You cannot veiw this admin goodies stuff";
}

remember $xoopsUser must be an object thou.

3
skippern
Re: If xoops is admin?
  • 2006/1/25 12:02

  • skippern

  • Just popping in

  • Posts: 27

  • Since: 2005/12/5


Absolutely incredible! The support and help can´t be better then in the XOOPS community!! Thanks!

4
skippern
Re: If xoops is admin?
  • 2006/1/25 12:08

  • skippern

  • Just popping in

  • Posts: 27

  • Since: 2005/12/5


I tried and failed...

I want this string to be visible only for admins, how?

<a href='".XOOPS_URL."/modules/tinyevent/submit.php'><img src='".XOOPS_URL."/images/rubriker/kalender2.gif'></a>

5
frankblack
Re: If xoops is admin?
  • 2006/1/25 12:12

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Perhaps this way?

global $xoopsUser;
if ( 
$xoopsUser->isAdmin() )
{
<
a href='".XOOPS_URL."/modules/tinyevent/submit.php'><img src='".XOOPS_URL."/images/rubriker/kalender2.gif'></a>
}

6
skippern
Re: If xoops is admin?
  • 2006/1/25 12:18

  • skippern

  • Just popping in

  • Posts: 27

  • Since: 2005/12/5


Thanks for the help, but it doesn´t work...
Shows up on the page even if I´m not logged in.

7
wizanda
Re: If xoops is admin?
  • 2006/1/25 12:25

  • wizanda

  • Home away from home

  • Posts: 1585

  • Since: 2004/3/21


if($xoopsUser && ($xoopsUser->isAdmin()))


Thats the code someone on bluemoon gave me to make popchat with only admin can clear. works for me

8
Catzwolf
Re: If xoops is admin?
  • 2006/1/25 12:36

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


Try this sorry, I forgot one little thing

if ( is_object( $xoopsUser ) && $xoopsUser->isAdmin() )
{
<a href='".XOOPS_URL."/modules/tinyevent/submit.php'><img src='".XOOPS_URL."/images/rubriker/kalender2.gif'></a>
}

9
skippern
Re: If xoops is admin?
  • 2006/1/25 12:56

  • skippern

  • Just popping in

  • Posts: 27

  • Since: 2005/12/5


I´ve tried all your suggestions but nothing works, maybe it´s me doing something wrong? I which I was better on php...

The whole string looks like this today.

$content = "<table border='0' cellpadding='0' cellspacing='1' width='100%' class='outer'>";

$content .= "<th colspan='4' align='center''><br>
<a href='".XOOPS_URL."/modules/tinyevent/submit.php'><img src='".XOOPS_URL."/images/rubriker/kalender2.gif'></a><br><br></th>";

10
wizanda
Re: If xoops is admin?
  • 2006/1/25 14:21

  • wizanda

  • Home away from home

  • Posts: 1585

  • Since: 2004/3/21


Sorry here you need to place the code in php, for it to work.


$content "<table border='0' cellpadding='0' cellspacing='1' width='100%' class='outer'>";
if(
$xoopsUser && ($xoopsUser->isAdmin()))
$content .= "<th colspan='4' align='center''><br>
<a href='"
.XOOPS_URL."/modules/tinyevent/submit.php'><img src='".XOOPS_URL."/images/rubriker/kalender2.gif'></a><br><br></th>";



Try this

Not sure if it needs surrounding, yet I didnt and it worked ok

Login

Who's Online

229 user(s) are online (126 user(s) are browsing Support Forums)


Members: 0


Guests: 229


more...

Donat-O-Meter

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

Latest GitHub Commits