Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
  #1  
Old 11-12-2005, 09:44 AM
dknelson dknelson is offline
 
Join Date: Oct 2004
Posts: 412
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Sort member list by Location

Sorry if this has already been requested. I did a search and didn't find it.

I would like to be able to sort the members list by location. To be able to click the "Location" field just as you do the "posts", "alphabetical", etc. headers.

I've seen this requested all the way back to VBulleting 2 something but have never really seen it done. Is it just not feasible?

Don
Reply With Quote
  #2  
Old 11-23-2005, 09:21 PM
boatdesign's Avatar
boatdesign boatdesign is offline
 
Join Date: Nov 2001
Posts: 116
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Excellent idea - this would be very useful for many forums.
Reply With Quote
  #3  
Old 12-17-2005, 02:59 AM
zendiver zendiver is offline
 
Join Date: Sep 2004
Location: Houston, TX
Posts: 118
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I know quite a few have been asking for this and I knew that I had it before in an earlier version (3.0.3) so I thought I would give it a go and see if I could get it to work in 3.5.2 and it does.
(Thanks to Stuart for the direction over a year ago)

1 File to Edit
1 Template to Edit


In memberlist.php you need to add a case, to the switch so as you can sort by location.

case 'location':
$sqlsort = 'userfield.field2';
break;


So in forums/memberlist.php on or about line 356...

FIND:
Code:
switch ($sortfield)
    {
        case 'username':
            $sqlsort = 'user.username';
            break;
REPLACE WITH:
Code:
switch ($sortfield)
    {
        case 'location':
            $sqlsort = 'userfield.field2';
            break;
        case 'username':
            $sqlsort = 'user.username';
            break;
If the customfields radio button is enabled (YES) in AdminCP Options->User Listing & Profile Viewing->Member List Enabled, then the 5 fields from the userfield table are included and put in an array, $profileinfo. Later, if $profileinfo is an array and $vboptions['customfields'] is true, there's some code that pulls the extra table headings from template memberlist_results_header.

There's more than 1 way to do this, but for ease, I would add a line of code that sets a condition if the field is Location (field2)

$show['field2'] = iif($customfield['varname'] == 'field2', true, false);

In forums/memberlist.php on or about line 811...

FIND:
Code:
		foreach ($profileinfo AS $index => $customfield)
		{

			$totalcols++;
			$customfield = $customfield['title'];
			eval('$customfieldsheader .= "' . fetch_template('memberlist_results_header') . '";');
		}
	}
REPLACE WITH:
Code:
		foreach ($profileinfo AS $index => $customfield)
		{
                        $show['field2'] = iif($customfield['varname'] == 'field2', true, false);
			$totalcols++;
			$customfield = $customfield['title'];
			eval('$customfieldsheader .= "' . fetch_template('memberlist_results_header') . '";');
		}
	}
To set the condition, that is used in the template memberlist_results_header

so that in memberlist_results_header you could change

FIND:
Code:
<td class="thead" nowrap="nowrap">$customfield</td>
REPLACE WITH:
Code:
<td class="thead" nowrap="nowrap"><if condition="$show['field2']"><a href="$sorturl&amp;order=DESC&amp;sort=location&amp;pp=$perpage&amp;ltr=$ltr$usergrouplink">$customfield</a> $sortarrow[location]<else />$customfield</if></td>
Be warned, its not a search option for a reason, its a slow query, sorting on location and without an index it needs to do a full table scan. With a BIG database, it could be taxing.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:28 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06209 seconds
  • Memory Usage 2,178KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (6)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete