To test if the $USER object is working right you can look at this bit of test code:
<?php
define('INTERNAL', 1);
define('PUBLIC', 1);
require('init.php');
function get_test_info() {
global $USER;
return array(
'name' => 'test',
'plugintype' => 'core',
'pluginname' => 'test',
'elements' => array(
'id' => array(
'type' => 'html',
'title' => 'ID',
'value' => $USER->get('id'),
),
'username' => array(
'type' => 'html',
'title' => 'Username',
'value' => $USER->get('username'),
),
),
);
}
$form = pieform(get_test_info());
$smarty = smarty();
$smarty->assign('form', $form);
$smarty->display('form.tpl');
?>
I created this as htdocs/test.php and it will either display the id/username of the user that is logged in or id = 0 if logged out.
Hopefully that helps with diagnosing your problem
Cheers
Robert
]]>global $USER;
echo empty($USER)?"empty":"dont empty"; //print "empty"
echo "<br>";
echo $USER->get('email'); //print "Call to a member function get() on a non-object"
echo "<br>";
echo $USER->get('username'); //print nothing