# Forums | Mahara Community

## Developers / smarty and tpl files

Deleted user
Posts: 4

16 May 2011, 1:56 PM

I'm making some minor customizations to Mahara and we'd like to have the user's username appear in the footer. Is there a way to have this variable visible in the footer.tpl without having to go into each codebehind for the tpl files?

For example, this works:

I put this in view/view.php:
$smarty->assign('thisUsername',$_SESSION['user/username']);

and I put this in footer.tpl:

Saludos.
Iñaki.

Deleted user
Posts: 4
##### Re: smarty and tpl files

31 May 2011, 9:39 AM

I see it now. That is helpful. Thanks very much.

Deleted user
Posts: 214
##### Re: smarty and tpl files

14 June 2011, 8:15 AM

Hi,

You don't mention what version of mahara you're using, but if you have a look at lib/web.php -> smarty() and search for assign_by_ref('USER' you'll see that the user variable is already always assigned to templates so you should be able to use this relatively easily.

The theme change you want is probably more akin to:

{if $USER->is_logged_id()}{$USER|display_name}{/if}

Of course, I'd highly recommend that if you're doing this you should do it in the following way:

• Create a new theme - e.g. theme/customraw
• Modify any other themes, except for the raw theme to use this theme as their parent
• Add a new footer template to your customraw theme which makes the change you're after

I'd really advise against making changes to the raw theme as you'll find things get difficult to upgrade in the future.

Hope that this helps,

Andrew

Deleted user
Posts: 4
##### Re: smarty and tpl files

11 July 2011, 2:56 PM