The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
need some general advice about memberlist please
Hi
I need to make another mod to my site What I need to do now is organize the member list (memberlist.php results) into the order of last logged in The reason is I have a lot of mods to the member search facilities - this is because on my site members actually do search for and meet each other Now some parts of my memberlist.php are already modified by a third party who is now absent so I am not always 100% sure what is original vb code and what isn't but from what I can see from my site is that memberlist.php code builds an array $userinfo[] which contains all the members - and these are in the order in which the members registered (userid i guess) The modified code then checks each member in $userinfo[] array (using data provided by the searching user from a custom search page that allows search on any combination of custom use fields) and rejects those that do not meet the search parameters. It then returns the results in another array This is all working OK but as the site gets bigger the returned results are too many now if the user specifies a very broad search parameter So what I need to do is get this $userinfo[] array sorted by last logged in, and then run the search filter and return the first couple of hundred hits only (or less if f there are not that many) that match the specific search from the total membership. Then at least the results show the most active (recent log in) members first I could I guess write code to sort the $userinfo[] array into the desired order and then search the resulting array and limit how many I return to the user - but I guess it would be more efficient to build the array in the desired 'last visit' order in the first place by modifying the sql that builds it ??? But this is where i need some guidance as I am not a very experienced programmer (self taught in fact) so I would really appreciate a prod in the right direction of achieving this SO the main question is - what sql builds this array? Please feel free to check out my site 'Search For members' page to see how things are working now - don't forget to click 'advanced search' option if you do. The link is in my sig. thanks Rich |
#2
|
||||
|
||||
OK once again I sorted all this out for myself - it took me about a week
What I did (if anyone cares which I am starting to wonder) was leave the sql alone so vbulletin reads each member details into $userinfo array as normal using the primary key of userId which is basically in the order they registered This is running (in the memberlist.php file) through a 'while' loop until it reads all members In the while loop I placed all the conditional statements I need to reject members who do not meet the search requirement (by using continue; statements to exit the loop) I then removed the template_hook statement which generates the memberlist_resultbits html from the while loop and replaced it with a statement that adds all the members who meet the search parameters to my own array (called $foundMember) which is basically an array I created to contain all of the $userinfo arrays that met my search parameters I also removed from the while loop the code which converts the internal vbulletin 'last logged in' date into a readable format - so it was still in seconds since 1970 or whatever vbulletin actually uses (not that I care) After the while loop ran through all the members, I then sorted the $foundMember array into last logged in order I then checked how many results there where and if > 301 I set the $memberCount variable to 301 (thus limiting results to 301 of those who matched the search, in order of last logged in) Then I started a for loop outputting the results for each iteration I inserted the code I cut from the while loop that converts the last logged in date to readable form Also in the for loop I inserted the template_hook code that I cut from the while loop that writes the html And guess what it all worked first time once I fixed a few syntax errors as I have only been coding php for about three months so make silly grammatical errors) So that is what I did - if it is an inefficient way to solve the problem please anyone who knows better let me know I've only been programming webpages a few months since I got dumped in the deep end by the last guy I payed to work on my site - and decided to have a go myself but to be honest I feel I am doing this all the hard way. I don't mean to diss anyone but I am starting to wonder - do I ask the wrong questions (or just plain dumb ones) here as I honestly feel no one ever wants to answer them or help me and some of you must have been programming php and VB for a long time more that 3 months. I am sure I could do better (or at least a lot quicker) with some guidance from the more experienced members here to save me a week or two of studying the problem everytime I want to do something, and it would also save me the embarrassment of having to answer my own threads!! |
#3
|
|||
|
|||
Quote:
If it helps at all, you're doing a great job of answering your own threads... |
#4
|
||||
|
||||
Hi kh99
Yes thank you for your comments, and I appreciate you did reply to my other thread about jquery. I'll try to make my questions more to the point as a lot of my site is customized which I appreciate makes things harder for anyone to offer help If anyone wants to know more detail about how i implemented the stuff above (exactly where in memberlist.php i put my enhancements) please feel free to ask Rich |
#5
|
||||
|
||||
Nice work Rich.
Personally I think you should post your mod in the vB3 mods section. So someone that might need it can easily download or view what code you used. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|