By Mel on Monday, 26 September 2016
Likes 0
Views 1K
Votes 0
Hi,

I want to add a link to user's Easy Social profile so that when it is clicked it opens their profile page. I am using OS Property and I basically want to add a link to the Agents form so visitors can open up their profile page. I also want to do the same to open up the messaging in Easysocial (unsure if the latter is possible?). I was looking at the developer documentation and think this is what I need to add somewhere:

http://stackideas.com/docs/easysocial/developers/users/retrieving-user-profile

require_once(JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/easysocial.php');
$my = ES::user();
// Retrieve the user's profile object
$profile = $my->getProfile();


public function getProfile()

DO I just paste thiws code inside the relevant file in the position where I want it to appear? Or is it more complex than that?

Is there any step by step guide you know of that would help me work out how to do it? Or is there an easier way to add these 2 links?

Kind regards

Mel
Hi there,

You can try this out:

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

// If you have an id, pass it as an argument
$my = FD::user();
// $my = FD::user($id);

?>


and print out:
<a href="<?php echo $my->getPermalink();?>">
<?php echo $my->getName();?>
</a>
·
Monday, 26 September 2016 19:05
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Muhammad,

apologies for delay replying to this (I was sidetracked with other work).

I am trying to add the code you suggested to my OS Property Agent Details page. The idea being that visitors click on the link to view the Agent's EasySocial profile page, or clicks on a second link to open the EasySocial message composer that relates to the Agent's account. I basically want EasySocial as my main communication and profile management and not use the one included with OS Property so it is consistent for my users.

Is there any kind of example we can work from that shows how to integrate these kinds of things with other 3rd party components?

I am not quite sure if I add all your code as a block in the area where their contact details are on OS Property, or whether I am supposed to put the first line somewhere else? (see rows 100 - 107 below):
<?php
require_once(JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php');

This is my OS Property agentdetails.php file I am trying to edit:


<div class="componentheading">
<?php echo $agent->name?>
</div>
<div class="clearfix"></div>
<div class="row-fluid">
<div class="span12">
<div class="clearfix"></div>
<div class="span2">
<?php
if(($agent->photo != "") and ($configClass['show_agent_image'] == 1)){
?>
<img src='<?php echo JURI::root()?>images/osproperty/agent/<?php echo $agent->photo?>' border="0" />
<?php
}else{
?>
<img src='<?php echo JURI::root()?>components/com_osproperty/images/assets/noimage.jpg' border="0" />
<?php
}
?>
</div>
<div class="span5">
<strong>
<?php echo $agent->name?>
<?php
if($configClass['enable_report'] == 1){
JHTML::_('behavior.modal','a.osmodal');
$translatable = JLanguageMultilang::isEnabled() && count($languages);
if($translatable){
$language = Jfactory::getLanguage();
$language = $language->getTag();
$language = explode("-",$language);
$langfolder = $language[0];
if(file_exists(JPATH_ROOT."/components/com_osproperty/images/assets/".$langfolder."/report.png")){
$report_image = JURI::root()."components/com_osproperty/images/assets/".$langfolder."/report.png";
}else{
$report_image = JURI::root()."components/com_osproperty/images/assets/report.png";
}
}else{
$report_image = JURI::root()."components/com_osproperty/images/assets/report.png";
}
?>
<a href="<?php echo JURI::root()?>index.php?option=com_osproperty&tmpl=component&task=property_reportForm&item_type=1&id=<?php echo $agent->id?>" class="osmodal" rel="{handler: 'iframe', size: {x: 350, y: 600}}" title="<?php echo JText::_('OS_REPORT_AGENT');?>">
<img src="<?php echo $report_image?>" border="0">
</a>
<?php
}
?>
</strong>
<BR />
<?php
if($agent->company_name != ""){
?>
<?php echo JText::_('OS_COMPANY');?>:
<a href="<?php echo JRoute::_('index.php?option=com_osproperty&task=company_info&id='.$agent->company_id.'&Itemid='.OSPRoute::getCompanyItemid())?>">
<?php echo $agent->company_name;?>
</a>
<BR />
<?php
}
?>
<BR />
<?php
if(($configClass['show_agent_phone'] == 1) and ($agent->phone != "")){
?>
<div class="agent_phone">
<strong><?php echo JText::_('OS_PHONE')?>:</strong> <?php echo $agent->phone;?>
</div>
<BR />
<?php
}
?>
<?php
if(($configClass['show_agent_mobile'] == 1) and ($agent->mobile != "")){
?>
<div class="agent_mobile">
<strong><?php echo JText::_('OS_MOBILE')?>:</strong> <?php echo $agent->mobile;?>
</div>
<BR />
<?php
}
?>
<?php
if(($configClass['show_agent_fax'] == 1) and ($agent->fax != "")){
?>
<div class="agent_fax">
<strong><?php echo JText::_('OS_FAX')?>:</strong> <?php echo $agent->fax;?></a>
</div>
<BR />
<?php
}
?>
<?php
if(($configClass['show_agent_email'] == 1) and ($agent->email != "")){
?>
<div class="agent_email">
<strong><?php echo JText::_('OS_EMAIL')?>:</strong> <a href="mailto:<?php echo $agent->email;?>"><?php echo $agent->email;?></a>
</div>
<BR />
<?php
require_once(JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php');

// If you have an id, pass it as an argument
$my = FD::user();
// $my = FD::user($id);

?><a href="/<?php echo $my->getPermalink();?>"><?php echo $my->getName();?></a></div></br>


<?php
}
?>
<?php
if(($configClass['show_agent_skype'] == 1) and ($agent->skype != "")){
?>
<div class="agent_skype">
<strong><?php echo JText::_('Skype')?>:</strong> <?php echo $agent->skype;?>
</div>
<BR />
<?php
}
?>
<?php
if(($configClass['show_agent_msn'] == 1) and ($agent->msn != "")){
?>
<div class="agent_msn">
<strong><?php echo JText::_('MSN')?>:</strong> <?php echo $agent->msn;?>
</div>
<BR />
<?php
}
?>
<?php
if(($configClass['show_agent_gtalk'] == 1) and ($agent->gtalk != "")){
?>
<div class="agent_gtalk">
<strong><?php echo JText::_('GTalk')?>:</strong> <?php echo $agent->gtalk;?>
</div>
<BR />
<?php
}
?>
<?php
if(($configClass['show_agent_facebook'] == 1) and ($agent->facebook != "")){
?>
<div class="agent_facebook">
<strong><?php echo JText::_('Facebook')?>:</strong> <a href="<?php echo $agent->facebook;?>" target="_blank"><?php echo $agent->facebook;?></a>
</div>
<BR />
<?php
}
?>
</div>
<div class="span4">
<?php
if($configClass['show_agent_address'] == 1){
$address = OSPHelper::generateAddress($agent);
if($address != ""){
echo "<span style='font-size:11px;'>".JText::_('OS_ADDRESS').": ".$address."</span>";
}
}
echo "<BR /><BR />";
if($configClass['show_agent_contact'] == 1){
?>
<!--<a href=""><?php echo JText::_('OS_CONTACT_AGENT')?></a> -->
<?php
}

if(($configClass['show_license'] == 1) and ($agent->license != "")){

?>
<div>
<?php
echo "<strong>".JText::_('OS_LICENSE').": </strong>";
echo $agent->license;
?>
</div>
<?php
}
?>
<?php
if(($configClass['show_company_details'] == 1) and ($agent->company_id > 0)){
?>
<div>
<?php
echo "<strong>".JText::_('OS_COMPANY').": </strong>";
$link = JRoute::_('index.php?option=com_osproperty&task=company_info&id='.$agent->company_id.'&Itemid='.OSPRoute::getCompanyItemid());
?>
<span class="hasTip" title="<img src="<?php echo $agent->company_photo;?>" alt="<?php echo str_replace("'","",$agent->company_name);?>" width="100" />">
<i class="osicon-camera"></i>
</span>
|
<?php
echo "<a href='".$link."' title='".$agent->company_name."'>".$agent->company_name."</a>";
?>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
<div class="clearfix"></div>
<?php
$bio = OSPHelper::getLanguageFieldValue($agent,'bio');
if($bio != ""){
?>

<div class="row-fluid">
<div class="span12">
<?php
echo stripslashes($bio);
?>
</div>
</div>
<div class="clearfix"></div>
<?php } ?>


Mel
Mel
·
Friday, 18 November 2016 00:37
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mel,

In order to get the user's profile permalink you must know the current page that get the data from,

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


// If you have an id, pass it as an argument
$my = ES::user($agent->name);
?>

the $id as I mention previously must be change to id that you get the data from
For example from Joomla article we can use the $my = ES::user($item->created_by);
http://screencast.com/t/ZoWQVImNFoU
maybe you can try dump the $agent and see the string for the user id
in what I see the code given, most likely using $agent->name, you need to double confirm it

and now you can echo the link and username

<a href="/<?php echo $my->getPermalink();?>">
<?php echo $my->getName();?>
</a>
·
Friday, 18 November 2016 19:09
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Muhammad,

thank you for replying.

I have tried to do it but failed.

I have submitted a customisation request to your team to see if I can get this integration done by one of your professionals (I don't know what I am doing ) and would rather it was done properly.

I hope to hear from them soon.

Thank you

Mel
Mel
·
Friday, 18 November 2016 21:10
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks, please understand that our support does not cover customizations. Please refrain from posting customization questions on our forums in the future.
·
Saturday, 19 November 2016 18:01
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post