1
kerkyra
xoopsUser not working
  • 2008/4/22 19:02

  • kerkyra

  • Just can't stay away

  • Posts: 553

  • Since: 2005/2/14


i'm trying to check if the logged in user is admin for a module routine i'm writing but this code doesnt seem to work! any ideas?

Quote:

if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) {

$adminlink = '<a href="'.XOOPS_URL.'/modules/addresses/admin/addresses.php?op=modLink&lid='.$myrow['lid'].'"><img src="'.XOOPS_URL.'/modules/addresses/images/editicon.gif" border="0" alt="'._MD_EDITTHISLINK.'" align = "middle"/></a>';

}
else {$adminlink = 'kkk';}


this code is within a function which is called with ajax! Everything else is working fine, apart from this code wich always gives false and shows the 'kkk'.

Do i have to include something i missed?

i set up the global variables as
Quote:
function linkLoader(){
global $xoopsDB,$xoopsModuleConfig,$myts,$xoopsConfig,$xoopsTpl,$xoopsModule;
www.guidemap.gr - Beta is out...

2
jlm69
Re: xoopsUser not working
  • 2008/4/22 21:17

  • jlm69

  • Module Developer

  • Posts: 719

  • Since: 2002/7/19


You need to add $xoopsUser to the line below.


function linkLoader(){
global $xoopsDB,$xoopsModuleConfig,$myts,$xoopsConfig,$xoopsTpl,$xoopsModule;

like this:

function linkLoader(){
global $xoopsDB,$xoopsModuleConfig,$myts,$xoopsConfig,$xoopsTpl,$xoopsModule,$xoopsUser;

That will do it.

John

3
kerkyra
Re: xoopsUser not working
  • 2008/4/22 21:27

  • kerkyra

  • Just can't stay away

  • Posts: 553

  • Since: 2005/2/14


if i tell you that i did have it included and didnt work and that now i did it again and worked would you believe it?!!!!

Thanks for your help mate!
www.guidemap.gr - Beta is out...

Login

Who's Online

142 user(s) are online (78 user(s) are browsing Support Forums)


Members: 0


Guests: 142


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