Avatar in top five

Support for mods released by phpbbmodders.net found at either https://github.com/phpbbmodders/ or the MODDB at http://www.phpbb.com
Forum rules
Please only request support for mods released by phpbbmodders.net found at either https://github.com/phpbbmodders/ or the MODDB at http://www.phpbb.com
User avatar
Sniper_E
MOD Team
MOD Team
Posts: 591
Joined: 13 Jun 2011, 16:53
Location: Shreveport, LA

Re: Avatar in top five

Postby Sniper_E » 27 Aug 2014, 03:40

I like the look of what you guys are doing in here. I could use some of your code in even another project. Thanks Neculai Anișor
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!

User avatar
Neculai Anișor
Supporter
Supporter
Posts: 150
Joined: 11 Jan 2013, 17:01
Location: Liverpool, UK

Re: Avatar in top five

Postby Neculai Anișor » 27 Aug 2014, 09:25

You can try this but im not sure if it works or not.

OPEN includes/top_five.php
Find This may be a partial find and not the whole line

Code: Select all

$sql = 'SELECT COUNT(t.post_id) AS tally, u.user_id, u.username, u.user_colour

Replace with Replace the preceding lines with the following

Code: Select all

$sql = 'SELECT COUNT(t.post_id) AS tally, u.user_id, u.username, u.user_colour, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height

Find This may be a partial find and not the whole line

Code: Select all

            'user_id'      => $row['user_id'],
                'username'      => $row['username'],
                'user_colour'   => $row['user_colour'],
            'user_thanks'    => $row['tally'],

Add after Add these lines on a new blank line after the preceding line(s) to find

Code: Select all

            'user_avatar'      => $row['user_avatar'],
            'user_avatar_type'   => $row['user_avatar_type'],
            'user_avatar_width'   => $row['user_avatar_width'],
            'user_avatar_height'   => $row['user_avatar_height'],

Find This may be a partial find and not the whole line

Code: Select all

'THANKS'          => $row['user_thanks'] > 1 ? sprintf($user->lang['THANKEDS'], $row['user_thanks']) : sprintf($user->lang['THANKED'], $row['user_thanks']),

Add after Add these lines on a new blank line after the preceding line(s) to find

Code: Select all

'USER_AVATAR'      => get_user_avatar($data['user_avatar'], $data['user_avatar_type'], $data['user_avatar_width'], $data['user_avatar_height']),
            'USER_AVATAR_THUMB'   => ($row['user_avatar']) ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], ($row['user_avatar_width'] > $row['user_avatar_height']) ? 25 : (25 / $row['user_avatar_height']) * $row['user_avatar_width'], ($row['user_avatar_height'] > $row['user_avatar_width']) ? 25 : (25 / $row['user_avatar_width']) * $row['user_avatar_height']) : '<img src="http://i.epvpimg.com/Qg3Pd.gif" width="25px;" height="25px;" alt="" />',


OPEN top_five_body.html
Find This may be a partial find and not the whole line

Code: Select all

<td valign="top"><!-- BEGIN top_five_thanked -->{top_five_thanked.USERNAME_FULL}<br /> {top_five_thanked.THANKS}<br /><!-- END top_five_thanked --></td>

Replace with Replace the preceding lines with the following

Code: Select all

<td valign="top"><!-- BEGIN top_five_thanked --><div style="margin-top: 3px"><span style="float: left; margin-right: 8px;">{top_five_thanked.USER_AVATAR}&nbsp;{top_five_thanked.USER_AVATAR_THUMB}</span>{top_five_thanked.USERNAME_FULL}<br /> {top_five_thanked.THANKS}<br /></div><!-- END top_five_thanked --></td>


OFF: With pleasure Sniper :)

BOoOm
New member
New member
Posts: 14
Joined: 24 Jan 2014, 00:26

Re: Avatar in top five

Postby BOoOm » 27 Aug 2014, 14:07

Its not working, but thank :)

User avatar
Neculai Anișor
Supporter
Supporter
Posts: 150
Joined: 11 Jan 2013, 17:01
Location: Liverpool, UK

Re: Avatar in top five

Postby Neculai Anișor » 27 Aug 2014, 17:31

I know why because its trying to select data from thanks table.

User avatar
RMcGirr83
Past Contributor
Past Contributor
Posts: 6243
Joined: 30 Nov 2006, 14:23
Real name: Rich McGirr

Re: Avatar in top five

Postby RMcGirr83 » 27 Aug 2014, 18:44

Which means you have to do a left join on the users table.

User avatar
Neculai Anișor
Supporter
Supporter
Posts: 150
Joined: 11 Jan 2013, 17:01
Location: Liverpool, UK

Re: Avatar in top five

Postby Neculai Anișor » 27 Aug 2014, 19:00

Yup i will try after phpbb.com its up again.

Truth
I've Been Banned!!!
Posts: 9
Joined: 31 Dec 2014, 06:36

Re: Avatar in top five

Postby Truth » 14 Feb 2015, 10:29

Neculai Anișor wrote:This is based on Rich`s code.

OPEN includes/top_five.php
Find This may be a partial find and not the whole line

Code: Select all

global $auth, $cache, $user, $db, $phpbb_root_path, $phpEx, $template;

Add after Add these lines on a new blank line after the preceding line(s) to find

Code: Select all

if (!function_exists('get_user_avatar'))
    {   
        include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
    }

Find This may be a partial find and not the whole line

Code: Select all

'SELECT'   => 'u.user_id, u.username, u.user_colour, t.topic_title, t.forum_id, t.topic_last_post_id, t.topic_last_post_time, t.topic_last_poster_name',

Replace with Replace the preceding lines with the following

Code: Select all

'SELECT'   => 'u.user_id, u.username, u.user_colour, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, t.topic_title, t.forum_id, t.topic_last_post_id, t.topic_last_post_time, t.topic_last_poster_name',

Find This may be a partial find and not the whole line

Code: Select all

$is_guest = $row['user_id'] != ANONYMOUS ? false : true;

Add after Add these lines on a new blank line after the preceding line(s) to find

Code: Select all

$user_avatar = ($row['user_avatar']) ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], ($row['user_avatar_width'] > $row['user_avatar_height']) ? 25 : (25 / $row['user_avatar_height']) * $row['user_avatar_width'], ($row['user_avatar_height'] > $row['user_avatar_width']) ? 25 : (25 / $row['user_avatar_width']) * $row['user_avatar_height']) : '';

Find This may be a partial find and not the whole line

Code: Select all

'TOPIC_TITLE'    => $user->lang['IN'] . ' ' . $topic_title));

Replace with Replace the preceding lines with the following

Code: Select all

'TOPIC_TITLE'    => '<span style="float: left; margin-right: 8px;">' . $user_avatar . '</span>' . ' ' . $user->lang['IN'] . ' ' . $topic_title));

Find This may be a partial find and not the whole line

Code: Select all

SELECT user_id, username, user_colour, user_regdate

Replace with Replace the preceding lines with the following

Code: Select all

SELECT user_id, user_avatar, user_avatar_type, user_avatar_width, user_avatar_height,  username, user_colour, user_regdate

Find This may be a partial find and not the whole line

Code: Select all

         $newest_users[$row['user_id']] = array(
            'user_id'            => $row['user_id'],
            'username'            => $row['username'],
              'user_colour'         => $row['user_colour'],
                'user_regdate'         => $row['user_regdate'],

Add after Add these lines on a new blank line after the preceding line(s) to find

Code: Select all

            'user_avatar'      => $row['user_avatar'],
            'user_avatar_type'   => $row['user_avatar_type'],
            'user_avatar_width'   => $row['user_avatar_width'],
            'user_avatar_height'   => $row['user_avatar_height'],

Find This may be a partial find and not the whole line

Code: Select all

         'REG_DATE'         => $user->format_date($row['user_regdate']),
         'USERNAME_FULL'      => $username_string)

Add before Add these lines on a new blank line before the preceding line(s) to find

Code: Select all

'USER_AVATAR'      => get_user_avatar($data['user_avatar'], $data['user_avatar_type'], $data['user_avatar_width'], $data['user_avatar_height']),
            'USER_AVATAR_THUMB'   => ($row['user_avatar']) ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], ($row['user_avatar_width'] > $row['user_avatar_height']) ? 25 : (25 / $row['user_avatar_height']) * $row['user_avatar_width'], ($row['user_avatar_height'] > $row['user_avatar_width']) ? 25 : (25 / $row['user_avatar_width']) * $row['user_avatar_height']) : '<img src="http://i.epvpimg.com/Qg3Pd.gif" width="25px;" height="25px;" alt="" />',

Find This may be a partial find and not the whole line

Code: Select all

SELECT user_id, username, user_colour, user_posts

Replace with Replace the preceding lines with the following

Code: Select all

SELECT user_id, user_avatar, user_avatar_type, user_avatar_width, user_avatar_height, username, user_colour, user_posts

Find This may be a partial find and not the whole line

Code: Select all

         $user_posts[$row['user_id']] = array(
            'user_id'      => $row['user_id'],
                'username'      => $row['username'],
                'user_colour'   => $row['user_colour'],
            'user_posts'    => $row['user_posts'],

Add after Add these lines on a new blank line after the preceding line(s) to find

Code: Select all

            'user_avatar'      => $row['user_avatar'],
            'user_avatar_type'   => $row['user_avatar_type'],
            'user_avatar_width'   => $row['user_avatar_width'],
            'user_avatar_height'   => $row['user_avatar_height'],

Find This may be a partial find and not the whole line

Code: Select all

 'S_SEARCH_ACTION'   => append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $row['user_id'] . '&amp;sr=posts'),
         'POSTS'          => $row['user_posts'],
         'USERNAME_FULL'      => $username_string)

Add before Add these lines on a new blank line before the preceding line(s) to find

Code: Select all

'USER_AVATAR'      => get_user_avatar($data['user_avatar'], $data['user_avatar_type'], $data['user_avatar_width'], $data['user_avatar_height']),
            'USER_AVATAR_THUMB'   => ($row['user_avatar']) ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], ($row['user_avatar_width'] > $row['user_avatar_height']) ? 25 : (25 / $row['user_avatar_height']) * $row['user_avatar_width'], ($row['user_avatar_height'] > $row['user_avatar_width']) ? 25 : (25 / $row['user_avatar_width']) * $row['user_avatar_height']) : '<img src="http://i.epvpimg.com/Qg3Pd.gif" width="25px;" height="25px;" alt="" />',


OPEN top_five_body.html
Find This may be a partial find and not the whole line

Code: Select all

<td valign="top"><!-- BEGIN top_five_topic --><!-- IF top_five_topic.NO_TOPIC_TITLE-->{top_five_topic.NO_TOPIC_TITLE}<!-- ELSE --><a href="{top_five_topic.U_TOPIC}">{top_five_topic.TOPIC_TITLE}</a><br />&nbsp;&nbsp;{top_five_topic.USERNAME_FULL}&nbsp;&nbsp;{top_five_topic.LAST_TOPIC_TIME}<br /><!-- ENDIF --><!-- END top_five_topic --></td>
               <td valign="top"><!-- BEGIN top_five_active -->{top_five_active.USERNAME_FULL}<br />&nbsp;&nbsp;{L_POSTS}: <a href="{top_five_active.S_SEARCH_ACTION}">{top_five_active.POSTS}</a><br /><!-- END top_five_active --></td>
               <td valign="top"><!-- BEGIN top_five_newest -->{top_five_newest.USERNAME_FULL}<br />&nbsp;&nbsp;{L_JOINED}: {top_five_newest.REG_DATE}<br /><!-- END top_five_newest --></td>

Replace with Replace the preceding lines with the following

Code: Select all

<td valign="top"><!-- BEGIN top_five_topic --><div style="margin-top: 3px"><!-- IF top_five_topic.NO_TOPIC_TITLE-->{top_five_topic.NO_TOPIC_TITLE}<!-- ELSE --><a href="{top_five_topic.U_TOPIC}">{top_five_topic.TOPIC_TITLE}</a><br />{top_five_topic.USERNAME_FULL}&nbsp;{top_five_topic.LAST_TOPIC_TIME}<br /></div><!-- ENDIF --><!-- END top_five_topic --></td>
               <td valign="top"><!-- BEGIN top_five_active --><div style="margin-top: 3px"><span style="float: left; margin-right: 8px;">{top_five_active.USER_AVATAR}&nbsp;{top_five_active.USER_AVATAR_THUMB}</span>{top_five_active.USERNAME_FULL}<br />{L_POSTS}: <a href="{top_five_active.S_SEARCH_ACTION}">{top_five_active.POSTS}</a><br /></div><!-- END top_five_active --></td>
               <td valign="top"><!-- BEGIN top_five_newest --><div style="margin-top: 3px"><span style="float: left; margin-right: 8px;">{top_five_newest.USER_AVATAR}&nbsp;{top_five_newest.USER_AVATAR_THUMB}</span>{top_five_newest.USERNAME_FULL}<br />{L_JOINED}: {top_five_newest.REG_DATE}<br /></div><!-- END top_five_newest --></td>


Image


I used this for 3.1.2 on my portal and everything worked except for the resizing of the avatar. Is there a fix for this?

Results
Image63.jpg
You do not have the required permissions to view the files attached to this post.


Return to “Modders MOD support”

Who is online

Users browsing this forum: CommonCrawl [Bot] and 2 guests