vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   where do I change the order of rank images? (https://vborg.vbsupport.ru/showthread.php?t=109292)

Lord Omega 06-29-2007 07:48 AM

I could use this information as well. :O

pancan17 03-25-2008 05:04 AM

Bump for an old-skool question I'm wondering about as well...

lostgirl815 03-25-2008 06:50 AM

I assume it can't be done, because someone was complaining in vBulletin.com's 'talk about 3.7.0 beta 6' thread that they still haven't provided a way to order ranks.

DriverDan 03-27-2008 09:58 AM

It CAN be done, it just requires modifying code.

Sanctorum 03-27-2008 05:48 PM

Yeah, ordering ranks would be great, I'm surprised it isn't like that.

StregSpiller 04-04-2008 12:09 PM

Bump....
Still no solution to this one???

n8td 08-05-2008 04:07 PM

Does anyone know how to do this?

marrr 08-13-2008 03:07 PM

im looking for this also

Amm0 08-27-2008 07:13 PM

Same here guys :D

Is there any way to make an official request?

DragonBlade 12-12-2008 06:40 PM

I'm actually working on this. XD

In theory, all we need to do is add a field to the "rank" table called "rankorder".

In the insert block on the /admincp/ranks.php, we need to add a field to this:
PHP Code:

    $vbulletin->input->clean_array_gpc('p', array(
        
'ranklevel'   => TYPE_UINT,
        
'minposts'    => TYPE_UINT,
        
'rankimg'     => TYPE_STR,
        
'usergroupid' => TYPE_INT,
        
'doinsert'    => TYPE_STR,
        
'rankhtml'    => TYPE_NOTRIM,
        
'stack'       => TYPE_UINT,
        
'display'     => TYPE_UINT,
    )); 

This would be the field added
PHP Code:

        'rankorder'     => TYPE_UINT

Then find this code in the same section
PHP Code:

    /*insert query*/
    
$db->query_write("
        INSERT INTO " 
TABLE_PREFIX "ranks
            (ranklevel, minposts, rankimg, usergroupid, type, stack, display)
        VALUES
            (
            " 
$vbulletin->GPC['ranklevel'] . ",
            " 
$vbulletin->GPC['minposts'] . ",
            '" 
$db->escape_string($vbulletin->GPC['rankimg']) . "',
            " 
$vbulletin->GPC['usergroupid'] . ",
            
$type,
            " 
$vbulletin->GPC['stack'] . ",
            " 
$vbulletin->GPC['display'] . "
            )
    "
); 

and change it to
PHP Code:

    /*insert query*/
    
$db->query_write("
        INSERT INTO " 
TABLE_PREFIX "ranks
            (ranklevel, minposts, rankimg, usergroupid, type, stack, display, rankorder)
        VALUES
            (
            " 
$vbulletin->GPC['ranklevel'] . ",
            " 
$vbulletin->GPC['minposts'] . ",
            '" 
$db->escape_string($vbulletin->GPC['rankimg']) . "',
            " 
$vbulletin->GPC['usergroupid'] . ",
            
$type,
            " 
$vbulletin->GPC['stack'] . ",
            " 
$vbulletin->GPC['display'] . ",
            " 
$vbulletin->GPC['rankorder'] . "
            )
    "
); 

That will take care of inserting the rank into the DB.


Now to edit existing ranks, find this in the edit block on the same page:
PHP Code:


    construct_hidden_code
('rankid'$vbulletin->GPC['rankid']);
    
print_table_header(construct_phrase($vbphrase['x_y_id_z'], $vbphrase['user_rank'], ''$vbulletin->GPC['rankid']));
    
print_input_row($vbphrase['times_to_repeat_rank'], 'ranklevel'$ranks['ranklevel']);
    
print_chooser_row($vbphrase['usergroup'], 'usergroupid''usergroup'$ranks['usergroupid'], $vbphrase['all_usergroups']);
    
print_input_row($vbphrase['minimum_posts'], 'minposts'$ranks['minposts']);
    
print_yes_no_row($vbphrase['stack_rank'], 'stack'$ranks['stack']);
    
print_select_row($vbphrase['display_type'], 'display'$displaytype$ranks['display']);
    
print_table_header($vbphrase['rank_type']);
    
print_input_row($vbphrase['user_rank_file_path'], 'rankimg'$rankimg);
    
print_input_row($vbphrase['or_you_may_enter_text'], 'rankhtml'$ranktext);

    
print_submit_row(); 

Before print_submit_row(); (wherever you want it), add the line:
PHP Code:

    print_input_row('Rank Order''rankorder'$ranks['rankorder']); 



Next, in the doupdate block of the same page, again find this code:
PHP Code:

    $vbulletin->input->clean_array_gpc('p', array(
        
'ranklevel'   => TYPE_UINT,
        
'minposts'    => TYPE_UINT,
        
'rankimg'     => TYPE_STR,
        
'usergroupid' => TYPE_INT,
        
'doinsert'    => TYPE_STR,
        
'rankhtml'    => TYPE_NOTRIM,
        
'stack'       => TYPE_UINT,
        
'display'     => TYPE_UINT,
    )); 

and add in there
PHP Code:

        'rankorder'     => TYPE_UINT

Then find
PHP Code:

    $db->query_write("
        UPDATE " 
TABLE_PREFIX "ranks
        SET ranklevel = " 
$vbulletin->GPC['ranklevel'] . ",
            minposts = " 
$vbulletin->GPC['minposts'] . ",
            rankimg = '" 
$db->escape_string($vbulletin->GPC['rankimg']) . "',
            usergroupid = " 
$vbulletin->GPC['usergroupid'] . ",
            type = 
$type,
            stack = " 
$vbulletin->GPC['stack'] . ",
            display = " 
$vbulletin->GPC['display'] . "
        WHERE rankid = " 
$vbulletin->GPC['rankid'] . "
    "
); 

and edit is so:
PHP Code:

    $db->query_write("
        UPDATE " 
TABLE_PREFIX "ranks
        SET ranklevel = " 
$vbulletin->GPC['ranklevel'] . ",
            minposts = " 
$vbulletin->GPC['minposts'] . ",
            rankimg = '" 
$db->escape_string($vbulletin->GPC['rankimg']) . "',
            usergroupid = " 
$vbulletin->GPC['usergroupid'] . ",
            type = 
$type,
            stack = " 
$vbulletin->GPC['stack'] . ",
            display = " 
$vbulletin->GPC['display'] . ",
            display = " 
$vbulletin->GPC['rankorder'] . "
        WHERE rankid = " 
$vbulletin->GPC['rankid'] . "
    "
); 



Now, you have to change the build_ranks() function in includes/functions_ranks.php. Look for
PHP Code:

// #################### Begin Build Ranks PHP Code function ################
function &build_ranks()
{
    global 
$vbulletin;

    
$ranks $vbulletin->db->query_read_slave("
        SELECT ranklevel AS l, minposts AS m, rankimg AS i, type AS t, stack AS s, display AS d, ranks.usergroupid AS u
        FROM " 
TABLE_PREFIX "ranks AS ranks
        LEFT JOIN " 
TABLE_PREFIX "usergroup AS usergroup USING (usergroupid)
        ORDER BY ranks.usergroupid DESC, minposts DESC
    "
);

    
$rankarray = array();
    while (
$rank $vbulletin->db->fetch_array($ranks))
    {
        
$rankarray[] = $rank;
    }

    
build_datastore('ranks'serialize($rankarray), 1);

    return 
$rankarray;


We are going to change the ORDER BY bit of the query to be
PHP Code:

// #################### Begin Build Ranks PHP Code function ################
function &build_ranks()
{
    global 
$vbulletin;

    
$ranks $vbulletin->db->query_read_slave("
        SELECT ranklevel AS l, minposts AS m, rankimg AS i, type AS t, stack AS s, display AS d, ranks.usergroupid AS u
        FROM " 
TABLE_PREFIX "ranks AS ranks
        LEFT JOIN " 
TABLE_PREFIX "usergroup AS usergroup USING (usergroupid)
        ORDER BY ranks.rankorder, ranks.usergroupid DESC, minposts DESC
    "
);

    
$rankarray = array();
    while (
$rank $vbulletin->db->fetch_array($ranks))
    {
        
$rankarray[] = $rank;
    }

    
build_datastore('ranks'serialize($rankarray), 1);

    return 
$rankarray;



P.S.: I have NOT done this to my own forum yet, so I can only ASSUME this would work. I am also a vB Programming newbie, so there might be a much better, easier, faster way.



Figures, I actually came here because I was looking for help on how to update the rank display for a single user after changing said user's membergroupids. XD


All times are GMT. The time now is 02:58 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.01210 seconds
  • Memory Usage 1,815KB
  • 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
  • (12)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)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