vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Miscellaneous Hacks - Memberlist -- Custom Profile Field Sorting (https://vborg.vbsupport.ru/showthread.php?t=124580)

Oblivion Knight 08-20-2006 10:00 PM

Memberlist -- Custom Profile Field Sorting
 
Memberlist -- Custom Profile Field Sorting
For vBulletin 3.6.0



Description
By default, vBulletin cannot show just a single custom field on the memberlist, nevermind make it sortable. It's all or nothing.. I wanted to display just the location field and make it sortable, because I use the CountryFlag modification. I searched vbulletin.org to see if this was possible, but all that I could find was unanswered questions similarly asking how to do it. So I took it on myself to get something usable and working.


Instructions
Upload the PLUGIN, and edit it via the Plugin Manager.

Find:
Code:

        case 'urlname':
Change urlname to the variable you want to be used in the URL of the memberlist sorting. My example is location.

Find:
Code:

                $sqlsort = 'userfield.fieldX';
Change X to the field number of your custom profile field. My example is 2.

Now you have 2 templates to edit. First, memberlist.

Find:
Code:

        <if condition="$show['homepagecol']"><td class="thead" nowrap="nowrap">$vbphrase[home_page]</td></if>
Above it, add:
Code:

        <td class="thead" nowrap="nowrap"><a href="$sorturl&amp;order=DESC&amp;sort=urlname&amp;pp=$perpage$usergrouplink">Title</a> $sortarrow[urlname]</td>
Use DESC or ASC depending on which default sort order that you wish to use. Change both instances of urlname to the variable that you specified in the plugin earlier (location). Change Title to the title of the field that you wish to be displayed. My example is Location.

Now edit the memberlist_resultsbit template.

Find:
Code:

        <if condition="$show['homepagecol'] AND exec_switch_bg()"><td class="$bgclass"><if condition="$show['homepagelink']"><a href="$userinfo[homepage]" target="_blank"><img src="$stylevar[imgdir_button]/home.gif" alt="home.gif" title="<phrase 1="$userinfo[username]">$vbphrase[visit_xs_homepage]</phrase>"  border="0" /></a><else />&nbsp;</if></td></if>
Above it, add:
Code:

        <if condition="exec_switch_bg()"><td class="$bgclass"><if condition="$userinfo[fieldX]"><div class="smallfont">$userinfo[fieldX]</div></if></td></if>
Change both instances of X to the field number that you specified in the plugin earlier (2).


Final Comment
It's not pretty, it's not clever but it works.. :p

FleaBag 08-21-2006 10:54 PM

This is an extremely useful addition. Thanks for sharing, I will certainly use it!

marlita 08-22-2006 02:06 AM

This is a great mod! thanks so much. =)

Snake 08-22-2006 12:53 PM

Thanks a lot.

Pvtiste 08-23-2006 01:37 PM

Good job dude !! Installed ;)

JenniferK 08-23-2006 02:07 PM

Am I missing something? In 3.6, if you go into User profile Field Manager and edit the custom profile field, there is an option to show that field (or not) on the Members List as well as make it searchable......

Oblivion Knight 08-23-2006 02:24 PM

Quote:

Originally Posted by JenniferK
Am I missing something? In 3.6, if you go into User profile Field Manager and edit the custom profile field, there is an option to show that field (or not) on the Members List as well as make it searchable......

Doesn't make it sortable though..

I wasn't aware that you could have a single custom field on the memberlist as opposed to all of them by default though. Then again, I didn't really play around with it too much.. ;)

dknelson 09-19-2006 06:23 PM

This is a great hack and I have it installed. I would like to also add the ability though to sort by this custom field in "advanced search" though. In other words...you search on a field with an option to sort the results by the custom field that you added.

jacobi 10-30-2006 04:22 AM

Is this mod compatible with 3.6.2? Also, I like dknelson's idea!

interfx 03-21-2007 11:58 PM

Does this work if I was to search multiple custom fields?

D Holzwarth 04-08-2007 04:16 AM

Does this work with vb 3.6.5

jacobi 04-08-2007 07:55 AM

It works on my site.

D Holzwarth 04-08-2007 09:33 PM

Works on mine now too. Very sweet. Was able to delete additional databases due to this feature. Thank you.

baderandsonsco 03-16-2008 11:35 PM

Thank you very much!

VikesRule 08-20-2008 05:52 PM

On this part:

Quote:

Change both instances of urlname to the variable that you specified in the plugin earlier (location).
If I'm doing this for a custom field, do I put say "field4" in for the urlname or whatever field number corresponds with it?

And what do I do to add more than one custom field that is sortable?

VikesRule 08-27-2008 07:49 PM

Bump..........................

ganima 10-18-2009 02:21 PM

Does anybody know how to change sort from DESC to ASC when clicking on the link in the forum?

Untill now I only can specify which order to sort at the first click. But it should go revers on click #2.

Need some help.

MjrNuT 12-03-2009 10:40 PM

This works like a charm for v3.8.4

@ganima -- Not possible I guess. Mine will not resort either. Not critical for me though.

joshskeety 02-01-2010 05:07 AM

Quote:

Originally Posted by ganima (Post 1901681)
Does anybody know how to change sort from DESC to ASC when clicking on the link in the forum?

Untill now I only can specify which order to sort at the first click. But it should go revers on click #2.

Need some help.

Once you've clicked it once you have to click the arrow next to the title to sort up or down :)

Jim Westergren 09-09-2010 02:31 PM

Does this work with vBulletin 4?

Superorb 09-13-2012 11:09 PM

Has anyone found a way to get this working on 4.2?

Charis 07-10-2013 08:25 AM

Quote:

Originally Posted by Superorb (Post 2365228)
Has anyone found a way to get this working on 4.2?

Anyone?


All times are GMT. The time now is 06:02 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.01369 seconds
  • Memory Usage 1,759KB
  • 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
  • (6)bbcode_code_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (22)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete