JomSocial Avatar and a Custom JomSocial Field in article

8 years 9 months ago #691 by devil
Hi,

you can put the JomSocial Avatar from the author and a Custom Jomsocial Field (like "about me") under the Item.

Open:

joomlaroot/components/com_flexicontent/templates/default/item.php

and paste follow code after Line 165
<!-- BOF Author block -->
<?php
//get authorid
$authorid = $this->item->created_by;

$jspath = JPATH_BASE.DS.'components'.DS.'com_community';
include_once($jspath.DS.'libraries'.DS.'core.php');

//get cuser and some field values
$user =& CFactory::getUser($authorid);
$data = $user->getInfo('FIELD_ABOUTME'); //create an jomsocial custom field (textarea) and enter in the field code: FIELD_ABOUTME
$avatarUrl = $user->getThumbAvatar();
echo '<div style="border:1px solid silver;">';
echo '<p><img src="'. $avatarUrl .'"/></p>';
echo '<p>'.$data.'</p>';
echo '</div>';
?>
<!-- EOF Author block -->

You can style it in anyway you want...
Attachments:

Please Log in or Create an account to join the conversation.

8 years 9 months ago #694 by vistamedia
Cool trick!!!
Thanks for sharing Markus ;-)

FLEXIcontent lead developer.
http://www.vistamedia.fr web agency and custom development.
http://www.joomla.fr co-administrator.
Please no PM for support request, use the forum for that!!!

Please Log in or Create an account to join the conversation.

8 years 4 months ago #7021 by earnware
First, thank you for this code. It worked well.

Can you possibly suggest how to make the author name and avatar link to the user's JomSocial profile?

Thank you for your time and consideration.

Please Log in or Create an account to join the conversation.

8 years 2 months ago #8255 by devil
Hi,

sry for the long delay...

In the next 2-3 weeks i will make a plugin and then the avatar will link to jomsocial profile.

Please Log in or Create an account to join the conversation.

8 years 2 months ago #8257 by iLLeT
This is from JomSocial 3rd Party Component Integration http://www.jomsocial.com/docs/3rd_Party ... ntegration
To Get Profile Link
$jspath = JPATH_ROOT.DS.'components'.DS.'com_community';
include_once($jspath.DS.'libraries'.DS.'core.php');
 
// Get CUser object
$link = CRoute::_('index.php?option=com_community&view=profile&userid='.$userid);
 
echo '[url='. $link .']View user profile[/url]';

Now the bottom has devils code, with Jomsocial link added
<!-- BOF Author block -->
<?php
//get authorid
$authorid = $this->item->created_by;

$jspath = JPATH_BASE.DS.'components'.DS.'com_community';
include_once($jspath.DS.'libraries'.DS.'core.php');

//get cuser and some field values
$user =& CFactory::getUser($authorid);
// Get CUser object
$link = CRoute::_('index.php?option=com_community&view=profile&userid='.$user);
$data = $user->getInfo('FIELD_ABOUTME'); //create an jomsocial custom field (textarea) and enter in the field code: FIELD_ABOUTME
$avatarUrl = $user->getThumbAvatar();
echo '<div style="border:1px solid silver;">';
echo '<p>[url='.$link.']<img src="'. $avatarUrl .'"/>[/url]</p>';
echo '<p>'.$data.'</p>';
echo '</div>';
?>
<!-- EOF Author block -->

I made the avatar link to the jomsocial profile. You can change it to what you want, but you get the idea.

Why join the Navy? when you can be a pirate.

Please Log in or Create an account to join the conversation.

7 years 10 months ago #11332 by tembargo

In the next 2-3 weeks i will make a plugin and then the avatar will link to jomsocial profile.

Je ne le vois pas dans la page "all downloads", je me demandais donc si ce plugin avait finalement était releasé ?

Please Log in or Create an account to join the conversation.

4 years 11 months ago #40645 by magj
Hi
Sorry!, :oops: I know this a very old thread but I couldn't find any better place to ask this.

It (the avatar) still works but the link to profile doesn't work, Is there any change needed to do this?

Joomla 2.5.14
Jomsocial 2.8.4.2
Flexicontent 2.1.0 r1742a

Thanks
Regards

Please Log in or Create an account to join the conversation.

4 years 11 months ago #40660 by ggppdk
Hello

i have not tested integration with this, although we have plans for more tight integration with 3rd party extensions,

but i want to suggest that you backup and upgrade to v2.1.0 r1781 (our officially stable version), has bug-fixes, new features, and has finished work on filtering / search

Regards


-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
© 2018 Flexicontent. All Rights Reserved.