11
attock
Re: - Required class?
  • 2007/3/19 14:09

  • attock

  • Not too shy to talk

  • Posts: 138

  • Since: 2006/8/20


Thanks for pointing out :)

but some mysterious resons $xoops_isadmin is not working, so this is what I am doing now. And it works fine for now:

if (is_object($xoopsUser)) { 
       
$uid $xoopsUser->getVar('uid'); 
       
$uname $xoopsUser->getVar('uname');  
      if (
$uname == "admin" || $uname == "attock") {            $musicadmin "yes";      
    }      }


if ($musicadmin) // so on...


12
vaughan
Re: <{if $xoops_isadmin}> - Required class?
  • 2007/3/19 15:19

  • vaughan

  • Friend of XOOPS

  • Posts: 680

  • Since: 2005/11/26


you can also get the uname from the uid by using >

$uname_ = xoops_getLinkedUnameFromId($this->getVar('uid'));

eg.

$uid = $xoopsUser->getVar('uid');
$uname_ = xoops_getLinkedUnameFromId($uid);


as for

Quote:

$xoopsUser->isAdmin() works fine, but if a non-admin login is, the page wont be displayed - it halts any things after $xoopsUser->isAdmin() in php file.


you would have to add an else to the if for non logged in users >

"../../mainfile.php"); 
include(
XOOPS_ROOT_PATH."/header.php"); 

global 
$xoopsUser
 if (
is_object($xoopsUser)) {    
  
$uid $xoopsUser->getVar('uid');  // I saw it another module
  
$uname_ $xoopsUser->getVar('uname');   // I saw it another module

   
echo "check if user..
"
;   
   if (
$xoopsUser->isAdmin()) echo "xoopsUser->isAdmin() result is: True
"
;
   if (
$xoops_isadmin"xoops_admin is: True
"
;     
 }

    if (
$uname == "admin") {
      echo 
"If statemen via uname is: True"
 }
    else { 
     echo 
"uname != admin, instead uname is: $uname";
  }
  
?>


you have missed an opening brace '{' and then a closing '}' after the xoopsUser_isAdmin()

if ($xoopsUser->isAdmin()) [b][color=FF0000]{[/color][/b]echo "xoopsUser->isAdmin() result is: True
"
;
   if (
$xoops_isadmin) [b][color=FF0000]{[/color][/b"xoops_admin is: True
"
;     
 } [
b][color=FF0000]}[/color][/b]

13
attock
Re: - Required class?
  • 2007/3/19 17:01

  • attock

  • Not too shy to talk

  • Posts: 138

  • Since: 2006/8/20


Quote:
you have missed an opening brace '{' and then a closing '}' after the xoopsUser_isAdmin()


No actually I was trying to figure out which one of them works. Like comparing $xoopsUser->isAdmin() would return true or $xoops_isadmin. Is "$xoops_isadmin" a sub branch of $xoopsUser->isAdmin(), $xoops_isadmin is a variable anyway ?

Quote:
you can also get the uname from the uid by using > $uname_ = xoops_getLinkedUnameFromId($this->getVar('uid'));


I'll write this in my little blue book


Another Quick question

- What are the classes required for Including Comments System ?

- Is there a document on how to build a module / basic xooops classes\functions documents ?

That will make life very easy

Thanks for you time ~

Login

Who's Online

346 user(s) are online (113 user(s) are browsing Support Forums)


Members: 0


Guests: 346


more...

Donat-O-Meter

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

Latest GitHub Commits