Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-04-2004, 02:14 AM
Starscream's Avatar
Starscream Starscream is offline
 
Join Date: Jun 2004
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 10-04-2004, 07:08 AM
Jolten Jolten is offline
 
Join Date: Mar 2004
Posts: 749
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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");
Then loop it

Code:
while($row=mysql_fetch_object($RPG))
{
	
	$who = $row->username;
	$rpgname = $row->fieldX;

eval('$rpgbit .= "' . fetch_template('RPG_listbit') . '";');

}

eval('print_output("' . fetch_template('RPGLIST') . '");');
Then create two templates, RPGLIST for the main page (header and footer in it) using $rpgbit where you wanted the list of usernames, and RPG_listbit to display the names using $who and $rpgname where you what the names. Since there's a loop you really only need to format one row of html using $who and $rpgname for the RPG_listbit, it will repeat as long as there is data to display displaying the next user in the database.

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.
Reply With Quote
  #3  
Old 10-05-2004, 07:59 PM
Starscream's Avatar
Starscream Starscream is offline
 
Join Date: Jun 2004
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #4  
Old 10-05-2004, 08:15 PM
Jolten Jolten is offline
 
Join Date: Mar 2004
Posts: 749
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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");
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:25 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03749 seconds
  • Memory Usage 2,189KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete