Hi,
I just started to use elgg to build my new website and I'm developing a small "plugin" to build a menu to my site but I'm having some problems when I try to use the functions isadmin() and a_href.
I found the code on /lib/elgglib.php and I see them being used everywhere (/lib/templates.php is a good example) but they just don't work when I call them in my plugin.
Here is my code:
<?php
function mainmenu_pagesetup() {
}
function mainmenu_init() {
global $CFG;
$CFG->templates->variables_substitute['mainmenu'][] = "mainmenu_main";
}
function mainmenu_main($vars) {
global $CFG;
global $profile_id;
global $USER;
if (isadmin()) {
$menu_top = array( 'name' => 'admin',
//'html' => a_href("{$CFG->wwwroot}_admin/",
// "Administration"));
'html' =>"<a href=\"{$CFG->wwwroot}_admin/\">".__gettext("Administration")."</a>");
}
if (logged_on) {
$menu_top= array(
'name' => 'userdetails',
//'html' => a_href("{$CFG->wwwroot}_userdetails/",
// "Account settings"));
'html' =>"<a href=\"{$CFG->wwwroot}_userdetails/\">".__gettext("My Account")."</a>");
$menu_top = array(
'name' => 'logoff',
//'html' => a_href("{$CFG->wwwroot}login/logout.php",
// "Log off"));
'html' =>"<a href=\"{$CFG->wwwroot}login/logout.php\">".__gettext("Log off")."</a>");
}
$body = "";
foreach($menu_top as $menu_top) {
$body .= "<Table class=\"menu-table\"><tr><td style=\"color:#6c9c6e;\"> ".$menu_top->html."
|</td></tr></table>";
}
return $body;
}
?>
Can anyone help me??
Thanks!!
Thiago Guerra

Comments
Hi, I´m working with ELGG too.
I´d like create a plugin and looking your code i can see that you don´t use the method template_page_setup( ) (is in /lib/templates.php). This method up all the structure page and you should check this method ...
I´ll see more about this...