Using theme() to add content to user's "My Account" page
The way I understand the theme() function, the first arg is either a function name (or array of functions) -OR- a template name (mytemplate.tpl.php for example). In my module, I'm trying to add stuff to the "view" page for a user's account (above the "History" section). I used the Location module as an example, but I can't get mine to work.
I trying to pass the extra user fields (that my module created) as the second arg to theme(). From what I gather from the API description, this array is turned into $variables which should then be available in the mytemplate.tpl.php, is that correct?
In any case, it's not working for me. It doesn't even seem to be running my template file coz the first thing in it is just a heading(3) - no conditional code at all - and I'm not seeing that on the view user page. Here's the relevant code:
in litdep.module...
function litdep_user($op, &$edit, &$acct, $category = NULL)
{
switch($op)
{
...other case stmts...
case 'view' :
$acct->content['litdep'] = array(
'#type' => 'markup',
'#value' => theme('litdep_user', $acct->litdep), //$acct->litdep = array of extra user fields
);
break;
}
}in litdep_user.tpl.php...
<h3>Personal Information</h3>
<dl>
<?php
if (! empty($last_name) OR ! empty($first_name))
{
echo "<dt>Name</dt>\n";
echo '<dd>';
echo $first_name . (empty($first_name) ? '' : ' ' . $last_name);
echo "</dd>\n";
}
?>
<dt>Gender</dt>
<dd><?php echo ($gender == 1) ? 'Male' : (($gender == 2) ? 'Female' : 'Not specified'); ?></dd>
</dl>I get no output at all - $acct->content['litdep'] is NULL. This appears to be the same as the way the Location module does it, albeit the args passed to theme() are different. Am I correct in my understanding of the way the additional args of theme() are supposed to work? What am I doing wrong?
TIA
