By David on Thursday, 11 January 2018
Posted in Technical Issues
Replies 11
Likes 0
Views 556
Votes 0
Hi,

I just configured the URL field via Easysocial workflows and would like it to show on the user profile, directly below Joined date, and with an icon like <i class="fa fa-link" aria-hidden="true"></i>

What's the easiest way to do this (see attached image)?

Cheers, David
Hi there,

You will need to do some modification in order to achieve this.

By the way, you can use codes below and apply them on this path .../components/com_easysocial/themes/wireframe/profile/default/default.php

For example:

[gist type="php"]
<i class="fa fa-link" aria-hidden="true">
<?php $URL = $user->getFieldValue('URL'); ?>
<?php echo $URL; ?>
</i>
[/gist]

That field value, you can check them on each users profile type's workflows as you can see here http://take.ms/wAe0L

Please give it a try and see how it goes.

Note:
You can refer it code styling on this path .../components/com_easysocial/themes/wireframe/profile/default/default.php
·
Thursday, 11 January 2018 14:18
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Warith.

This is what I've got so far:

<li class="o-nav__item t-text--muted t-lg-mb--sm">
<i class="es-side-widget__icon t-lg-mr--md fa fa-link"></i>
<?php $URL = $user->getFieldValue('URL'); ?>
<a href="<?php echo $URL; ?>"><?php echo $URL; ?></a>
</li>


Have got it mostly working so far and have added a fa-link but because it's an optional field, when a user doesn't complete it, the fa-link just remains there without a link. As you can imagine, this looks like an error.

How can I use an if statement to only show the field if it's completed by the user?

Cheers, David
·
Thursday, 11 January 2018 21:01
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi there,

Yes, you need to use if statement so that it will not shown if your user doesn't filled in those fields. Maybe you can try codes below and see how it goes.

[gist type="php"]
<?php $URL = $user->getFieldValue('URL'); ?>

<?php if ($URL) { ?>
<li class="o-nav__item t-text--muted t-lg-mb--sm">
<i class="es-side-widget__icon t-lg-mr--md fa fa-link"></i>
<a href="/<?php echo $URL; ?>"><?php echo $URL; ?></a>
</li>
<?php } ?>
[/gist]
·
Friday, 12 January 2018 11:14
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Warith, just tried this but it didn't work. The link icon still shows even when the field is empty.

Any ideas?
·
Friday, 12 January 2018 12:04
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi David,

Maybe you can provide us with valid FTP access for me to further check on this issues. Please advice.
·
Friday, 12 January 2018 12:30
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Warith, I've been updating FTP via the tickets and thought this would update on my profile but it doesn't work like this (maybe you can mention that you need to update via the profile on the ticket FTP access area). Have just updated my profile FTP details so hopefully this should work going forward. Cheers, David
·
Friday, 12 January 2018 12:43
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi there,

I have added those necessary fixes on your site and it should works fine now.

By the way, i would advice you to apply this on template override path so that it can be used on your future release version. It template override is at .../template/current_tempalte/html/com_easyblog/profile/default/default.php

Please give it a check and see how it goes.
·
Friday, 12 January 2018 15:19
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Warith, looks good! You probably knew I was going to ask you this - how do I add this to the mobile view? Ideally, it should go below the ellipsis in the header.. Will add these as overrides once they're done.

Cheers, David
·
Friday, 12 January 2018 16:05
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi there,

You need to do some customization on other part of your files now in order for you to achieve this. You can add previous codes as follow below at this path .../components/com_easysocial/themes/wireframe/helpers/cover/user.php.

[gist type="php"]
<?php $URL = $user->getFieldValue('URL'); ?>
<?php if ($this->isMobile()) { ?>
<?php if ($URL instanceof SocialFieldValue && $URL->data) { ?>
<li class="o-nav__item t-text--muted t-lg-mb--sm">
<i class="es-side-widget__icon fa fa-link t-lg-mr--md"></i>
<a href=""><?php echo $URL; ?></a>
</li>
<?php } ?>
<?php } ?>
[/gist]

You can add them on this class listed below.

[gist type="php"]
<div class="btn-toolbar" role="toolbar">
[/gist]

Please give it a try and see how it goes.
·
Friday, 12 January 2018 17:15
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post