Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 09-02-2002, 02:41 PM
banjolawyer banjolawyer is offline
 
Join Date: Aug 2002
Location: Huntsville, Ala.
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default custom sort of the memberlist

The hyperlink for listing members by a particular field is, for example

quote:
--------------------------------------------------------------------------------
http://xxx/forums/memberlist.php?s=&what=field1
--------------------------------------------------------------------------------

I have added three custom fields to my user table, and will display those on the memberlist. (For example, firstname, lastname, graduationyear)

I would like rewrite the hyperlink for the "members" button, so that, when clicked, the resulting list is sorted by
1st - graduationyear
2nd - lastname
3rd - firstname

Can anyone tell me what my hyperlink should look like?
Reply With Quote
  #2  
Old 09-02-2002, 05:01 PM
banjolawyer banjolawyer is offline
 
Join Date: Aug 2002
Location: Huntsville, Ala.
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK; I've determined that what I really should be changing in the code in memberlist.php

I did this:
$orderby=gradyear;

and it worked

However, I don't know the syntax for adding additional fields. Can anyone help me?

I've tried
$orderby=gradyear,lastname,firstname;
and
$orderby=gradyear and lastname and firstname;

And neither worked.
Reply With Quote
  #3  
Old 09-02-2002, 05:31 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Did you try

$orderby=gradyear&$orderby=lastname&$orderby=first name
Reply With Quote
  #4  
Old 09-02-2002, 06:32 PM
banjolawyer banjolawyer is offline
 
Join Date: Aug 2002
Location: Huntsville, Ala.
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That produced the following error:

Invalid SQL: SELECT *
FROM user,userfield
WHERE 1=1 AND
user.userid = userfield.userid
AND usergroupid NOT IN (1,3,4)
ORDER BY d`````a` ASC
LIMIT 0,1000
mysql error: You have an error in your SQL syntax near '````a` ASC
LIMIT 0,1000' at line 6

mysql error number: 1064
Reply With Quote
  #5  
Old 09-02-2002, 06:38 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What is the full link you were using that worked? Adn what are the names of the fields you added to the db for the variables?
Reply With Quote
  #6  
Old 09-02-2002, 06:58 PM
banjolawyer banjolawyer is offline
 
Join Date: Aug 2002
Location: Huntsville, Ala.
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The hyperlink to the memberlist is the standard link
http://mysite.net/forums/memberlist.php?s=

I added the following fields to the db:
gradyear
firstname
lastnameold
and I modified register.php and registeradult template to force new users to provide that info. I've tested that out, no problems there.

I changed code in memberlist.php from:

if ($orderby=="" or ($orderby!="username" and $orderby!="posts" and $orderby!="joindate" and $orderby!="lastpost")) {
$orderby=username;

to:

if ($orderby=="" or ($orderby!="username" and $orderby!="posts" and $orderby!="joindate" and $orderby!="lastpost" and $orderby!="lastnameold")) {
$orderby=gradyear;

and that works fine also, but it only sorts by gradyear.

I am displaying the memberlist
1st column gradyear
2nd column lastnameold
3rd column firstname
4th column username
etc.

When I signup test users from the same year, Jones and Adams from 1988 are listed before the 1992 people, but Jones gets listed before Adams.
Reply With Quote
  #7  
Old 09-02-2002, 07:08 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm just guessing here but see if this will work.

if ($orderby=="" or ($orderby!="username" and $orderby!="posts" and $orderby!="joindate" and $orderby!="lastpost" and $orderby!="lastnameold")) {
$orderby=gradyear;
$orderby=lastnameold;
$$orderby=firstname;
$orderby=username;

or however order you wanted. Let me know if this does anything.
Reply With Quote
  #8  
Old 09-02-2002, 07:26 PM
banjolawyer banjolawyer is offline
 
Join Date: Aug 2002
Location: Huntsville, Ala.
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What happens here is that it just skips right down to the last orderby and sorts by the username. Thanks for your help. I am going to give up for the day.
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 04:36 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.04890 seconds
  • Memory Usage 2,222KB
  • Queries Executed 11 (?)
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
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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_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