![]() |
Custom profile field and username on its own page.
I've asked at vb.org, but have not received a response. So, I thought I'd try here.
I want to have a page on my forum that displays only usernames and a ceratin custom profile field. I only want to display the user and profile field if that user has entered something into the field. I know that I would have to do something with this: <if condition="$post[field5]">$post[field5]</if> For example: IF profile field 5 is RPG Name, I want the users to be able to navigate to a page that shows other user's rpg names (and only their Username and RPG name. I don't want all the extra stuff that the memberlist has). I still want the memberlist to show and I have a couple of custom fields I would like to do this with. I just don't know how to get this on it's own page. Not sure if this is a template-only hack, but thought I'd try to find out. Sorry if it shouldn't be posted here. Thanks, Rick |
You'd have to write a custom query for the database to pull all usernames and the fields and display them on the page. It's definitely NOT a template only hack. It wouldn't be that difficult to do.
You'd need a php page with the query, something like: Code:
$RPG = $DB_site->query("SELECT username, fieldX FROM users, usertextfield ORDER BY username DESC"); Code:
while($row=mysql_fetch_object($RPG)) I don't use table prefixes so the query above doesn't show that, if you have a large number of users you may also need a pagination code in there in order to not display all users on a single page. This is all off the top of my head, untested and without any warranty. This is only to give you an idea of what would be involved. |
Thanks Scott. That helps a lot actually. I haven't tested it yet, but it definately points me in the right direction of where I need to go with it. If you can think of anything else, please let me know.
Thanks, Rick |
Glad I could help Rick. The only additional thing I can think of is to match the username with the text field in your query. I left that out before.
More like this: Code:
$RPG = $DB_site->query("SELECT user.userid, user.username, usertextfield.userid, usertextfield.fieldX FROM users, usertextfield WHERE user.userid == usertextfield.userid ORDER BY user.username DESC"); |
All times are GMT. The time now is 10:51 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|