Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - REQ: Members.asp Default Sort Order
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

REQ: Members.asp Default Sort Order

 Post Reply Post Reply
Author
MortiOli View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 May 2002
Location: United Kingdom
Status: Offline
Points: 514
Post Options Post Options   Thanks (0) Thanks(0)   Quote MortiOli Quote  Post ReplyReply Direct Link To This Post Topic: REQ: Members.asp Default Sort Order
    Posted: 29 March 2007 at 1:00pm

Did a quick search, but couldn't find an answer - lots of requests, but no answers.

How do I go about changing the default sort order for members.asp?
 
For example, at the moment it sorts by Username when you access the page, but I'd like it to be sorting by Post Count (highest first), instead.
 
Cheers!
Back to Top
MortiOli View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 May 2002
Location: United Kingdom
Status: Offline
Points: 514
Post Options Post Options   Thanks (0) Thanks(0)   Quote MortiOli Quote  Post ReplyReply Direct Link To This Post Posted: 03 April 2007 at 1:37pm
Anyone have an idea?
Back to Top
MrMellie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 December 2006
Location: United Kingdom
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote MrMellie Quote  Post ReplyReply Direct Link To This Post Posted: 03 April 2007 at 2:42pm
Oli, change line 119 (after the 'case else' on line 118) from 
 
 strSortBy = strDbTable & "Author.Username "

to

strSortBy = strDbTable & "Author.No_of_posts "

Back to Top
MrMellie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 December 2006
Location: United Kingdom
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote MrMellie Quote  Post ReplyReply Direct Link To This Post Posted: 03 April 2007 at 2:56pm
Oh and you might also want to change lines 122 on to get the default sort order right.
 
From:
 

'Sort the direction of db results

If Request.QueryString("OB") = "desc" Then

strSortDirection = "asc"

strSortBy = strSortBy & "DESC"

Else

strSortDirection = "desc"

strSortBy = strSortBy & "ASC"

End If

to
 
'Sort the direction of db results

If Request.QueryString("OB") = "asc" Then

strSortDirection = "desc"

strSortBy = strSortBy & "ASC"
Else

strSortDirection = "asc"

strSortBy = strSortBy & "DESC"

End If

And hopefully, the last change, around line 370-376, replace with:
[code]

<table cellspacing="1" cellpadding="3" class="tableBorder" align="center">

<tr class="tableLedger">

<td width="20%"><a href="members.asp?SF=<% = Server.URLEncode(Request.QueryString("SF")) %>&GID=<% = intGetGroupID %>&SO=UN<% = strQsSID2 %>"><% = strTxtUsername %></a><% If Request.QueryString("SO") = "UN" Then Response.Write(" <a href=""members.asp?SF=" & Server.URLEncode(Request.QueryString("SF")) & "&GID=" & intGetGroupID & "&SO=UN&OB=" & strSortDirection & strQsSID2 & """><img src=""" & strImagePath & strSortDirection & ".gif"" border=""0"" align=""absmiddle"" alt=""" & strTxtReverseSortOrder & """ /></a>") %></td>

<td width="20%"><a href="members.asp?SF=<% = Server.URLEncode(Request.QueryString("SF")) %>&GID=<% = intGetGroupID %>&SO=GP<% = strQsSID2 %>"><% = strTxtType %></a><% If Request.QueryString("SO") = "GP" Then Response.Write(" <a href=""members.asp?SF=" & Server.URLEncode(Request.QueryString("SF")) & "&GID=" & intGetGroupID & "&SO=GP&OB=" & strSortDirection & strQsSID2 & """><img src=""" & strImagePath & strSortDirection & ".gif"" border=""0"" align=""absmiddle"" alt=""" & strTxtReverseSortOrder &

Back to Top
MortiOli View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 May 2002
Location: United Kingdom
Status: Offline
Points: 514
Post Options Post Options   Thanks (0) Thanks(0)   Quote MortiOli Quote  Post ReplyReply Direct Link To This Post Posted: 05 April 2007 at 2:00pm

Cheers Ric!  Perfect!

Back to Top
MortiOli View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 May 2002
Location: United Kingdom
Status: Offline
Points: 514
Post Options Post Options   Thanks (0) Thanks(0)   Quote MortiOli Quote  Post ReplyReply Direct Link To This Post Posted: 05 April 2007 at 10:59pm
Just found that your first change also needed a line adding, otherwise sorting by username didn't work correctly;
 
'Get the sort critiria
Select Case Request.QueryString("SO")
 Case "PT"
  strSortBy = strDbTable & "Author.No_of_posts "
 Case "LU"
  strSortBy = strDbTable & "Author.Join_date "
 Case "OU"
  strSortBy = strDbTable & "Author.Join_date "
 Case "GP"
  strSortBy = strDbTable & "Group.Name "
 Case "LA"
  strSortBy = strDbTable & "Author.Last_visit "
 Case "UN"
  strSortBy = strDbTable & "Author.Username "
 Case Else
  strSortBy = strDbTable & "Author.No_of_posts "
End Select


Edited by MortiOli - 05 April 2007 at 10:59pm
Back to Top
wistex View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 30 August 2003
Location: United States
Status: Offline
Points: 877
Post Options Post Options   Thanks (0) Thanks(0)   Quote wistex Quote  Post ReplyReply Direct Link To This Post Posted: 08 April 2007 at 1:12am
Another way to accomplish this is to simply change the link to the members list at the top pf the page.
 
 
It used to be:
 
I changed it to:
which you will notice is the URL produced when you sort by posts by clicking on column headings to sort.
 
I added the trailing & just in case WWF tacked on a session ID for those without cookies, otherwise it would break for them.
 
Changing the link to the members page accomplishes the same thing.
 
I wish this sort order was the default and I didn't have to change it every time I upgrade.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.