Show avatar?? - Top Five
Show avatar??
Hey,
How could we make it so the avatar of the poster will show..
Thanks,
Steve C
How could we make it so the avatar of the poster will show..
Thanks,
Steve C
-
- Registered User
- Posts: 78
- Joined: Fri Dec 05, 2008 7:14 pm
- Name: Steven Costello
Re: Show avatar??
Open
includes/top_five.php
FIND
AFTER, ADD
FIND
REPLACE, WITH
FIND
AFTER, ADD
FIND
REPLACE WITH
that will place a users avatar prior to their name and scale it to 25% of it's height and width.
includes/top_five.php
FIND
Code: Select all
global $auth, $cache, $user, $db, $phpbb_root_path, $phpEx, $template;
AFTER, ADD
Code: Select all
if (!function_exists('get_user_avatar'))
{
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
}
FIND
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
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
Code: Select all
$is_guest = $row['user_id'] != ANONYMOUS ? false : true;
AFTER, ADD
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
Code: Select all
'USERNAME_FULL' => $is_guest ? $user->lang['BY'] . ' ' . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $row['topic_last_poster_name']) : $user->lang['BY'] . ' ' . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
REPLACE WITH
Code: Select all
'USERNAME_FULL' => $is_guest ? $user->lang['BY'] . ' ' . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $row['topic_last_poster_name']) : $user->lang['BY'] . ' ' . $user_avatar . ' ' . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
that will place a users avatar prior to their name and scale it to 25% of it's height and width.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer
Appreciate the extensions/mods/support then you can support me by buying a beer
-
- Former Team Member
- Posts: 22072
- Joined: Wed Jun 22, 2005 4:33 pm
- Location: Your display
- Name: Rich McGirr
Re: Show avatar??
Nvm See post below...
-
- Registered User
- Posts: 78
- Joined: Fri Dec 05, 2008 7:14 pm
- Name: Steven Costello
Re: Show avatar??
nvm I got it working. But how could i make it so it can be 70px x 70px
Thanks,
Steve C
Thanks,
Steve C
-
- Registered User
- Posts: 78
- Joined: Fri Dec 05, 2008 7:14 pm
- Name: Steven Costello
Re: Show avatar??
Change the 25s to 70s. I made a mistake earlier, that's 25 pixels it resizes to not 25%.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer
Appreciate the extensions/mods/support then you can support me by buying a beer
-
- Former Team Member
- Posts: 22072
- Joined: Wed Jun 22, 2005 4:33 pm
- Location: Your display
- Name: Rich McGirr
Re: Show avatar??
Sweet thanks i got it working.
Thanks, you da man
Steve C
Thanks, you da man
Steve C
-
- Registered User
- Posts: 78
- Joined: Fri Dec 05, 2008 7:14 pm
- Name: Steven Costello
Re: Show avatar??
In the newest post section what if a user has not selected a avtar ..
i made the default avtar snippet on my board but the default avatar is not showing in the newest post section ..
only the members who have updated the avtar are showing ..
Can you please tell the snippet with which the users who have not selected any avtar (default avtar should display too )
i made the default avtar snippet on my board but the default avatar is not showing in the newest post section ..
only the members who have updated the avtar are showing ..
Can you please tell the snippet with which the users who have not selected any avtar (default avtar should display too )
-
- Registered User
- Posts: 7
- Joined: Fri Aug 13, 2010 1:22 pm
Re: Show avatar??
You can set it in here
$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']) : 'HERE';
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer
Appreciate the extensions/mods/support then you can support me by buying a beer
-
- Former Team Member
- Posts: 22072
- Joined: Wed Jun 22, 2005 4:33 pm
- Location: Your display
- Name: Rich McGirr
Re: Show avatar??
tell me please how to add an avatar to newest users?
or is it impossible?
thank you!
or is it impossible?
thank you!
-
- Registered User
- Posts: 33
- Joined: Sat Feb 12, 2011 8:35 am
Re: Show avatar??
Hello! I suggested to the good people here how to write code:
Edited files top_five.php and top_five_body.html
top_five.php
top_five_body.html
but avatars are a new user, do not appear .... please tell me where the mistake? Mod Avatar_on_Memberlist also installed ..
Thank you!
Edited files top_five.php and top_five_body.html
top_five.php
Code: Select all
<?php
/**
*
* @package phpBB3
* @version $Id:
* @copyright (c) 2010 Rich McGirr
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Include only once.
*/
if (!defined('INCLUDES_TOP_FIVE_PHP'))
{
define('INCLUDES_TOP_FIVE_PHP', true);
global $auth, $cache, $user, $db, $phpbb_root_path, $phpEx, $template;
$user->add_lang('mods/top_five');
// grab auths that allow a user to read a forum
$forum_array = array_unique(array_keys($auth->acl_getf('!f_read', true)));
// we have auths, change the sql query below
$sql_and = '';
if (sizeof($forum_array))
{
$sql_and = ' AND ' . $db->sql_in_set('t.forum_id', $forum_array, true);
}
// grab all posts that meet criteria and auths
$sql_ary = array(
'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',
'FROM' => array(TOPICS_TABLE => 't'),
'LEFT_JOIN' => array(
array(
'FROM' => array(USERS_TABLE => 'u'),
'ON' => 't.topic_last_poster_id = u.user_id',
),
),
'WHERE' => 't.topic_approved = 1 AND t.topic_status <> ' . ITEM_MOVED . ' ' . $sql_and,
'ORDER_BY' => 't.topic_last_post_time DESC',
);
$result = $db->sql_query_limit($db->sql_build_query('SELECT', $sql_ary), 5);
$is_row = false;
while( $row = $db->sql_fetchrow($result) )
{
$is_row = true;
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id']);
$topic_title = censor_text($row['topic_title']);
$is_guest = $row['user_id'] != ANONYMOUS ? false : true;
$template->assign_block_vars('top_five_topic',array(
'U_TOPIC' => $view_topic_url,
'USERNAME_FULL' => $is_guest ? $user->lang['BY'] . ' ' . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $row['topic_last_poster_name']) : $user->lang['BY'] . ' ' . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
'LAST_TOPIC_TIME' => $user->format_date($row['topic_last_post_time']),
'TOPIC_TITLE' => $user->lang['IN'] . ' ' . $topic_title));
}
$db->sql_freeresult($result);
// if user doesn't have permission to read any forums, show a message
if (!$is_row)
{
$template->assign_block_vars('top_five_topic', array(
'NO_TOPIC_TITLE' => $user->lang['NO_TOPIC_EXIST'],
));
}
// top five posters
// an array of user types we dont' bother with
// could add board founder (USER_FOUNDER) if wanted
$ignore_users = array(USER_IGNORE, USER_INACTIVE);
if (($user_posts = $cache->get('_top_five_posters')) === false)
{
$user_posts = array();
// grab users with most posts
$sql = 'SELECT user_id, username, user_colour, user_posts
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set('user_type', $ignore_users, true) . '
AND user_posts <> 0
ORDER BY user_posts DESC';
$result = $db->sql_query_limit($sql, 5);
while ($row = $db->sql_fetchrow($result))
{
$user_posts[$row['user_id']] = array(
'user_id' => $row['user_id'],
'username' => $row['username'],
'user_colour' => $row['user_colour'],
'user_posts' => $row['user_posts'],
);
}
$db->sql_freeresult($result);
// cache this data for five minutes, this improves performance
$cache->put('_top_five_posters', $user_posts, 300);
}
foreach ($user_posts as $row)
{
$username_string = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
$template->assign_block_vars('top_five_active',array(
'S_SEARCH_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $row['user_id'] . '&sr=posts'),
'POSTS' => $row['user_posts'],
'USERNAME_FULL' => $username_string)
);
}
// newest registered users
if (($newest_users = $cache->get('_top_five_newest_users')) === false)
{
$newest_users = array();
// grab most recent registered users
$sql = 'SELECT user_id, username, user_colour, user_regdate
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set('user_type', $ignore_users, true) . '
AND user_inactive_reason = 0
ORDER BY user_regdate DESC';
$result = $db->sql_query_limit($sql, 5);
while ($row = $db->sql_fetchrow($result))
{
$newest_users[$row['user_id']] = array(
'user_id' => $row['user_id'],
'username' => $row['username'],
'user_colour' => $row['user_colour'],
'user_regdate' => $row['user_regdate'],
);
}
$db->sql_freeresult($result);
// cache this data for ever, cache is purged when adding or deleting users
$cache->put('_top_five_newest_users', $newest_users);
}
foreach ($newest_users as $row)
{
$username_string = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
$template->assign_block_vars('top_five_newest',array(
'USER_AVATAR' => get_user_avatar($data['user_avatar'], $data['user_avatar_type'], $data['user_avatar_width'], $data['user_avatar_height']),
'USER_AVATAR_THUMB' => ($data['user_avatar']) ? get_user_avatar($data['user_avatar'], $data['user_avatar_type'], ($data['user_avatar_width'] > $data['user_avatar_height']) ? 25 : (25 / $data['user_avatar_height']) * $data['user_avatar_width'], ($data['user_avatar_height'] > $data['user_avatar_width']) ? 25 : (25 / $data['user_avatar_width']) * $data['user_avatar_height']) : '',
'REG_DATE' => $user->format_date($row['user_regdate']),
'USERNAME_FULL' => $username_string)
);
}
}
?>
top_five_body.html
Code: Select all
<div class="forabg">
<div class="inner"><span class="corners-top"><span></span></span>
<table class="table1" cellspacing="1" id="top_five">
<thead>
<tr>
<th style="width: 30%;">{L_TOP_FIVE_NEWEST}</th>
</tr>
</thead>
<tbody>
<tr class="bg2">
<td valign="top"><!-- BEGIN top_five_newest -->{top_five_newest.USER_AVATAR} {top_five_newest.USER_AVATAR_THUMB} {top_five_newest.USERNAME_FULL} {L_JOINED}: {top_five_newest.REG_DATE}<br /><!-- END top_five_newest --></td>
</tr>
</tbody>
</table>
<span class="corners-bottom"><span></span></span></div>
</div>
but avatars are a new user, do not appear .... please tell me where the mistake? Mod Avatar_on_Memberlist also installed ..
Thank you!
-
- Registered User
- Posts: 33
- Joined: Sat Feb 12, 2011 8:35 am
Re: Show avatar??
Code: Select all
get_user_avatar($data['user_avatar'], $data['user_avatar_type'], $data['user_avatar_width'],
$data is not correct. You aren't pulling the avatar info from the database and if you do it should be $row instead of $data.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer
Appreciate the extensions/mods/support then you can support me by buying a beer
-
- Former Team Member
- Posts: 22072
- Joined: Wed Jun 22, 2005 4:33 pm
- Location: Your display
- Name: Rich McGirr
Re: Show avatar??
I tried to replace, too, nothing happens .. and does not respond to a change of display users from 5 to 2 for example ..
-
- Registered User
- Posts: 33
- Joined: Sat Feb 12, 2011 8:35 am
Re: Show avatar??
It is cached...have you tried purging the cache after making your changes?
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer
Appreciate the extensions/mods/support then you can support me by buying a beer
-
- Former Team Member
- Posts: 22072
- Joined: Wed Jun 22, 2005 4:33 pm
- Location: Your display
- Name: Rich McGirr
Re: Show avatar??
Yes, I tried .. does not help .. if I understand the request goes to the same files as the Mod Avatar on Memberlist? then it is not clear .. it works fine ..
-
- Registered User
- Posts: 33
- Joined: Sat Feb 12, 2011 8:35 am
Re: Show avatar??
Code: Select all
// grab most recent registered users
$sql = 'SELECT user_id, username, user_colour, user_regdate
you are missing the avatar stuffs for the user.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer
Appreciate the extensions/mods/support then you can support me by buying a beer
-
- Former Team Member
- Posts: 22072
- Joined: Wed Jun 22, 2005 4:33 pm
- Location: Your display
- Name: Rich McGirr