vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Custom profile field and username on its own page. (https://vborg.vbsupport.ru/showthread.php?t=89871)

Starscream 10-04-2004 02:14 AM

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

Jolten 10-04-2004 07:08 AM

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.

Starscream 10-05-2004 07:59 PM

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

Jolten 10-05-2004 08:15 PM

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
  • Page Generation 0.00987 seconds
  • Memory Usage 1,716KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete