6
@blackrx
You might try and replace:
// groups
if( is_object( @$xoopsUser ) ) {
$member_handler =xoops_gethandler( 'member' ) ;
$groups = $member_handler->getGroupsByUser( $xoopsUser->getVar('uid') , true ) ;
foreach( $groups as $group ) {
$groups4assign[] = array( 'id' => $group->getVar('groupid') , 'name' => $group->getVar('name') ) ;
}
} else {
$groups4assign[] = array( 'id' => XOOPS_GROUP_ANONYMOUS , 'name' => _GUESTS ) ;
}
$this->assign( "xugj_groups" , $groups4assign ) ;
with:
// groups
$groups4assign = array();
if ($GLOBALS['xoopsUser'] instanceof XoopsUser)) {
$member_handler = xoops_gethandler('member');
$groups = $member_handler->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid') , true);
if (is_array($groups)) {
foreach( $groups as $group ) {
$groups4assign[] = array('id' => $group->getVar('groupid') , 'name' => $group->getVar('name'));
}
}
}
if (empty($groups4assign) {
$groups4assign[] = array('id' => XOOPS_GROUP_ANONYMOUS , 'name' => _GUESTS);
}
$this->assign( 'xugj_groups' , $groups4assign ) ;
This code change initializes a couple of variables that may not be initialized properly. Let us know if this helps.