Warning: The author of this contribution does not provide support for it anymore.

Top Five

Show avatar?? - Top Five

Re: Show avatar??

by Caeterra » Tue Feb 15, 2011 3:24 pm

but how do I add them? where to get? sorry, did not quite understand your message ..
User avatar
Caeterra
Registered User
Posts: 33
Joined: Sat Feb 12, 2011 8:35 am

Re: Show avatar??

by RMcGirr83 » Tue Feb 15, 2011 3:39 pm

Read the topic and try to apply what I told you to want it is you want to achieve.
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 🍺
User avatar
RMcGirr83
Former Team Member
Posts: 22072
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Show avatar??

by Caeterra » Tue Feb 15, 2011 4:10 pm

I once did not try, I can not properly put .. Now the code such:

Code: Select all

 // newest registered users
   
     if (!function_exists('get_user_avatar'))
    {   
        include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
    }
   if (($newest_users = $cache->get('_top_five_newest_users')) === false)
   {
       $newest_users = array();

       // grab most recent registered users
      $sql = 'SELECT user_id, user_avatar, user_avatar_type, user_avatar_width, user_avatar_height,  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($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['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']) : '',
          'REG_DATE'         => $user->format_date($row['user_regdate']),
         'USERNAME_FULL'      => $username_string)
      );
   }
}


but I still can not see the avatar .. help please? already seething brains .. (
User avatar
Caeterra
Registered User
Posts: 33
Joined: Sat Feb 12, 2011 8:35 am

Re: Show avatar??

by RMcGirr83 » Tue Feb 15, 2011 4:28 pm

Code: Select all

              'user_colour'         => $row['user_colour'],
                'user_regdate'         => $row['user_regdate'],


make it like this

Code: Select all

'user_colour'      => $row['user_colour'],
'user_regdate'      => $row['user_regdate'],
'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'],
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 🍺
User avatar
RMcGirr83
Former Team Member
Posts: 22072
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Show avatar??

by Caeterra » Tue Feb 15, 2011 4:38 pm

Super! Thank you! From the soul! )))
User avatar
Caeterra
Registered User
Posts: 33
Joined: Sat Feb 12, 2011 8:35 am

Re: Show avatar??

by Caeterra » Wed Feb 16, 2011 1:22 am

one question), how to fix that avatars appear immediately and not after a clean cache after Admin?
User avatar
Caeterra
Registered User
Posts: 33
Joined: Sat Feb 12, 2011 8:35 am

Re: Show avatar??

by RMcGirr83 » Wed Feb 16, 2011 9:54 am

// cache this data for ever, cache is purged when adding or deleting users
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 🍺
User avatar
RMcGirr83
Former Team Member
Posts: 22072
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Show avatar??

by Caeterra » Wed Feb 16, 2011 10:11 am

I tried to remove this line,

Code: Select all

// cache this data for ever, cache is purged when adding or deleting users
      $cache->put('_top_five_newest_users', $newest_users);


nothing has changed ..


---

Ah, no! everything is fine! Thank you very much!
User avatar
Caeterra
Registered User
Posts: 33
Joined: Sat Feb 12, 2011 8:35 am

Re: Show avatar??

by Caeterra » Thu Feb 17, 2011 9:57 am

Hello RMcGirr83 and all other forum members) tell me please some more .. how to make that users do not have the avatar does not appear on the main page, and there were those who came before them, but with the avatar?
Thank!
User avatar
Caeterra
Registered User
Posts: 33
Joined: Sat Feb 12, 2011 8:35 am

Re: Show avatar??

by RMcGirr83 » Thu Feb 17, 2011 10:12 am

Try changing this

Code: Select all

'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']) : '',


to this

Code: Select all

'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="./images/no_avatar.gif" width="25px;" height="25px;" alt="" />',


You may have to use a switch in the html file instead though. I haven't tested the above.
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 🍺
User avatar
RMcGirr83
Former Team Member
Posts: 22072
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Show avatar??

by Caeterra » Thu Feb 17, 2011 10:35 am

Yes, this method works, thanks! but I was referring to a user without an avatar does not appear, but instead the user was registered in front of him, but with the avatar .. that is, display only those who have downloaded the avatar?
User avatar
Caeterra
Registered User
Posts: 33
Joined: Sat Feb 12, 2011 8:35 am

Re: Show avatar??

by RMcGirr83 » Thu Feb 17, 2011 10:55 am

I'm not understanding your question. Whether a user has an avatar or not doesn't matter if they are displayed or not.
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 🍺
User avatar
RMcGirr83
Former Team Member
Posts: 22072
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Show avatar??

by Caeterra » Thu Feb 17, 2011 11:12 am

i'm try to depict as follows:

1234567.jpg
1234567.jpg (134.87 KiB) Viewed 374 times
User avatar
Caeterra
Registered User
Posts: 33
Joined: Sat Feb 12, 2011 8:35 am

Re: Show avatar??

by RMcGirr83 » Thu Feb 17, 2011 11:17 am

So you don't want them to display if they don't have an avatar? Is that correct?

WHERE ' . $db->sql_in_set('user_type', $ignore_users, true) . '
AND user_inactive_reason = 0 AND user_avatar IS NOT NULL
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 🍺
User avatar
RMcGirr83
Former Team Member
Posts: 22072
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Show avatar??

by Caeterra » Thu Feb 17, 2011 12:13 pm

Yes, only now avatar is not visible, but the name is displayed ..
And I need to and it is not, and has appeared with the previous user avatar ..
so that the user was not displayed until the upload avatar ..
I'm sorry, I use google translator)

tried so to write, nothing happened ..

Code: Select all

WHERE ' . $db->sql_in_set('user_type', $ignore_users, true) . '
AND user_inactive_reason = 0 AND user_avatar IS NOT NULL AND username IS NOT NULL
User avatar
Caeterra
Registered User
Posts: 33
Joined: Sat Feb 12, 2011 8:35 am