Sorry m0nty, but I have to rebuff what you say here.
Quote:
you should use include_once() instead of require_once for mainfile.php
Include or require is not important here, if the include cannot find the mainfile.php, the $xoopsDB call will throw a fatal error anyway.
Quote:
instead of having $uname = ..........
you could omit that and use >
'uname'=> xoops_getLinkedUnameFromId($this->getVar('uid'));
First off, $this is not defined when in the global scope, so this will throw a fatal error.
Secondly, there is absolutely no need to make another database call when you already have the information you want in the $xoopsUser object, so what he is doing is correct.
Quote:
on the other hand is wrong. You do not manually instantiate the XoopsTpl object as it is done in header.php
Quote:
$sql = $xoopsDB->query("SELECT groupid FROM ".$xoopsDB->prefix('groups')." WHERE name='Affiliate'");
Strictly speaking, what you have is not an SQL statement in the variable, but a DB resultset, so calling the variable $sql is misleading.
Also, querying the groups table directly instead of through the group or member handler class is a nono.
AND querying for a hardcoded group name is... in the lack of a better term... poor. You could use a module configuration option for selecting the proper group.
Quote:
$tpl->append('affs', array(
'uid'=>$uid,
'uname'=>$uname,
'linkurl'=>$linkurl,
'payment'=>$payment,
'groupid'=>$groupid));
No biggie, but append() adds another dimension to the array in Smarty, which is only really useful, when you call it several times. In this case, it would make the template easier to follow if you use assign()
Quote:
$tpl->display(XOOPS_ROOT_PATH . "/modules/affiliate/templates/affiliate_index.html");
Again, not needed. Just set $xoopsOption['template_main'] = "affiliate_index.html";
preferably before including header.php
Quote:
users seem to get admin rights to the rest of the site and when they come out of my module the admin rights stay.
Can you detail it more? Are people actually getting admin rights or does the "Administration menu" link just turn up in their user menu? What can they admin?