Message
  • You don't have permission to view members profile. Please login or register!
Joo!BB - Joomla! Bulletin Board
Welcome, Guest

6 Replies

Display users avatar
Post Display users avatar
by ~cXc~ on 02/02/2010 15:27

I want to show the users avatar in the welcome area of the template I am making, how can I do it?

I've been looking into avatar display in Joo!CM but I'm not getting anywhere. I've probably looked over the proper code a dozen times I'm just missing it o.O

~cXc~


~cXc~

~cXc~

Joo!BB - Newie
Joo!BB - Newie
Registered

Posts: 10

Joined Board
01/30/2010 15:30
Last Visit
03/07/2010 10:36
Offline User is Offline

View all users posts


Re: Display users avatar
Post Re: Display users avatar
by Robbie on 02/02/2010 20:37

~cXc~,

where do you want to add the avatar exactly? In other component? Or do you creating an own template for the Joo!CM view?

Robbie


Robbie

Robbie

Joo!BB - Master
Joo!BB - Master
Administrator

Posts: 713

Joined Board
12/14/2007 10:38
Last Visit
07/27/2010 13:03
Offline User is Offline

View all users posts


Re: Display users avatar
Post Re: Display users avatar
by ~cXc~ on 02/02/2010 21:46

Inside Joo!BB ...


~cXc~

~cXc~

Joo!BB - Newie
Joo!BB - Newie
Registered

Posts: 10

Joined Board
01/30/2010 15:30
Last Visit
03/07/2010 10:36
Offline User is Offline

View all users posts


Re: Display users avatar
Post Re: Display users avatar
by Robbie on 02/03/2010 07:05

You can implement the folowing code into

JOOMLA_ROOT/components/com_joobb/designs/templates/joobb/joobb_header.php

php
Code

$joocmAvatar =& JoocmAvatar::getInstance();

$avatarFile = $joocmAvatar->getAvatarFile($this->joobbUser->get(‘id’);


html
Code
<img src="<?php echo $avatarFile; ?>" />


Robbie

Robbie

Joo!BB - Master
Joo!BB - Master
Administrator

Posts: 713

Joined Board
12/14/2007 10:38
Last Visit
07/27/2010 13:03
Offline User is Offline

View all users posts


Re: Display users avatar
Post Re: Display users avatar
by ~cXc~ on 02/03/2010 11:35

Thank you very much, there is an error in the syntax though ...
Quote by Robbie:Code

$joocmAvatar =& JoocmAvatar::getInstance();

$avatarFile = $joocmAvatar->getAvatarFile($this->joobbUser->get(‘id’);

... should be ...
Code
		$joocmAvatar =& JoocmAvatar::getInstance();

$avatarFile = $joocmAvatar->getAvatarFile($this->joobbUser->get(‘id’));
 

... you just left the ) off the end of the second variable Wink


~cXc~

~cXc~

Joo!BB - Newie
Joo!BB - Newie
Registered

Posts: 10

Joined Board
01/30/2010 15:30
Last Visit
03/07/2010 10:36
Offline User is Offline

View all users posts


Re: Display users avatar
Post Re: Display users avatar
by ~cXc~ on 02/03/2010 11:42

One final question and I can publish my template, this works fine for Joo!CM Avatars but I'm using K2 Avatars how can I make it work for those too?

Or, I guess the better question is can I?

[edit] Nevermind there was another syntax error, the correct code is Code

		$joocmAvatar =& JoocmAvatar::getInstance();

$avatarFile = $joocmAvatar->getAvatarFile($this->joobbUser->get('id'));
the single quotes on either side of id where the cause this time Wink

I'll release my template after I take my daughter to school Big Smile [/edit]


~cXc~

~cXc~

Joo!BB - Newie
Joo!BB - Newie
Registered

Posts: 10

Joined Board
01/30/2010 15:30
Last Visit
03/07/2010 10:36
Offline User is Offline

View all users posts


Re: Display users avatar
Post Re: Display users avatar
by Robbie on 02/03/2010 13:49

oh... sorry for the syntax errors... I made it "on the fly". Blush

Yes, you can use K2 avatars. The code is the same. All you need to change is the Avatar Source in Joo!CM configuration. Wink

[EDIT]
Please be in mind K2 is installed. Wink


Robbie

Robbie

Joo!BB - Master
Joo!BB - Master
Administrator

Posts: 713

Joined Board
12/14/2007 10:38
Last Visit
07/27/2010 13:03
Offline User is Offline

View all users posts


6 Replies

Joo!BB - Joomla! Bulletin Board