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)

Keyser520 03-02-2006 01:44 PM

where do I change the order of rank images?
 
It currently displays them as Last added, First shown, but I want it to happen in the reverse order. Does anyone know what function/script calls the display rank function and/or how to make this happen?

Thanks,

Sculli 03-02-2006 05:47 PM

I would like to know as well. It doesn't seem like too complicated of an issue, clearly the current order must be stored somewhere. Does anyone know in which template that would be?

Keyser520 03-02-2006 05:49 PM

I had this posted for a week on vbulletin.com before someone told me that no one there would answer it. I'm trying my luck here.

Kihon Kata 04-18-2006 12:56 PM

BUMP, I need to know this also. It cannot be too difficult

Keyser520 04-18-2006 05:39 PM

It appears that the only place this shows up in the templates is..

PHP Code:

<if condition="$post['usertitle']"><div class="smallfont">$post[usertitle]</div></if>
            <if 
condition="$post['rank']"><div class="smallfont">$post[rank]</div></if> 


I'm guessing that this means that "rank" is a variable in the db, which makes sense as you have to update ranks sometimes.

What I need to know is where the function that writes the ranks is. All I want to do is REVERSE the order that it writes them...

Kihon Kata 04-18-2006 06:15 PM

Quote:

Originally Posted by Keyser520
It appears that the only place this shows up in the templates is..

PHP Code:

<if condition="$post['usertitle']"><div class="smallfont">$post[usertitle]</div></if>
            <if 
condition="$post['rank']"><div class="smallfont">$post[rank]</div></if> 


I'm guessing that this means that "rank" is a variable in the db, which makes sense as you have to update ranks sometimes.

What I need to know is where the function that writes the ranks is. All I want to do is REVERSE the order that it writes them...

I think the issue is that $post[rank] represents 1 rank or 2 ranks(if using stacked ranks)

I'm sure someon can fix this

majorxp 05-31-2006 08:49 PM

I'm looking for same...

lheliosl 05-09-2007 10:09 PM

wow anyone?

tarionyx 05-31-2007 03:10 PM

Looking for this also! :)

majorxp 05-31-2007 03:40 PM

Did anyone put in a request for this on VB.org?

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

orion808 01-11-2009 02:20 PM

Quote:

Originally Posted by DragonBlade (Post 1684027)
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'] . ",
            rankorder = " 
$vbulletin->GPC['rankorder'] . "
        WHERE rankid = " 
$vbulletin->GPC['rankid'] . "
    "
); 


The 3rd from the last line you had "display" instead of the intended "rankorder". Otherwise, this worked perfectly.

DragonBlade 01-15-2009 02:25 AM

Quote:

Originally Posted by orion808 (Post 1708607)
The 3rd from the last line you had "display" instead of the intended "rankorder". Otherwise, this worked perfectly.

Kickasskewl, you've tried it? I still haven't got around to it. XD

Go me, yay, I did something useful! ^_^

orion808 01-20-2009 01:28 AM

Yeah, works fine. Would be helpful if the "rank" was also visible (not editable) via the User Rank Manager so you would have an overview and know which ranks you needed to edit.

I have 20 ranks that go into 4 different slots. This works perfectly. So:

<<Orion>>
Forum Status (Rank 1)
Guild Status (Rank 2)
Platoon Status (Rank 3)
Squad Status (Rank 4)

n8td 01-31-2009 06:44 AM

In the /admincp/rank.php

Find:
PHP Code:

            print_form_header('ranks''insert'01'name''');
            
print_table_header($vbphrase['images']);
            
construct_hidden_code('usergroupid'$vbulletin->GPC['usergroupid']);
            
construct_hidden_code('ranklevel'$vbulletin->GPC['ranklevel']);
            
construct_hidden_code('minposts'$vbulletin->GPC['minposts']);
            
construct_hidden_code('doinsert'$vbulletin->GPC['rankimg']); 

Change it to:
PHP Code:

            print_form_header('ranks''insert'01'name''');
            
print_table_header($vbphrase['images']);
            
construct_hidden_code('usergroupid'$vbulletin->GPC['usergroupid']);
            
construct_hidden_code('ranklevel'$vbulletin->GPC['ranklevel']);
            
construct_hidden_code('minposts'$vbulletin->GPC['minposts']);
            
construct_hidden_code('rankorder'$vbulletin->GPC['rankorder']);
            
construct_hidden_code('doinsert'$vbulletin->GPC['rankimg']); 

This allows the variable for rankorder to be called.


Find:
PHP Code:

            print_table_header(iif($rank['usergroupid'] == 0$vbphrase['all_usergroups'], $rank['title']), 51);
            
print_cells_row(array($vbphrase['user_rank'], $vbphrase['minimum_posts'], $vbphrase['display_type'], $vbphrase['stack_rank'], $vbphrase['controls']), 1''

Change it to:
PHP Code:

            print_table_header(iif($rank['usergroupid'] == 0$vbphrase['all_usergroups'], $rank['title']), 61);
            
print_cells_row(array($vbphrase['user_rank'], $vbphrase['minimum_posts'], $vbphrase['display_type'], $vbphrase['stack_rank'], 'Rank Order'$vbphrase

Going from 5 to 6 increases the number of headers. Adding 'Rank Order' gives the column a name.


Find:
PHP Code:

        $cell = array(
            
$rankhtml,
            
vb_number_format($rank['minposts']),
            (
$rank['display'] ? $vbphrase['displaygroup'] : $vbphrase['always']),
            (
$rank['stack'] ? $vbphrase['yes'] : $vbphrase['no']),
            
construct_link_code($vbphrase['edit'], "ranks.php?" $vbulletin->session->vars['sessionurl'] . "do=edit&rankid=$rank[rankid]") . construct_link_code($vbphrase['delete'], "ranks.php?" $vbulletin->session->vars['sessionurl'] . "do=remove&rankid=$rank[rankid]")
        ); 

Change it to:
PHP Code:

        $cell = array(
            
$rankhtml,
            
vb_number_format($rank['minposts']),
            (
$rank['display'] ? $vbphrase['displaygroup'] : $vbphrase['always']),
            (
$rank['stack'] ? $vbphrase['yes'] : $vbphrase['no']),
            
vb_number_format($rank['rankorder']),
            
construct_link_code($vbphrase['edit'], "ranks.php?" $vbulletin->session->vars['sessionurl'] . "do=edit&rankid=$rank[rankid]") . construct_link_code($vbphrase['delete'], "ranks.php?" $vbulletin->session->vars['sessionurl'] . "do=remove&rankid=$rank[rankid]")
        ); 

This adds the rankorder number to show up on the User Rank Manager page.


Find:
PHP Code:

// ###################### Start modify #######################
if ($_REQUEST['do'] == 'modify')
{
    
$ranks $db->query_write("
        SELECT rankid, ranklevel, minposts, rankimg, ranks. usergroupid,title, type, display, stack
        FROM " 
TABLE_PREFIX "ranks AS ranks
        LEFT JOIN " 
TABLE_PREFIX "usergroup AS usergroup USING(usergroupid)
        ORDER BY ranks.usergroupid, minposts 

Change it to:
PHP Code:

// ###################### Start modify #######################
if ($_REQUEST['do'] == 'modify')
{
    
$ranks $db->query_write("
        SELECT rankid, ranklevel, minposts, rankimg, ranks. usergroupid,title, type, display, stack, rankorder
        FROM " 
TABLE_PREFIX "ranks AS ranks
        LEFT JOIN " 
TABLE_PREFIX "usergroup AS usergroup USING(usergroupid)
        ORDER BY rankorder, ranks.usergroupid, minposts
    "
); 

This changes the display order on the User Rank Manager page.

All these steps should display the rankorder on the User Rank Manager page.

orion808 02-05-2009 11:12 PM

Nice, I'll install that tomorrow. Thank you.

orion808 02-15-2009 11:20 PM

Well, almost forgot to do this. Thanks for the reminder PM, n8td. One small error, but got it working.

On your last section of code to replace:
Code:

SELECT rankid, ranklevel, minposts, rankimg, ranks. usergroupid,title, type, display, stack, rank
Should be:
Code:

SELECT rankid, ranklevel, minposts, rankimg, ranks. usergroupid,title, type, display, stack, rankorder

Notice that it's rankorder, not rank. Works like a charm though. Thank you for this. Cleans up my ranks for sure. Actually found one that had the wrong order on it that I forgot to edit after a recent change.

n8td 02-16-2009 12:59 AM

Okay thanks. I edited the original post.

SnaKe |WiH| 05-13-2009 01:00 AM

Quote:

Originally Posted by n8td (Post 1745469)
Okay thanks. I edited the original post.

Just to clarify for me, which # post was modified plz? I'd like to try this out.

RLShare 05-13-2009 01:07 AM

That person has only made a single post in this thread that has code in it, I can pretty much guarantee that is the post that is being referred to.

SnaKe |WiH| 05-13-2009 08:17 PM

Ah, duh, thanks!

badheeu 05-14-2009 01:41 PM

how about requesting this one for simple addon. that will be very easy.
its very much to edit

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

when I insert last part, it gets db error

SnaKe |WiH| 05-18-2009 02:09 AM

I tried this but get a database error when I open User Rank Manager.

Am I suppose to create this new field in the db table manually or is making the code change all I need to do?

SnaKe |WiH| 05-20-2009 03:35 PM

^Bump

Lynne 05-20-2009 05:02 PM

Quote:

Originally Posted by SnaKe |WiH| (Post 1812710)
I tried this but get a database error when I open User Rank Manager.

Am I suppose to create this new field in the db table manually or is making the code change all I need to do?

Reread his post, this is the second line:
Quote:

In theory, all we need to do is add a field to the "rank" table called "rankorder".
So yes, you need to add a field to your database.

SnaKe |WiH| 05-20-2009 07:19 PM

Quote:

Originally Posted by Lynne (Post 1814207)
Reread his post, this is the second line:

So yes, you need to add a field to your database.

Ah, sorry, missed that. Thanks!!!

rrudeboy 06-18-2009 03:51 PM

error is gone (had to add rankorder to the database, not sure if i added it 100% correctly in choose the fields)

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

did all this, and deleted all ranks and started over again, made the founder first (it got automatically id:0) then i made admin which also automatically got id:0... rebuild the user titles and they are displayed in reversed order of creation (admin first, then founder)

could use some assistance.

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

after running another rebuild, founder is id:5 and admin is id:6, so they are still shown reversed :(

orion808 06-19-2009 11:36 AM

Not sure I understand the above post...but:

You should be able to just edit the rank order after this is installed. It doesn't matter what order you created the ranks in, just the order of the rankid. Something that is 5 appears before 6. Something that is 3 appears on the same line or immediately after another 3 depending on if both are ranks of the player.

I have my admin/moderator/supermoderator/banned as rankid=1 and have my "guild" status (I play World of Warcraft) as rankid=2. So there are 4 ranks that have rankid=1....etc.

http://www.azurebloodfire.com/member...tt/rank_id.jpg

rrudeboy 06-19-2009 11:48 AM

thanks orion808.... i clearly have something wrong, this is how my ranks look:

http://bb.roeiboot.com/ss/Rank_Capture.JPG

question is what did i screw up :(

plus i can NOT edit the rank order..

Lynne 06-19-2009 02:58 PM

Quote:

Originally Posted by rrudeboy (Post 1832600)
question is what did i screw up :(

plus i can NOT edit the rank order..

Reread and go over the instructions in post 20, the correction in post 21, and also post 24.

rrudeboy 06-19-2009 07:29 PM

Quote:

Originally Posted by Lynne (Post 1832709)
Reread and go over the instructions in post 20, the correction in post 21, and also post 24.

thanks Lynne.... after the day i had, maybe tomorrow i will be brave enough to triple check the code (which i all copy 'n pasted so not sure what went wrong)


All times are GMT. The time now is 05:23 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.01628 seconds
  • Memory Usage 1,990KB
  • 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
  • (2)bbcode_code_printable
  • (26)bbcode_php_printable
  • (9)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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