By Sunny on Saturday, 03 January 2015
Posted in General Issues
Replies 3
Likes 0
Views 3.8K
Votes 0
I'm trying to get user avatar, user link & the popover.
For achieveing this i scouted the forum and have succesfully got the avatar & the profile link

for testing purposes my hardcoded user ID code is as follows:

<table width="100%">
<?php
defined( '_JEXEC' ) or die( 'Unauthorized Access' );
// Include main engine
$file = JPATH_ROOT . '/administrator/components/com_easysocial/includes/foundry.php';
jimport( 'joomla.filesystem.file' );
if( !JFile::exists( $file ) )
{
return;
}

// Include the engine file.
require_once( $file );

// Check if Foundry exists
if( !FD::exists() )
{
FD::language()->loadSite();
echo JText::_( 'COM_EASYSOCIAL_FOUNDRY_DEPENDENCY_MISSING' );
return;
}
?>
<tbody>
<tr>
<td width="45" height="40">
<?php
$user = FD::user('1039'); //load the user
$profilelink = FRoute:: profile(array('id' => '1039'));
?>
<img src="<?php echo $user->getAvatar(SOCIAL_AVATAR_SMALL);?>" />
</td>
<td height="40"><a href="<?php echo $profilelink; ?> "><?php echo Foundry::user('1039')->getName(); ?></a></td>
<td height="40"> </td>
<td align="center" height="40">1</td>
<td align="center" height="40"> </td>
</tr>
</tbody>
</table>


Now i've two issues remaining to be resolved:

1) Currently the profile link is http://www.site.com/index.php/community/profile/1039, this opens the profile page allright, but the actual profile page link is : http://www.site.com/index.php/community/profile/vshaikh (vshaikh being the permalink)

If i use
$profileLink = $user->getPermalink());
the output page becomes blank, so i used:
$profilelink = FRoute:: profile(array('id' => '1039'));

Can you please guide me on what is the correct procedure for achieving correct profile links (Some people might not have created permalinks and ther profile pages would be profileID-username)

2) I want to have a popover effect on the avatar as in all easysocial which shows the cover, albums, points, add as friend. (Atatching the image), can you also please guide me on this part.

regards
Hello Sunny,

Kindly please understand that customizations are not covered as outlined on our support policy. We can only assist you with the idea on how you can achieve this. Whether it works on your environment or not is something else that you need to experiment with.

Firstly, before you do anything else, you need to understand that before using any EasySocial's code, you need to always start it with the following codes:


<?php require_once(JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php');?>


This will ensure that our libraries are loaded on whichever page you want it to be loaded.


To get the correct permalink, it's advisable to use the permalink helper method from the user's library. Example:


<?php
$user = FD::user($userId);
echo $user->getPermalink();
?>


This will ensure that the user's alias are respected and the settings are also respected.

To display the popover, you will need to perform at least the following,


<?php
// Loads the js library
FD::document()->initScripts();

// Loads the css needed
FD::document()->initStylesheets();

$user = FD::user($userId);
?>
<a href="#" data-popbox="module://easysocial/profile/popbox" data-popbox-position="top-left" data-user-id="<?php echo $userId;?>">
<img src="<?php echo $user->getAvatar();?>" />
</a>


Apart from this, I am sorry but I would not be able to assist you any further.
·
Sunday, 04 January 2015 14:16
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Mark,
I really appreciate you helping beyond your scope.

Regards
·
Sunday, 04 January 2015 20:33
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Sunny,

You're welcome.
·
Monday, 05 January 2015 11:35
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post