vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Show TOP Reputation Poster (https://vborg.vbsupport.ru/showthread.php?t=325691)

hollyboy 10-20-2017 08:44 PM

Quote:

Originally Posted by MarkFL (Post 2590570)
If you force the avatars to be square, then the aspect ratio of the images won't be preserved, and you will wind up with "squished" images. However, give this a try, and you'll see what I mean:

PHP Code:

global $vbulletin$db;
$max 5;
$output '<div class="restore">';

$rep_users $vbulletin->db->query_read("
    SELECT user.*
    FROM " 
TABLE_PREFIX "user AS user
    WHERE options & 1024
    AND usergroupid NOT IN (6,8)
    ORDER BY reputation DESC
"
);

$rcount 0;

while (
$rep_user $db->fetch_array($rep_users) AND $rcount $max)
{
    
$avatar_url fetch_avatar_url($rep_user['userid']);
    
$avatar $avatar_url[0];

    if (!
$avatar)
    {
        
$avatar $vbulletin->stylevars['imgdir_misc']['imagedir'] . '/unknown.gif';
    }

    
$output .= '<div style="margin: 5px 0;"><img src="' $avatar '" style="vertical-align: middle; width: 40px; height: 40px; margin-right: 0.25em" />' repuser_link($rep_user) . ': ' $rep_user['reputation'] . ' Points</div>';
    
$rcount++;
}

$output .= '</div>';

return 
$output;

function 
repuser_link($user)
{
    global 
$vbulletin;
    
$link 'member.php?do=getinfo&username=' $user['username'];

    if (
$user['displaygroupid'])
    {
        
$groupid $user['displaygroupid'];
    }
    else
    {
        
$groupid $user['usergroupid'];
    }

    
$open_tag $vbulletin->usergroupcache[$groupid]['opentag'];
    
$close_tag $vbulletin->usergroupcache[$groupid]['closetag'];
    
$title 'Visit ' $user['username'] . '\'s Profile';
    return 
'<a title="' $title '" href="' $link '">' $open_tag $user['username'] . $close_tag '</a>';



Hey Mark,

because of this error:

Code:

[20-Oct-2017 23:56:54 Europe/Rome] PHP Fatal error:  Call to undefined function fetch_avatar_url() in /home/interfan/public_html/forum/includes/block/html.php(95) : eval()'d code on line 17
the forum crashes and was not available, I had to remove your code

MarkFL 10-20-2017 09:10 PM

Odd, I've used that function in forum blocks for years on end without any issue on many different sites.

--------------- Added [DATE]1508550205[/DATE] at [TIME]1508550205[/TIME] ---------------

Try this code:

PHP Code:

global $vbulletin$db;
require_once(
DIR '/includes/functions_user.php');
$max 5;
$output '<div class="restore">';

$rep_users $vbulletin->db->query_read("
    SELECT user.*
    FROM " 
TABLE_PREFIX "user AS user
    WHERE options & 1024
    AND usergroupid NOT IN (8)
    ORDER BY reputation DESC
"
);

$rcount 0;

while (
$rep_user $db->fetch_array($rep_users) AND $rcount $max)
{
    
$avatar_url fetch_avatar_url($rep_user['userid']);
    
$avatar $avatar_url[0];

    if (!
$avatar)
    {
        
$avatar $vbulletin->stylevars['imgdir_misc']['imagedir'] . '/unknown.gif';
    }

    
$output .= '<div style="padding: 5px 0; border-bottom: dotted 1px #CCCCCC"><img src="' $avatar '" style="vertical-align: middle; width: 40px; height: 40px; margin-right: 0.5em" />' repuser_link($rep_user) . ': ' $rep_user['reputation'] . ' Points</div>';
    
$rcount++;
}

$output .= '</div>';

return 
$output;

function 
repuser_link($user)
{
    global 
$vbulletin;
    
$link 'member.php?do=getinfo&username=' $user['username'];

    if (
$user['displaygroupid'])
    {
        
$groupid $user['displaygroupid'];
    }
    else
    {
        
$groupid $user['usergroupid'];
    }

    
$open_tag $vbulletin->usergroupcache[$groupid]['opentag'];
    
$close_tag $vbulletin->usergroupcache[$groupid]['closetag'];
    
$title 'Visit ' $user['username'] . '\'s Profile';
    return 
'<a title="' $title '" href="' $link '">' $open_tag $user['username'] . $close_tag '</a>';



hollyboy 10-21-2017 02:21 AM

Quote:

Originally Posted by MarkFL (Post 2590582)
Odd, I've used that function in forum blocks for years on end without any issue on many different sites.

--------------- Added [DATE]1508550205[/DATE] at [TIME]1508550205[/TIME] ---------------

Try this code:

PHP Code:

global $vbulletin$db;
require_once(
DIR '/includes/functions_user.php');
$max 5;
$output '<div class="restore">';

$rep_users $vbulletin->db->query_read("
    SELECT user.*
    FROM " 
TABLE_PREFIX "user AS user
    WHERE options & 1024
    AND usergroupid NOT IN (8)
    ORDER BY reputation DESC
"
);

$rcount 0;

while (
$rep_user $db->fetch_array($rep_users) AND $rcount $max)
{
    
$avatar_url fetch_avatar_url($rep_user['userid']);
    
$avatar $avatar_url[0];

    if (!
$avatar)
    {
        
$avatar $vbulletin->stylevars['imgdir_misc']['imagedir'] . '/unknown.gif';
    }

    
$output .= '<div style="padding: 5px 0; border-bottom: dotted 1px #CCCCCC"><img src="' $avatar '" style="vertical-align: middle; width: 40px; height: 40px; margin-right: 0.5em" />' repuser_link($rep_user) . ': ' $rep_user['reputation'] . ' Points</div>';
    
$rcount++;
}

$output .= '</div>';

return 
$output;

function 
repuser_link($user)
{
    global 
$vbulletin;
    
$link 'member.php?do=getinfo&username=' $user['username'];

    if (
$user['displaygroupid'])
    {
        
$groupid $user['displaygroupid'];
    }
    else
    {
        
$groupid $user['usergroupid'];
    }

    
$open_tag $vbulletin->usergroupcache[$groupid]['opentag'];
    
$close_tag $vbulletin->usergroupcache[$groupid]['closetag'];
    
$title 'Visit ' $user['username'] . '\'s Profile';
    return 
'<a title="' $title '" href="' $link '">' $open_tag $user['username'] . $close_tag '</a>';



I like the style you added for each row.
Anyway how to disable admins to appear in the list?

I have made a quick mockup, showing the 3 tabs: week, month, all time.

https://vborg.vbsupport.ru/external/2017/10/6.jpg

MarkFL 10-21-2017 02:35 AM

Quote:

Originally Posted by hollyboy (Post 2590587)
I like the style you added for each row.
Anyway how to disable admins to appear in the list?

Oops, I changed that on my local dev site...find the line:

PHP Code:

    AND usergroupid NOT IN (8

And change it to:

PHP Code:

    AND usergroupid NOT IN (6,8

Quote:

Originally Posted by hollyboy (Post 2590587)
I have made a quick mockup, showing the 3 tabs: week, month, all time...

The tabs/buttons would have to go below the block title...would that be okay?

hollyboy 10-21-2017 02:36 AM

Quote:

Originally Posted by MarkFL (Post 2590588)



The tabs/buttons would have to go below the block title...would that be okay?

yes that's perfect man!

MarkFL 10-25-2017 02:12 PM

1 Attachment(s)
I have created a product that you can now install, and which I have attached. :)

First, delete the previous forum block that you created. Then download and import the attached .XML file. The new forum block will be auto-created. Then visit the product settings to configure the settings to your preferences.

Let me know if there are any issues, or changes you would like. :D

hollyboy 10-25-2017 02:18 PM

Quote:

Originally Posted by MarkFL (Post 2590747)
I have created a product that you can now install, and which I have attached. :)

First, delete the previous forum block that you created. Then download and import the attached .XML file. The new forum block will be auto-created. Then visit the product settings to configure the settings to your preferences.

Let me know if there are any issues, or changes you would like. :D

love it: http://www.interfans.org/forum/index.php

- can we set the order in the settings for the tabs: week, month, all time
- the list seems pretty much the same in all 3 tabs

MarkFL 10-25-2017 02:25 PM

Quote:

Originally Posted by hollyboy (Post 2590748)
- can we set the order in the settings for the tabs: week, month, all time

At present, the order is hard-coded in the custom template. I chose to go from the greatest period of time to the smallest. :)

Quote:

Originally Posted by hollyboy (Post 2590748)
- the list seems pretty much the same in all 3 tabs

That depends on what's in your database, that is, on your user's reputation activity. :)

hollyboy 10-25-2017 02:27 PM

Quote:

Originally Posted by MarkFL (Post 2590749)



That depends on what's in your database, that is, on your user's reputation activity. :)

the points for the week tab I think are too high in comparison to all time

--------------- Added [DATE]1508949583[/DATE] at [TIME]1508949583[/TIME] ---------------

Oh maybe because I've introduced the REP feature last 2 weeks so there is no much history yet

MarkFL 10-25-2017 02:41 PM

Quote:

Originally Posted by hollyboy (Post 2590750)
the points for the week tab I think are too high in comparison to all time

--------------- Added [DATE]1508949583[/DATE] at [TIME]1508949583[/TIME] ---------------

Oh maybe because I've introduced the REP feature last 2 weeks so there is no much history yet

Yes, if your users just recently started giving reps, then the lists would be very similar. Over time that will change.


All times are GMT. The time now is 08:05 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01470 seconds
  • Memory Usage 1,810KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (5)bbcode_php_printable
  • (10)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete