|
|
| Author |
Message |
lefty74
Not So New User
Joined: 13 Feb 2006
Posts: 81
|
Posted: June 22nd 2007, 1:47 pm Post subject: [RC] Avatar of poster on Index and Viewforum 1.2.1 |
|
|
MOD Title:Avatar of poster on Index and Viewforum
MOD Description:Shows the last poster's avatar in on the Index and subforums as well as the author's avatar and last poster's avatar on Viewforum
MOD Version:1.2.1
phpBB Version:3.0.4
MOD Download: [RC] Avatar of poster on Index and Viewforum 1.2.1
Demo: Demoboard
prosilver index
prosilver viewforum
subsilver2 index
subsilver2 viewforum

Last edited by lefty74 on December 13th 2008, 8:36 am; edited 10 times in total |
|
| Back to top |
|
 |
Patrick
Admin/Webmaster

Joined: 11 May 2001
Posts: 12847
Location: Harbinger, NC, U.S.A.
|
|
| Back to top |
|
 |
lefty74
Not So New User
Joined: 13 Feb 2006
Posts: 81
|
Posted: June 23rd 2007, 5:41 pm Post subject: |
|
|
Thanks Patrick
edit:
updated Install instructions to make RC2 compliant |
|
| Back to top |
|
 |
lefty74
Not So New User
Joined: 13 Feb 2006
Posts: 81
|
Posted: August 21st 2007, 3:58 pm Post subject: |
|
|
upgraded to fix bug when moving, merging posts etc via mcp.
to upgrade from version 0.1.2 just do the changes for includes/functions_admin.php |
|
| Back to top |
|
 |
lefty74
Not So New User
Joined: 13 Feb 2006
Posts: 81
|
Posted: October 28th 2007, 3:06 pm Post subject: |
|
|
updated to v 020 which fixes a bug when updating the avatar, also now fixes the problem when avatars smaller then the max dimensions are uploaded.
to upgrade from 0.1.3 to 0.2.0
| Code:
|
#
#-----[ OPEN ]------------------------------------------
#
includes/functions_user.php
#
#-----[ FIND ]------------------------------------------
#
user_update_avatar($user_id, $sql_ary['user_avatar'], $sql_ary['user_avatar_type'], $sql_ary['user_avatar_width'], $sql_ary['user_avatar_width']);
#
#-----[ REPLACE WITH ]------------------------------------------
#
user_update_avatar($user_id, $sql_ary['user_avatar'], $sql_ary['user_avatar_type'], $sql_ary['user_avatar_width'], $sql_ary['user_avatar_height']);
#
#-----[ OPEN ]------------------------------------------
#
includes/functions_display.php
#
#-----[ FIND ]------------------------------------------
#
$template->assign_block_vars('forumrow', array(
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$avatar_max_dimensions = $avatar_width = $avatar_height = '';
if ( !empty($row['forum_last_poster_avatar']) )
{
$avatar_max_dimensions = 40; // here you can change the max-width you would like to have the avatars displayed
if ( $row['forum_last_poster_avatar_width'] >= $row['forum_last_poster_avatar_height'] )
{
$avatar_width = ( $row['forum_last_poster_avatar_width'] > $avatar_max_dimensions ) ? $avatar_max_dimensions : $row['forum_last_poster_avatar_width'] ;
$avatar_height = ( $avatar_width == $avatar_max_dimensions ) ? round($avatar_max_dimensions / $row['forum_last_poster_avatar_width'] * $row['forum_last_poster_avatar_height']) : $row['forum_last_poster_avatar_height'] ;
}
else
{
$avatar_height = ( $row['forum_last_poster_avatar_height'] > $avatar_max_dimensions ) ? $avatar_max_dimensions : $row['forum_last_poster_avatar_height'] ;
$avatar_width = ( $avatar_height == $avatar_max_dimensions ) ? round($avatar_max_dimensions / $row['forum_last_poster_avatar_height'] * $row['forum_last_poster_avatar_width']) : $row['forum_last_poster_avatar_width'] ;
}
}
#
#-----[ FIND ]------------------------------------------
#
// if you want the avatar resized to another width then 40, change the value 40 to whichever you like
// Use the following if you want to keep the original avatar size
// 'LAST_POSTER_AVATAR' => get_user_avatar($row['forum_last_poster_avatar'], $row['forum_last_poster_avatar_type'], $row['forum_last_poster_avatar_width'], $row['forum_last_poster_avatar_height']),
'LAST_POSTER_AVATAR' => get_user_avatar($row['forum_last_poster_avatar'], $row['forum_last_poster_avatar_type'], '40', ''),
#
#-----[ REPLACE WITH ]------------------------------------------
#
'LAST_POSTER_AVATAR' => get_user_avatar($row['forum_last_poster_avatar'], $row['forum_last_poster_avatar_type'], $avatar_width, $avatar_height),
'LAST_POSTER_AVATAR_MARGIN' => ( $avatar_width == $avatar_max_dimensions ) ? 5 : ( $avatar_max_dimensions - $avatar_width + 5 ),
'AVATAR_WIDTH' => $avatar_max_dimensions,
#
#-----[ FIND ]------------------------------------------
#
// have to add this as otherwise IE wont show the avatar properly ... IE SUCKS
if ( empty($avatar_height) )
{
return '<img src="' . $avatar_img . '" width="' . $avatar_width . '" alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />';
}
else
{
return '<img src="' . $avatar_img . '" width="' . $avatar_width . '" height="' . $avatar_height . '" alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />';
}
#
#-----[ REPLACE WITH ]------------------------------------------
# restoring the original code, careful though if you have other avatar mods installed from me, they may be using the previous code
return '<img src="' . $avatar_img . '" width="' . $avatar_width . '" height="' . $avatar_height . '" alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />';
#
#-----[ OPEN ]------------------------------------------
#
viewforum.php
#
#-----[ FIND ]------------------------------------------
#
// Send vars to template
$template->assign_block_vars('topicrow', array(
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$avatar_img = $avatar_max_dimensions = $topic_last_poster_avatar_height = $topic_last_poster_avatar_width = $topic_first_poster_avatar_width = $topic_first_poster_avatar_height = '';
if ( !empty($row['topic_first_poster_avatar']) || !empty($row['topic_last_poster_avatar']))
{
$avatar_max_dimensions = 40; // here you can change the max-width you would like to have the avatars displayed
if ( $row['topic_first_poster_avatar_width'] >= $row['topic_first_poster_avatar_height'] )
{
$topic_first_poster_avatar_width = ( $row['topic_first_poster_avatar_width'] > $avatar_max_dimensions ) ? $avatar_max_dimensions : $row['topic_first_poster_avatar_width'] ;
$topic_first_poster_avatar_height = ( $topic_first_poster_avatar_width == $avatar_max_dimensions ) ? round($avatar_max_dimensions / $row['topic_first_poster_avatar_width'] * $row['topic_first_poster_avatar_height']) : $row['topic_first_poster_avatar_height'] ;
}
else
{
$topic_first_poster_avatar_height = ( $row['topic_first_poster_avatar_height'] > $avatar_max_dimensions ) ? $avatar_max_dimensions : $row['topic_first_poster_avatar_height'] ;
$topic_first_poster_avatar_width = ( $topic_first_poster_avatar_height == $avatar_max_dimensions ) ? round($avatar_max_dimensions / $row['topic_first_poster_avatar_height'] * $row['topic_first_poster_avatar_width']) : $row['topic_first_poster_avatar_width'] ;
}
if ( $row['topic_last_poster_avatar_width'] >= $row['topic_last_poster_avatar_height'] )
{
$topic_last_poster_avatar_width = ( $row['topic_last_poster_avatar_width'] > $avatar_max_dimensions ) ? $avatar_max_dimensions : $row['topic_last_poster_avatar_width'] ;
$topic_last_poster_avatar_height = ( $topic_last_poster_avatar_width == $avatar_max_dimensions ) ? round($avatar_max_dimensions / $row['topic_last_poster_avatar_width'] * $row['topic_last_poster_avatar_height']) : $row['topic_last_poster_avatar_height'] ;
}
else
{
$topic_last_poster_avatar_height = ( $row['topic_last_poster_avatar_height'] > $avatar_max_dimensions ) ? $avatar_max_dimensions : $row['topic_last_poster_avatar_height'] ;
$topic_last_poster_avatar_width = ( $topic_last_poster_avatar_height == $avatar_max_dimensions ) ? round($avatar_max_dimensions / $row['topic_last_poster_avatar_height'] * $row['topic_last_poster_avatar_width']) : $row['topic_last_poster_avatar_width'] ;
}
}
#
#-----[ FIND ]------------------------------------------
#
// if you want the avatar resized to another width then 40, change the value 40 to whichever you like
// Use the following if you want to keep the original avatar size
// 'TOPIC_AUTHOR_AVATAR' => get_user_avatar($row['topic_first_poster_avatar'], $row['topic_first_poster_avatar_type'], $row['topic_first_poster_avatar_width'], $row['topic_first_poster_avatar_height']),
'TOPIC_AUTHOR_AVATAR' => get_user_avatar($row['topic_first_poster_avatar'], $row['topic_first_poster_avatar_type'], '40', ''),
#
#-----[ REPLACE WITH ]------------------------------------------
#
'TOPIC_AUTHOR_AVATAR' => get_user_avatar($row['topic_first_poster_avatar'], $row['topic_first_poster_avatar_type'], $topic_first_poster_avatar_width, $topic_first_poster_avatar_height),
'TOPIC_AUTHOR_AVATAR_MARGIN' => ( $topic_first_poster_avatar_width == '' ) ? '' : (( $topic_first_poster_avatar_width == $avatar_max_dimensions ) ? 5 : ( $avatar_max_dimensions - $topic_first_poster_avatar_width + 5 )),
'AVATAR_WIDTH' => $avatar_max_dimensions ,
#
#-----[ FIND ]------------------------------------------
#
// if you want the avatar resized to another width then 40, change the value 40 to whichever you like
// Use the following if you want to keep the original avatar size
// 'LAST_POST_AUTHOR_AVATAR' => get_user_avatar($row['topic_last_poster_avatar'], $row['topic_last_poster_avatar_type'], $row['topic_last_poster_avatar_width'], $row['topic_last_poster_avatar_height']),
'LAST_POST_AUTHOR_AVATAR' => get_user_avatar($row['topic_last_poster_avatar'], $row['topic_last_poster_avatar_type'], '40', ''),
#
#-----[ REPLACE WITH ]------------------------------------------
#
'LAST_POST_AUTHOR_AVATAR' => get_user_avatar($row['topic_last_poster_avatar'], $row['topic_last_poster_avatar_type'], $topic_last_poster_avatar_width, $topic_last_poster_avatar_height),
'LAST_POST_AUTHOR_AVATAR_MARGIN'=> ( $topic_last_poster_avatar_width == $avatar_max_dimensions ) ? 5 : ( $avatar_max_dimensions - $topic_last_poster_avatar_width + 5 ),
#
#-----[ OPEN ]------------------------------------------
#
styles/prosilver/template/forumlist_body.html
#
#-----[ FIND ]------------------------------------------
#
<dd class="lastpost"><span><div style="float: left; padding-top: 0px; margin-right: 5px;">{forumrow.LAST_POSTER_AVATAR}</div>
#
#-----[ REPLACE WITH ]------------------------------------------
#
<dd class="lastpost"><span><div style="float: left; padding-top: 0px; margin-right: {forumrow.LAST_POSTER_AVATAR_MARGIN}px;">{forumrow.LAST_POSTER_AVATAR}</div>
#
#-----[ OPEN ]------------------------------------------
#
styles/prosilver/template/viewforum_body.html
#
#-----[ FIND ]------------------------------------------
#
<dt style="<!-- IF topicrow.TOPIC_ICON_IMG and S_TOPIC_ICONS -->background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;<!-- ENDIF -->" title="{topicrow.TOPIC_FOLDER_IMG_ALT}"> <div style="float: left; padding-top: 3px; margin-right: 5px;">{topicrow.TOPIC_AUTHOR_AVATAR}</div><!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a>
#
#-----[ REPLACE WITH ]------------------------------------------
#
<dt style="<!-- IF topicrow.TOPIC_ICON_IMG and S_TOPIC_ICONS -->background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;<!-- ENDIF -->" title="{topicrow.TOPIC_FOLDER_IMG_ALT}"> <div style="float: left; padding-top: 3px; margin-right: {topicrow.TOPIC_AUTHOR_AVATAR_MARGIN}px;">{topicrow.TOPIC_AUTHOR_AVATAR}</div><!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a>
#
#-----[ FIND ]------------------------------------------
#
<dd class="lastpost"> <div style="float: left; padding-top: 0px; margin-right: 5px;">{topicrow.LAST_POST_AUTHOR_AVATAR}</div><span><dfn>{L_LAST_POST} </dfn>{L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL}
#
#-----[ REPLACE WITH ]------------------------------------------
#
<dd class="lastpost"> <div style="float: left; padding-top: 0px; margin-right: {topicrow.LAST_POST_AUTHOR_AVATAR_MARGIN}px;">{topicrow.LAST_POST_AUTHOR_AVATAR}</div><span><dfn>{L_LAST_POST} </dfn>{L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL}
#
#-----[ OPEN ]------------------------------------------
#
styles/subsilver2/template/forumlist_body.html
#
#-----[ FIND ]------------------------------------------
#
<td width="40">{forumrow.LAST_POSTER_AVATAR}</td>
<td align="center" width="100%" nowrap="nowrap">
#
#-----[ REPLACE WITH ]------------------------------------------
#
<!-- IF forumrow.LAST_POSTER_AVATAR --><td width="{forumrow.AVATAR_WIDTH}">{forumrow.LAST_POSTER_AVATAR}</td><!-- ENDIF -->
<td align="center" nowrap="nowrap">
#
#-----[ OPEN ]------------------------------------------
#
styles/subsilver2/template/viewforum_body.html
#
#-----[ FIND ]------------------------------------------
#
<td >{topicrow.TOPIC_AUTHOR_AVATAR}</td>
#
#-----[ REPLACE WITH ]------------------------------------------
#
<!-- IF topicrow.TOPIC_AUTHOR_AVATAR --><td align="center" width="{topicrow.AVATAR_WIDTH}" >{topicrow.TOPIC_AUTHOR_AVATAR}</td><!-- ENDIF -->
#
#-----[ FIND ]------------------------------------------
#
<td >{topicrow.LAST_POST_AUTHOR_AVATAR}</td>
#
#-----[ REPLACE WITH ]------------------------------------------
#
<!-- IF topicrow.LAST_POST_AUTHOR_AVATAR --> <td width="{topicrow.AVATAR_WIDTH}">{topicrow.LAST_POST_AUTHOR_AVATAR}</td><!-- ENDIF -->
#
#-----[ FIND ]------------------------------------------
#
<td >{topicrow.TOPIC_AUTHOR_AVATAR}</td>
#
#-----[ REPLACE WITH ]------------------------------------------
#
<!-- IF topicrow.TOPIC_AUTHOR_AVATAR --><td align="center" width="{topicrow.AVATAR_WIDTH}" >{topicrow.TOPIC_AUTHOR_AVATAR}</td><!-- ENDIF -->
#
#-----[ FIND ]------------------------------------------
#
<td >{topicrow.LAST_POST_AUTHOR_AVATAR}</td>
#
#-----[ REPLACE WITH ]------------------------------------------
#
<!-- IF topicrow.LAST_POST_AUTHOR_AVATAR --> <td width="{topicrow.AVATAR_WIDTH}">{topicrow.LAST_POST_AUTHOR_AVATAR}</td><!-- ENDIF -->
#
#-----[ DIY INSTRUCTIONS ]------------------------------------------
#
Refresh all your templates and clear your cache via the ACP after editing the template files.
Copy avatar_update.php to the root folder and run it to update earlier topic author or last post avatar data.
|
|
|
| Back to top |
|
 |
dr skunk
Not So New User
Joined: 01 Mar 2008
Posts: 27
|
Posted: March 6th 2008, 4:30 am Post subject: |
|
|
| very, very cool. I'm looking forward to the end of this one. |
|
| Back to top |
|
 |
~HG~
Dedicated User
Joined: 08 Nov 2003
Posts: 3232
Location: Australia
|
|
| Back to top |
|
 |
lefty74
Not So New User
Joined: 13 Feb 2006
Posts: 81
|
Posted: May 5th 2008, 1:41 pm Post subject: |
|
|
only the display size, it changes it to 40px longest side.
| Code:
|
$avatar_max_dimensions = 40; // here you can change the max-width you would like to have the avatars displayed
|
_________________ www.zoocrew.eu - Help us save our wildlife - |
|
| Back to top |
|
 |
~HG~
Dedicated User
Joined: 08 Nov 2003
Posts: 3232
Location: Australia
|
|
| Back to top |
|
 |
lefty74
Not So New User
Joined: 13 Feb 2006
Posts: 81
|
|
| Back to top |
|
 |
|