By Abi on Wednesday, 24 April 2019
Replies 2
Likes 0
Views 1.5K
Votes 0
Hello,

I have three profile types : Candidate, Delegate and Champion. I’m trying to modify root/templates/charm/html/com_easysocial/helpers/cover/user.php so that a related badge would be displayed showing the profile.

1_1.png for Candidate (profile ID 1)
1_2.png for Delegate (profile ID 7)
1_3.png for Champion (profile ID 10)

The following code is failing and 1_2.png is displayed for all three profiles instead of for only delegate . Can you help me to get the right code?


<?php echo $this->render('module', 'es-profile-after-name'); ?>
<div class="es-profile-header__meta">
<?php if ($this->config->get('users.layout.profiletitle')) { ?>
<span>
<a href="<?php echo $user->getProfile()->getPermalink();?>" >
<i class="fa fa-shield-alt"></i> <?php echo $user->getProfile()->get('title');?>
</a>
</span>

<?php $myprofile=$user->getProfile()->get('title'); ?>
<?php
if ($myprofile="Delegate") {
echo '<span><center><img src="images/rank/1_2.png"; /></center></span>';
echo $myprofile;
}
?>

<?php } ?>

<?php if ($this->config->get('users.layout.lastonline')) { ?>
<?php if ($user->getLastVisitDate() == '0000-00-00 00:00:00') { ?>
<span>
<?php echo JText::_('COM_EASYSOCIAL_USER_NEVER_LOGGED_IN');?>
</span>
<?php } elseif (!$user->isOnline()) { ?>
<span>
<?php echo JText::_('COM_EASYSOCIAL_PROFILE_LAST_SEE
Hi Abi,

Firstly, I have moved this ticket to more appropriate category.
Seems your code almost correct can you try the code below and see how it goes?
[gist type="php"]
<?php $myprofile=$user->getProfile()->get('title'); ?>
<?php if ($myprofile == 'Delegate') {
echo '<span><center><img src="images/rank/1_2.png"; /></center></span>';
echo $myprofile;
?>
[/gist]

You're suggested to backup the file that you want to customize beforehand for precaution
·
Wednesday, 24 April 2019 11:42
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Muhammed. It worked fine.
Abi
·
Friday, 26 April 2019 00:56
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post