Advertisement:

Author Topic: display avy in ssi_boardNews  (Read 36815 times)

Offline diplomat.

  • SMF Friend
  • Full Member
  • *
  • Posts: 545
  • Gender: Male
  • avidSOUND
    • avidSOUND
display avy in ssi_boardNews
« on: January 06, 2005, 05:21:31 PM »
is it possible to display the avatar of the person who made the topic along with the topic body of ssi_boardNews? i made a little example:



can the avy or the topic author be pulled so that it shows up on the page sort of like that
avidSOUND.com: Where Aspiring Musicians Can Be HEARD!

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: display avy in ssi_boardNews
« Reply #1 on: January 10, 2005, 05:02:42 AM »
Sorry for taking so long to respond.

It's possible, but it could take some modification...

From SSI.php:
Code: [Select]
SELECT
m.icon, m.subject, m.body, IFNULL(mem.realName, m.posterName) AS posterName, m.posterTime,
t.numReplies, t.ID_TOPIC, m.ID_MEMBER, m.smileysEnabled
FROM {$db_prefix}topics AS t, {$db_prefix}messages AS m
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
WHERE t.ID_BOARD = $board
AND m.ID_MSG = t.ID_FIRST_MSG
ORDER BY m.ID_MSG DESC
LIMIT $start, $limit", __FILE__, __LINE__);

Make that:
Code: [Select]
SELECT
m.icon, m.subject, m.body, IFNULL(mem.realName, m.posterName) AS posterName, m.posterTime,
t.numReplies, t.ID_TOPIC, m.ID_MEMBER, m.smileysEnabled, mem.avatar, a.ID_ATTACH
FROM {$db_prefix}topics AS t, {$db_prefix}messages AS m
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = m.ID_MEMBER)
WHERE t.ID_BOARD = $board
AND m.ID_MSG = t.ID_FIRST_MSG
ORDER BY m.ID_MSG DESC
LIMIT $start, $limit", __FILE__, __LINE__);

Not much later, after:
Code: [Select]
$row['body'] = doUBBC($row['body'], $row['smileysEnabled']);
Add:
Code: [Select]
if (stristr($row['avatar'], 'http://') && !empty($modSettings['avatar_check_size']))
{
$sizes = url_image_size($row['avatar']);

// Does your avatar still fit the maximum size?
if ($modSettings['avatar_action_too_large'] == 'option_refuse' && is_array($sizes) && (($sizes[0] > $modSettings['avatar_max_width_external'] && !empty($modSettings['avatar_max_width_external'])) || ($sizes[1] > $modSettings['avatar_max_height_external'] && !empty($modSettings['avatar_max_height_external']))))
{
// Fix it permanently!
$row['avatar'] = '';
updateMemberData($row['ID_MEMBER'], array('avatar' => '\'\''));
}
}

And then find:
Code: [Select]
'is_last' => false
Make that:

Code: [Select]
'is_last' => false,
'avatar' => array(
'name' => &$row['avatar'],
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 && !empty($modSettings['avatar_allow_upload']) ? '<img src="' . $scripturl . '?action=dlattach;id=' . $row['ID_ATTACH'] . ';type=avatar" alt="" />' : '') : (stristr($row['avatar'], 'http://') && !empty($modSettings['avatar_allow_external_url']) ? '<img src="' . $row['avatar'] . '"' . ($modSettings['avatar_action_too_large'] == 'option_html_resize' ? (!empty($modSettings['avatar_max_width_external']) ? ' width="' . $modSettings['avatar_max_width_external'] . '"' : '') . (!empty($modSettings['avatar_max_height_external']) ? ' height="' . $modSettings['avatar_max_height_external'] . '"' : '') : '') . ' alt="" border="0" />' : (!empty($modSettings['avatar_allow_server_stored']) ? '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" border="0" />' : '')),
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 && !empty($modSettings['avatar_allow_upload']) ? $scripturl . '?action=dlattach;id=' . $row['ID_ATTACH'] . ';type=avatar' : '') : (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'])
),

Then you have the href and image ;).

-[Unknown]

Offline Midgard

  • Jr. Member
  • **
  • Posts: 271
  • Gender: Male
Re: display avy in ssi_boardNews
« Reply #2 on: January 10, 2005, 05:07:31 AM »
Great theme, i wanna :)

Offline Iriasu

  • Newbie
  • *
  • Posts: 7
    • Rockman Perfect Memories
Re: display avy in ssi_boardNews
« Reply #3 on: June 05, 2005, 06:59:39 PM »
When I add ', $news['avatar'], ' to the place where I want to show my avatar, it just says "Array" on that spot of my news posts. The actual coding seems to work somewhat fine, but what is that small string I should write to make avatars show up on news post?

Something in the fashion of:
', $something['something'], '

Thanks in advance! ^_^

EDIT: Nevermind. I found out myself. I wrote ', $news['avatar']['image'], ' and it worked splendidly. ^^

EDIT: While I'm at the questionings, what should I do, if I want my (as an example) 100x100 avatar on my board show up on my news posts as 50x50 instead? I want the avatar to keep its original size in the board, but reduce its size on news posts.
« Last Edit: June 05, 2005, 07:17:00 PM by DJSonic »
hxxp:www.rockmanpm.com [nonactive]
Fight, Iriasu! For Everlasting Orange Fanta!
hxxp:img100.exs.cx/img100/2870/nvcdash4qs.gif [nonactive]

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: display avy in ssi_boardNews
« Reply #4 on: June 14, 2005, 05:09:53 AM »
<img src="', $news['avatar']['href'], '" width="50" height="50" alt="" />

-[Unknown]

Offline MKava

  • Semi-Newbie
  • *
  • Posts: 15
  • Gender: Male
  • Gaming Addict Since 1993.
    • Nintendo Freaks
Re: display avy in ssi_boardNews
« Reply #5 on: March 11, 2007, 12:47:08 AM »
Can somebody please update this for the latest released version of SMF?
I'm running v1.1.2 and couldn't get to this work. It'd be a real nice feature to add on just for a little more flavor to my site. :D
M. Kava
SMF Forums: Freaky Forums [nofollow] for NintendoFreaks.com

Offline codenaught

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 14,653
  • Gender: Male
  • Formerly Known As akabugeyes
Re: display avy in ssi_boardNews
« Reply #6 on: July 01, 2007, 12:24:58 PM »
Can somebody please update this for the latest released version of SMF?
I'm running v1.1.2 and couldn't get to this work. It'd be a real nice feature to add on just for a little more flavor to my site. :D
MKava, still need help with this?
Dev Consultant
Former SMF Doc Coordinator

Offline KouZeN

  • Newbie
  • *
  • Posts: 3
  • Gender: Female
    • Generation ANKOKU
Re: display avy in ssi_boardNews
« Reply #7 on: July 02, 2007, 09:50:47 PM »
I'd like to see this updated for v1.1.3 if at all possible.

Offline Ryatzu

  • Newbie
  • *
  • Posts: 5
Re: display avy in ssi_boardNews
« Reply #8 on: September 03, 2007, 10:55:05 AM »
please update it, realy need this

Offline codenaught

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 14,653
  • Gender: Male
  • Formerly Known As akabugeyes
Re: display avy in ssi_boardNews
« Reply #9 on: September 03, 2007, 04:31:30 PM »
Code for 1.1.3 (Simply adapted from [Unknown]'s):

SSI.php

Code: (Find) [Select]
SELECT
m.icon, m.subject, m.body, IFNULL(mem.realName, m.posterName) AS posterName, m.posterTime,
t.numReplies, t.ID_TOPIC, m.ID_MEMBER, m.smileysEnabled, m.ID_MSG, t.locked
FROM ({$db_prefix}topics AS t, {$db_prefix}messages AS m)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
WHERE t.ID_FIRST_MSG IN (" . implode(', ', $posts) . ")
AND m.ID_MSG = t.ID_FIRST_MSG
ORDER BY t.ID_FIRST_MSG DESC
LIMIT " . count($posts), __FILE__, __LINE__);

Code: (Replace with) [Select]
SELECT
m.icon, m.subject, m.body, IFNULL(mem.realName, m.posterName) AS posterName, m.posterTime,
t.numReplies, t.ID_TOPIC, m.ID_MEMBER, m.smileysEnabled, m.ID_MSG, t.locked, mem.avatar, a.ID_ATTACH, a.attachmentType, a.filename
FROM ({$db_prefix}topics AS t, {$db_prefix}messages AS m)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = m.ID_MEMBER)
WHERE t.ID_FIRST_MSG IN (" . implode(', ', $posts) . ")
AND m.ID_MSG = t.ID_FIRST_MSG
ORDER BY t.ID_FIRST_MSG DESC
LIMIT " . count($posts), __FILE__, __LINE__);

Code: (Find) [Select]
$row['body'] = parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']);
Code: (After add) [Select]
if (stristr($row['avatar'], 'http://') && !empty($modSettings['avatar_check_size']))
{
$sizes = url_image_size($row['avatar']);

// Does your avatar still fit the maximum size?
if ($modSettings['avatar_action_too_large'] == 'option_refuse' && is_array($sizes) && (($sizes[0] > $modSettings['avatar_max_width_external'] && !empty($modSettings['avatar_max_width_external'])) || ($sizes[1] > $modSettings['avatar_max_height_external'] && !empty($modSettings['avatar_max_height_external']))))
{
// Fix it permanently!
$row['avatar'] = '';
updateMemberData($row['ID_MEMBER'], array('avatar' => '\'\''));
}
}

Code: (Find (in ssi_boardNews function)  ) [Select]
'is_last' => false

Code: (Replace above with (Code adapted from Load.php)  ) [Select]
'is_last' => false,
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img src="' . (empty($row['attachmentType']) ? $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'] . '" 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['attachmentType']) ? $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']),
),

Then you can use either add the variables as you wish in the template output inside the SSI function, or if not using the 'echo' return type when calling the function, you can just use the added variables as needed when outputting the news.
Dev Consultant
Former SMF Doc Coordinator

Offline Ryatzu

  • Newbie
  • *
  • Posts: 5
Re: display avy in ssi_boardNews
« Reply #10 on: September 08, 2007, 08:51:31 AM »
ok i changed it, how can i get the avatar on the index now?

Offline Ryatzu

  • Newbie
  • *
  • Posts: 5
Re: display avy in ssi_boardNews
« Reply #11 on: September 08, 2007, 09:23:11 AM »
found an solution sorry :)

Offline mira-san

  • Semi-Newbie
  • *
  • Posts: 50
  • Gender: Female
Re: display avy in ssi_boardNews
« Reply #12 on: October 15, 2007, 08:42:17 AM »
I try to make that but it doesn't work in smf 1.14
I make all the step.
Hope you can help me please.

Offline codenaught

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 14,653
  • Gender: Male
  • Formerly Known As akabugeyes
Re: display avy in ssi_boardNews
« Reply #13 on: November 13, 2007, 12:45:33 AM »
I try to make that but it doesn't work in smf 1.14
I make all the step.
Hope you can help me please.
Were you trying to use my code I posted?

What doesn't work about it? Could you not find all of the code that is there? Do you get parse errors? That code alone, won't show the avatar, you would need to echo out the avatar variable created with that code manually, which I can help with if I know that is the stage you are on (That you have successfully applied those code changes with no errors but don't see an avatar being displayed).
Dev Consultant
Former SMF Doc Coordinator

Offline myaicons

  • Jr. Member
  • **
  • Posts: 228
  • Gender: Female
Re: display avy in ssi_boardNews
« Reply #14 on: February 11, 2008, 09:00:57 PM »
@ akabugeyes

does your code work with 1.1.4?

can i get further details? Thanks!
i scratch your back you scratch my back...
funny thing about my back is its located on my...

Offline Ryatzu

  • Newbie
  • *
  • Posts: 5
Re: display avy in ssi_boardNews
« Reply #15 on: February 13, 2008, 05:09:30 AM »
Just used it again in 1.14, works great.

Offline myaicons

  • Jr. Member
  • **
  • Posts: 228
  • Gender: Female
Re: display avy in ssi_boardNews
« Reply #16 on: February 13, 2008, 10:41:40 AM »
That code alone, won't show the avatar, you would need to echo out the avatar variable created with that code manually, which I can help with if I know that is the stage you are on (That you have successfully applied those code changes with no errors but don't see an avatar being displayed).


can i get help with this?  i dont know how to make the avatar show up


this just shows a red x :

Code: [Select]
<img src="', $news['avatar']['href'], '" width="50" height="50" alt="" /> 

when i add it like this:

Code: [Select]
foreach ($return as $news)
{
echo '
<div>
<a href="', $news['href'], '">', $news['icon'], '</a> <b>', $news['subject'], '</b>
<div class="smaller">', $news['time'], ' ', $txt[525], ' ', $news['poster']['link'], '</div>
<img src="', $news['avatar']['href'], '" width="50" height="50" alt="" /> 
<div class="post" style="padding: 2ex 0;">', $news['body'], '</div>

', $news['link'], $news['locked'] ? '' : ' | ' . $news['comment_link'], '
</div>';

if (!$news['is_last'])
echo '
<hr style="margin: 2ex 0;" width="100%" />';
}
}
« Last Edit: February 13, 2008, 10:54:17 AM by myaicons »
i scratch your back you scratch my back...
funny thing about my back is its located on my...

Offline myaicons

  • Jr. Member
  • **
  • Posts: 228
  • Gender: Female
Re: display avy in ssi_boardNews
« Reply #17 on: February 19, 2008, 09:38:21 AM »
anybody?
i scratch your back you scratch my back...
funny thing about my back is its located on my...

Offline [SiNaN]

  • SMF Super Hero
  • *******
  • Posts: 11,524
  • Young and Foolish
    • SimplePortal
Re: display avy in ssi_boardNews
« Reply #18 on: February 19, 2008, 10:31:25 AM »
Use $news['avatar']['image'].
Former SMF Core Developer | My Mods | SimplePortal

Offline myaicons

  • Jr. Member
  • **
  • Posts: 228
  • Gender: Female
Re: display avy in ssi_boardNews
« Reply #19 on: February 19, 2008, 04:08:08 PM »
tried that... still wont work for me....

any more ideas???
i scratch your back you scratch my back...
funny thing about my back is its located on my...