The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
How to build a table from profile fields data?
I am trying to build a custom table from few custom profile fields.
Something like the following sketch: Few fields would need to be sorted on ASC or DESC order based on user input. Does anyone has an idea or hints what is the best way to make something like this? Maybe an example. Thanks for your time. Best regards, Val. |
#2
|
||||
|
||||
It's just a table on another page? You can start with one of these - How to create your own vBulletin-powered page! (uses vB templates) or [How-To] vBulletin API Basics: Creating Custom Pages & Misc. The fields are just in the database, so a simple query should get them, then just spit them out. Start with getting them outputted, then add in the sort (which would just be a simple switch with the result added to the end of the query as a "ORDER BY..." statement).
|
#3
|
||||
|
||||
Quote:
Actually I am trying to display that table on portal homepage (through vBAdvanced). I've posted the question there too. I am also trying to use the resources found from this post but didn't have much success so far. The table I am trying to make is a simple one, I only don't know how to populate the columns underneath it. I would use this code for column titles Code:
<thead> <tr align="center"> <td class="thead" width="55%">Name</td> <td class="thead" width="15%">Points</td> <td class="thead" width="8%">Year</td> <td class="thead" width="9%">Weight</td> <td class="thead" width="9%">Height</td> </tr> </thead> |
#4
|
||||
|
||||
I'm not familiar with vBadvanced at all, so I can't help with any of that. But, the fields you want are in the userfield table. The column 'userid' is the userid, and then the other columns are named 'field1', 'field2', 'field3', etc. So, it should be pretty easy for you to grab that information.
|
#5
|
||||
|
||||
Well after a lot of hard work, I managed to make a plugin which pulled any profile field I selected.
Currently, it is fetching data from two tables: user and userfield Here is the result Currently I am sorting these data based only from a single field in my query. Code:
ORDER by userfield.field26 DESC Here's my question: What I would like to know, is if there is an easier way to make the titles of these columns clickable (highlighted in red in pic), so when you click the titles (Graduation Year, Height, Weight) the system will sort those columns in accordance with that respective field The picture will explain it better. I appreciate your time and looking forward to replies. Val. |
#6
|
||||
|
||||
What I do on a similar page I wrote, is pass a sort variable. Then I have a switch in my page:
PHP Code:
PHP Code:
HTML Code:
<a href="yourpage.php?sort=gydesc">Graduation Year</a> |
#7
|
|||
|
|||
vBulletin has some great functions and code that you can easily rework with any data that will allow ordering up or down as well as searching, multiple pages, etc... I'd suggest you pick apart memberlist.php and look at the structure used there as well as the various code bits and bring the ones you want into your own script. It may take a little work to bring everything over to a script you wrote from scratch but it will give you more functionality down the road and helps insure your code is optimized to some degree.
|
#8
|
||||
|
||||
|
#9
|
||||
|
||||
Looks good! :up:
|
#10
|
||||
|
||||
Thanks Lynne,
I plan to release this when it is fully finished. Additionally, could you give a hint how could the sorter links ( ▼ and ▲ ) , or templates involved be loaded with Ajax? Right now when I click on those links all of the page is reloaded. Thanks, Val. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|