Loading Profile Avatar in 3rd Party Component

12 years 3 months ago #71252 by Jobbie
Hi,

I am working on the jTips component and am looking to support CB 1.2.

What I'm looking for is to be able to easily load the profile photo of a user when the user id is known.

I'd rather do this kind of thing through a proper API than doing direct database query, so any guidance here on how CB loads a profile photo would be greatly appreciated.

Thanks,
Jeremy
www.jtips.com.au

Please Log in to join the conversation.

12 years 3 months ago #71254 by Jobbie
Nevermind.... I just managed to figure out exactly how to do it by looking at the code for the cblogin module.

:woohoo:

Please Log in to join the conversation.

12 years 3 months ago #71365 by Rapunzl
Can you share your solution? It might help some of us. ;)

Jamie (Rapunzl)
Community Builder Team Member

Before posting on forums: Read all CB Articles | Specially the FAQ | Help us help you
CB links: Subscribe to CB documentation | [url=http://www.joomlapolis.com/content/view/7363/37/
]Our templates[/url] | [url=http://www.joomlapolis.com/content/blogcategory/61/74/
]Paid Subscriptions[/url] | Get Hosting | Our Forge
Visit my CB Profile

My personal site Rapunzl's Reality always under reconstruction

Please Log in to join the conversation.

12 years 3 months ago #71514 by Jobbie
This is the code that you need to call (this will work in J1.0 and 1.5):

function _getCB12Avatar($uid) {
global $ueConfig, $mainframe;
if ( defined( 'JPATH_ADMINISTRATOR' ) ) {
$_CB_joomla_adminpath = JPATH_ADMINISTRATOR;
} else {
$_CB_joomla_adminpath = $mainframe->getCfg( 'absolute_path' ). '/administrator';
}
$_CB_adminpath = $_CB_joomla_adminpath. '/components/com_comprofiler';
include_once( $_CB_adminpath . '/ue_config.php' );
include_once( $_CB_adminpath . '/plugin.foundation.php' );
cbimport( 'cb.database' );
cbimport( 'language.front' );
$cbUser =& CBuser::getInstance($uid);
$path = $cbUser->avatarFilePath( 2 );
return $path;
}

Please Log in to join the conversation.

12 years 3 months ago #71521 by Rapunzl
Thank you Jobbie... upped your karma for sharing. :cheer:

Jamie (Rapunzl)
Community Builder Team Member

Before posting on forums: Read all CB Articles | Specially the FAQ | Help us help you
CB links: Subscribe to CB documentation | [url=http://www.joomlapolis.com/content/view/7363/37/
]Our templates[/url] | [url=http://www.joomlapolis.com/content/blogcategory/61/74/
]Paid Subscriptions[/url] | Get Hosting | Our Forge
Visit my CB Profile

My personal site Rapunzl's Reality always under reconstruction

Please Log in to join the conversation.

12 years 1 month ago #77479 by StebDjui
Hello,

this code show the ThumbNail avatar.
I try to get the FullSize Avatar, have anyone an idea how to get it?

greets

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.423 seconds

Facebook Twitter LinkedIn