Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: spiros on May 11, 2020, 06:58:13 AM

Title: Online and offline images change
Post by: spiros on May 11, 2020, 06:58:13 AM
I am trying to change the images to Font Awesome icons. I find it a bit complex to adapt the following string in display.template. I want to replace with those two (online and offline image respectively)

<i class="far fa-comment-dots fa-lg"></i>
<i class="far fa-comment" fa-lg></i>


Here is the string:

// Since we know this person isn't a guest, you *can* message them.
if ($context['can_send_pm'])
echo '
<li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '" class=" tooltip">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . '.gif" alt="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '" />' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>';
Title: Re: Online and offline images change
Post by: vbgamer45 on May 11, 2020, 07:35:00 AM
Try something like

<li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '" class=" tooltip">', $settings['use_image_buttons'] ? '($message['member']['online']['is_online'] ? '<i class="far fa-comment-dots fa-lg"></i>' : <i class="far fa-comment" fa-lg></i>')  : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>';

Title: Re: Online and offline images change
Post by: spiros on May 11, 2020, 07:51:22 AM
Thanks! I got: syntax error, unexpected 'member' (T_STRING)

Title: Re: Online and offline images change
Post by: vbgamer45 on May 11, 2020, 08:03:01 AM
Corrected here

<li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '" class=" tooltip">', $settings['use_image_buttons'] ? ($message['member']['online']['is_online'] ? '<i class="far fa-comment-dots fa-lg"></i>' : '<i class="far fa-comment" fa-lg></i>')  : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>';

Title: Re: Online and offline images change
Post by: spiros on May 11, 2020, 08:06:19 AM
Thanks again!

Now: syntax error, unexpected '/'

I think it was wise of me not to try, if it gives you pain... then I would stand no chance.

I think one can test quickly here:
https://phpcodechecker.com/
Title: Re: Online and offline images change
Post by: vbgamer45 on May 11, 2020, 08:19:38 AM
Forgot the '; on the end
Corrected here

<li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '" class=" tooltip">', $settings['use_image_buttons'] ? ($message['member']['online']['is_online'] ? '<i class="far fa-comment-dots fa-lg"></i>' : '<i class="far fa-comment" fa-lg></i>')  : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>';

Title: Re: Online and offline images change
Post by: spiros on May 11, 2020, 08:23:35 AM
Oh, yes! Thank you so much for your kind help!
Title: Re: Online and offline images change
Post by: vbgamer45 on May 11, 2020, 08:24:48 AM
Glad to help