vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   custom sort of the memberlist (https://vborg.vbsupport.ru/showthread.php?t=43083)

banjolawyer 09-02-2002 02:41 PM

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?

banjolawyer 09-02-2002 05:01 PM

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.

Boofo 09-02-2002 05:31 PM

Did you try

$orderby=gradyear&$orderby=lastname&$orderby=first name

banjolawyer 09-02-2002 06:32 PM

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

Boofo 09-02-2002 06:38 PM

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?

banjolawyer 09-02-2002 06:58 PM

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.

Boofo 09-02-2002 07:08 PM

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.

banjolawyer 09-02-2002 07:26 PM

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.


All times are GMT. The time now is 02:34 AM.

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.01036 seconds
  • Memory Usage 1,725KB
  • 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
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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