Forumlar / Cotonti / Support / Avatar In Header

medj
#1 2009-06-29 04:32
I am trying to put the avatar image of a user in the header.tpl.
I tried adding the following line in system/header.php

"HEADER_USER_AVATAR" => sed_build_userimage($urr['user_avatar'], 'avatar'),

so that it looks like:
	$t->assign(array (
		"HEADER_USER_NAME" => $usr['name'],
		"HEADER_USER_ADMINPANEL" => $out['adminpanel'],
		"HEADER_USER_AVATAR" => sed_build_userimage($urr['user_avatar'], 'avatar'),
		"HEADER_USER_LOGINOUT" => $out['loginout'],
		"HEADER_USER_PROFILE" => $out['profile'],
		"HEADER_USER_PMS" => $out['pms'],
		"HEADER_USER_PFS" => $out['pfs'],
		"HEADER_USER_PMREMINDER" => $out['pmreminder'],
		"HEADER_USER_MESSAGES" => $usr['messages']
	));

Anyone have any ideas? As of right now, it doesn't work properly.
Lombi
#2 2009-06-29 04:37
From the top of my head, try usr instead of urr, since I see that as the variable that's being parsed.
<a href="http://www.domenlo.com">Surreal Art</a>
medj
#3 2009-06-29 04:47
Unfortunately, that doesn't work either.
I tried that too noticing that the variable $usr was being used throughout header.php.

Can you tell me where I would find the code that defines "$usr['name']"?
I figure there is an SQL statement there that is getting the name of the user logged in, and all I have to do is add "avatar."
Lombi
#4 2009-06-29 04:52
So have you tried just using avatar?

The code has to be in the same file, just search for the variable troughout the file and you'll find it.
<a href="http://www.domenlo.com">Surreal Art</a>
Kilandor
#5 2009-06-29 05:17
Its in common.php where $usr is set, and avatar isn't one of the default ones.
medj
#6 2009-06-29 06:21
Thanks Kilandor.

I have added the following to common.php in case anyone is wondering in the block where all the other $usr array variables are defined:

$usr['avatar'] = $row['user_avatar'];


I am just wondering, would it not be worth it to add these 2 lines of code (1 to header.php and 1 to common.php) to the default cotonti?
esclkm
#7 2009-06-29 06:31
I think better will be logic blocks
and tag {PHP.row.user_avatar}

Core hack is very bad idea
littledev.ru - мой маленький зарождающийся блог о котонти.
снижение стоимости программирования и снижение стоимости производства разные вещи. Первое можно скорее сравнить с раздачей работникам дешевых инструментов, чем со снижением зарплаты
Kingsley
#8 2009-06-29 07:04
@ esclkm

Got some more info about those 'logic blocks'?
tensh
#9 2009-06-29 14:08
It would be great if somebody listed somewhere global tags... like {PHP.row.something}. I still get them from Neocrome.

The logic blocks are from the updated and enhanced Xtemplate class:
http://www.cotonti.com/forums.php?m=posts&q=2305
SunChase
#10 2009-06-29 19:37
I had a similar problem.But for the Hidemenu.Try this:


The code that calls for the avatar:
$sql = sed_sql_query("SELECT user_avatar FROM $db_users WHERE user_id ='".$usr['id']."'");

The code that makes a picture from it:
$idu="<img src=\"".$row['user_avatar']."\">";

and than just insert the %idu where you want to put the avatar.
[url=http://ka13.orgfree.com]KA13[/url] - The essence of creativity