The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
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? |
#2
|
|||
|
|||
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. |
#3
|
||||
|
||||
Did you try
$orderby=gradyear&$orderby=lastname&$orderby=first name |
#4
|
|||
|
|||
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 |
#5
|
||||
|
||||
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?
|
#6
|
|||
|
|||
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. |
#7
|
||||
|
||||
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. |
#8
|
|||
|
|||
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.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|