collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 390
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

NEED HELP? If you're looking for support with Simple Portal, look no further than the Support Board!

Author Topic: Add Avatar to Recent Topics/Posts Block  (Read 23915 times)

0 Members and 1 Guest are viewing this topic.

Offline grafitus

  • Comrade
  • *
  • Posts: 1554
  • Gender: Male
  • just looking for own old energy
  • SMF Version: None
  • SP Version: None
Add Avatar to Recent Topics/Posts Block
« on: April 01, 2011, 06:57:34 AM »
This tip allows you to add members' avatars to Recent Topics/Posts block. You could look at how it looks from below:



./Sources/PortalBlocks.php
Code: (Find) [Select]
global $txt, $scripturl, $settings, $context, $color_profile;
Code: (Replace) [Select]
global $txt, $scripturl, $settings, $context, $color_profile;
global $smcFunc, $scripturl, $modSettings;

Code: (Find) [Select]
if ($display == 'compact')
Code: (Replace) [Select]
if ($display == 'full')
{
$members = array();
foreach ($items as $item)
$members[] = $item['poster']['id'];

$request = $smcFunc['db_query']('', '
SELECT m.id_member, m.avatar, a.id_attach, a.attachment_type, a.filename
FROM {db_prefix}members AS m
INNER JOIN {db_prefix}attachments AS a ON (m.id_member = a.id_member)
WHERE m.id_member IN ({array_int:member_ids})',
array(
'member_ids' => $members,
)
);
$avatar_profile = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$avatar_profile[$row['id_member']] = array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? '<img src="' . (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
);
}
$smcFunc['db_free_result']($request);

if (!empty($avatar_profile))
foreach ($items as $k => $p)
if (!empty($avatar_profile[$p['poster']['id']]))
$items[$k]['poster']['avatar'] = $avatar_profile[$p['poster']['id']];
}

if ($display == 'compact')

Code: (Find) [Select]
<td class="sp_recent_info sp_right">
', $item['poster']['link'], '<br />', $item['time'], '
</td>
Code: (Replace) [Select]
<td class="sp_recent_info sp_right">
', $item['poster']['link'], '<br />', $item['time'], '
</td>
<td class="sp_top_poster sp_center">', !empty($item['poster']['avatar']['href']) ? '
<img src="' . $item['poster']['avatar']['href'] . '" alt="' . $item['poster']['avatar']['name'] . '" width="40" />' : '', '
</td>

It works only in "Full" display type.
« Last Edit: April 01, 2011, 06:11:49 PM by grafitus »
my modsI don't reply support PMs. Please use support forums.

Offline Devil jimmy

  • Jr. Member
  • **
  • Posts: 73
  • Gender: Male
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Add Avatar to Recent Topics/Posts Block
« Reply #1 on: April 01, 2011, 11:45:05 AM »
I believe this is not intended for SMF 1.1.13.

Offline grafitus

  • Comrade
  • *
  • Posts: 1554
  • Gender: Male
  • just looking for own old energy
  • SMF Version: None
  • SP Version: None
Re: Add Avatar to Recent Topics/Posts Block
« Reply #2 on: April 01, 2011, 02:36:12 PM »
Oh, I forgot that say. It works only with SMF 2.0 for now.
my modsI don't reply support PMs. Please use support forums.

Offline tartenpoint

  • Newbie
  • Posts: 4
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Add Avatar to Recent Topics/Posts Block
« Reply #3 on: April 22, 2011, 08:48:46 AM »
Great custom!! thanks  :D

Offline visualuser

  • Semi Newbie
  • *
  • Posts: 20
  • SMF Version: 1.1.11
  • SP Version: 2.3.2
Re: Add Avatar to Recent Topics/Posts Block
« Reply #4 on: September 12, 2011, 05:37:29 PM »
in smf 2.0 rc3 does not work for me....

Offline ccbtimewiz

  • Hero Member
  • *****
  • Posts: 2185
  • Gender: Male
  • $("div.content:dd").hide();
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
  • EhPortal Version: None
Re: Add Avatar to Recent Topics/Posts Block
« Reply #5 on: September 12, 2011, 08:22:14 PM »
Update to SMF 2.0, the final version released.

Offline visualuser

  • Semi Newbie
  • *
  • Posts: 20
  • SMF Version: 1.1.11
  • SP Version: 2.3.2
Re: Add Avatar to Recent Topics/Posts Block
« Reply #6 on: September 13, 2011, 06:04:05 AM »
it is a great step that for me, so i prefer at the moment not to make such changes....
forum must be close for some days....
I woll plan it later.

Offline Shadow Queen

  • Jr. Member
  • **
  • Posts: 62
  • Gender: Female
    • My Kingdom
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Add Avatar to Recent Topics/Posts Block
« Reply #7 on: September 14, 2011, 01:13:13 PM »
Does this code work for the Gold Version of SMF?

Because I was trying this out on my test site and it didn't show up at all. I would like to add this to my main site.

Offline grafitus

  • Comrade
  • *
  • Posts: 1554
  • Gender: Male
  • just looking for own old energy
  • SMF Version: None
  • SP Version: None
Re: Add Avatar to Recent Topics/Posts Block
« Reply #8 on: September 17, 2011, 06:46:23 PM »
Likely it works; I think no changes made to affect this code. And I don't try it right now.
my modsI don't reply support PMs. Please use support forums.

Offline Shadow Queen

  • Jr. Member
  • **
  • Posts: 62
  • Gender: Female
    • My Kingdom
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Add Avatar to Recent Topics/Posts Block
« Reply #9 on: September 21, 2011, 11:57:23 AM »
I try it out a week ago. I really like to add this to the main forum.


Offline iobit

  • Jr. Member
  • **
  • Posts: 64
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Add Avatar to Recent Topics/Posts Block
« Reply #10 on: October 03, 2011, 03:45:35 AM »
Hello,
can i add  this in news block?

Thanks

Offline kenng

  • Semi Newbie
  • *
  • Posts: 8
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Add Avatar to Recent Topics/Posts Block
« Reply #11 on: October 29, 2011, 04:37:20 AM »
Hi there, how can i add this for recent post but not full.

Offline BaghdadGhost

  • Translator
  • *
  • Posts: 19
  • SMF Version: 2.0.1
  • SP Version: 2.3.4
Re: Add Avatar to Recent Topics/Posts Block
« Reply #12 on: January 08, 2012, 03:14:49 AM »
I have

smf v2.0.2

sp 2.3.4

I did the above changes and added the block but still the same as before.


thanks

Offline nontanun

  • Newbie
  • Posts: 3
  • SMF Version: 2.0
  • SP Version: 2.3.3
Re: Add Avatar to Recent Topics/Posts Block
« Reply #13 on: March 08, 2012, 02:55:14 AM »
sorry about my English
and i need help.
---------------------
before


after



Offline senyor35

  • Newbie
  • Posts: 4
  • SMF Version: 2.0.7
  • SP Version: 2.3.5
Re: Add Avatar to Recent Topics/Posts Block
« Reply #14 on: May 17, 2014, 05:10:54 PM »
Hello. How can I add the avatars to recent posts right sidebar block please? Example:


Offline senyor35

  • Newbie
  • Posts: 4
  • SMF Version: 2.0.7
  • SP Version: 2.3.5
Re: Add Avatar to Recent Topics/Posts Block
« Reply #15 on: May 18, 2014, 08:34:03 AM »
Nobody care of simple portal please?

Offline phantomm

  • Translator
  • *
  • Posts: 406
  • Gender: Male
  • Smile, tomorrow will be worse...
    • Polish ElkArte community
  • SMF Version: None
  • Elkarte Version: 1.0.5
Re: Add Avatar to Recent Topics/Posts Block
« Reply #16 on: May 18, 2014, 10:21:35 AM »
http://simpleportal.net/index.php?topic=9138.0

and be more patient next time...

Offline senyor35

  • Newbie
  • Posts: 4
  • SMF Version: 2.0.7
  • SP Version: 2.3.5
Re: Add Avatar to Recent Topics/Posts Block
« Reply #17 on: May 18, 2014, 05:29:15 PM »
Hello. Thank you for reply and this is good but I don't want topic description in block. Only show topic title and avatar.. Possible please?

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Add Avatar to Recent Topics/Posts Block
« Reply #18 on: May 19, 2014, 11:42:27 AM »
senyor35 -- please see http://simpleportal.net/index.php?topic=8607.msg45912#msg45912
By description perhaps you mean the board the topic was posted in?  You could certainly change the block to leave that part out.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline OLzenizin

  • Just Registered
  • Posts: 1
  • SMF Version: 1.1.9
  • SP Version: 2.3.3
Re: Add Avatar to Recent Topics/Posts Block
« Reply #19 on: May 23, 2014, 02:35:27 AM »
I believe this is not intended for SMF 1.1.13.