Simple Machines Community Forum

Customizing SMF => Graphics and Templates => Topic started by: radge on January 23, 2024, 02:49:47 PM

Title: Show avatar icon into mobile version, using default theme
Post by: radge on January 23, 2024, 02:49:47 PM
I am using smf 2.1.4 with the default theme and I cannot show the avatars in the posts, in the mobile version.

I have tried to modify this in file index.template.php

// Set the following variable to true if this theme wants to display the avatar of the user that posted the last and the first post on the message index and recent pages.
$settings['avatars_on_indexes'] = true;

// Set the following variable to true if this theme wants to display the avatar of the user that posted the last post on the board index.
$settings['avatars_on_boardIndex'] = true;

And this file BoardIndex.template.php

I have replaced this
function template_bi_board_lastpost($board)
{
if (!empty($board['last_post']['id']))
echo '
<p>', $board['last_post']['last_post_message'], '</p>';
}


With this code

function template_bi_board_lastpost($board)
{
if (!empty($board['last_post']['id']))
echo '
', $board['last_post']['member']['avatar']['image'], '
<p>', $board['last_post']['last_post_message'], '</p>';
}


It's strange because now in the mobile version the icons appear in the forum index, but when I enter a post they don't appear.

Thanks in advance.
Title: Re: Show avatar icon into mobile version, using default theme
Post by: TwitchisMental on January 23, 2024, 04:57:25 PM
QuoteIt's strange because now in the mobile version the icons appear in the forum index, but when I enter a post they don't appear.

Thanks in advance.


What you are editing has nothing to do with avatars in the post section. I would suggest undoing those changes.

To do what you are wanting to do -

Open responsive.css

Find :

.user_info li,
.custom_fields_above_member {
display: none;
}

Add After :

.user_info .avatar{
display: inline;
}
Title: Re: Show avatar icon into mobile version, using default theme
Post by: Diego Andrés on January 23, 2024, 05:08:39 PM
Like @TwitchisMental said, what you did is unrelated to the posts. Use his poroposed solution.

This is also another option:
https://www.simplemachines.org/community/index.php?topic=587654.msg4164844#msg4164844
Title: Re: Show avatar icon into mobile version, using default theme
Post by: TwitchisMental on January 23, 2024, 06:08:12 PM
Quote from: Diego Andrés on January 23, 2024, 05:08:39 PMLike @TwitchisMental said, what you did is unrelated to the posts. Use his poroposed solution.

This is also another option:
https://www.simplemachines.org/community/index.php?topic=587654.msg4164844#msg4164844
This would actually look alot better :).