vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Create a Seperate Page for Custom Profile Fields (https://vborg.vbsupport.ru/showthread.php?t=70089)

Starscream 10-02-2004 07:26 AM

Create a Seperate Page for Custom Profile Fields
 
I have searched around and have been unable to find an answer to my question. Forgive me if I missed it somewhere.

How would I go about creating a page that displays only the username and custom profile field of all the users on my site? I only want the User to show up on the list if he has that profile field filled out.

Basically, what I want to do is have a page where users can go to see all the other members profile field. For example: If I create a field for Xbox Live Gamertags and users fill it out, I want other members to see it on a seperate page called Xbox Gamertags.

Is this possible? Has this been done? Any help would be greatly appreciated.

Thanks

Starscream 10-03-2004 05:11 PM

I know it would be similar to memberlist, I'm just not sure how to make users only show if they have that profile feild filled out.

Starscream 10-06-2004 04:16 AM

This is what I have as far as the php file is concerned. It's wrong, but it's a start - I think. I also have made two templates which I can post if they would help.

PHP Code:

<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS'1);
define('THIS_SCRIPT''GTList');

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// pre-cache templates used by all actions
$globaltemplates = array(
'GTLIST'
'GT_listbit
);

// pre-cache templates used by specific actions
$actiontemplates = array();

// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

########################################################################

    $users = $DB_site->query("
        SELECT user.*,usertextfield.*,userfield.*, user.userid, options,
            IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid

$GT = $DB_site->query("SELECT user.userid, user.username, usertextfield.userid, usertextfield.field5 FROM users, usertextfield WHERE user.userid == usertextfield.userid ORDER BY user.username DESC");
  

// pre-cache templates used by specific actions
$actiontemplates = array();

// ######################### REQUIRE BACK-END ############################
require_once('
./global.php');

// ### ALL DONE! SPIT OUT THE HTML AND LET'
S GET OUTA HERE... ###

  
while($row=mysql_fetch_object($GT))
{
    
    
$who $row->username;
    
$gtname $row->field5;

eval(
'$gtbit = "' fetch_template('GT_listbit') . '";');

}

eval(
'print_output("' fetch_template('GTLIST') . '");');

eval(
'$navbar = "' fetch_template('navbar') . '";');

I'm pretty sure this is disorganized and somethings are incorrectly placed, but I am new to this and have very little idea of where things go.

Please help! Thanks.

edited - made some changes but not fixed

Colin F 10-06-2004 04:25 AM

I'd advise to move this part near the top:
Code:

// pre-cache templates used by all actions
$globaltemplates = array(
'GTLIST'
'GT_listbit
);

// pre-cache templates used by specific actions
$actiontemplates = array();

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

Especially because without the global.php you won't be able to use the object $DB_site


Then, you'll also need to move this:
Code:

  while($row=mysql_fetch_object($GT))
{
   
    $who = $row->username;
    $gtname = $row->field5;

eval('$gtbit = "' . fetch_template('GT_listbit') . '";');

}

eval('print_output("' . fetch_template('GTLIST') . '");');

further down, as that has to be able to use $GT, which you only define later on.

And lastly, it won't help doing two queries if they both have the same varname, as the second will overwrite the first.
You might try to just use on query.


I'll post an edited version if I have time later on, gotta go now :)

Starscream 10-06-2004 05:58 AM

Thanks for your help. I think I am slowly beginning to understand (or, at least, I'm trying to understand).

Colin F 10-06-2004 07:24 AM

I haven't checked the SQL syntax, but here's your code, cleaned up a bit more:

PHP Code:

<?php 
// ####################### SET PHP ENVIRONMENT ########################### 
error_reporting(E_ALL & ~E_NOTICE); 

// #################### DEFINE IMPORTANT CONSTANTS ####################### 
define('NO_REGISTER_GLOBALS'1); 
define('THIS_SCRIPT''GTList'); 

// ######################### REQUIRE BACK-END ############################ 
require_once('./global.php'); 

// ################### PRE-CACHE TEMPLATES AND DATA ###################### 
// pre-cache templates used by all actions 
$globaltemplates = array( 
'GTLIST' 
'GT_listbit 
); 

// pre-cache templates used by specific actions 
$actiontemplates = array(); 

// get special phrase groups 
$phrasegroups = array(); 

// get special data templates from the datastore 
$specialtemplates = array(); 


eval('
$navbar "' . fetch_template('navbar') . '";'); 
//######################################################################## 

$GT = $DB_site->query("SELECT user.userid, user.username, usertextfield.userid, usertextfield.field5 FROM users, usertextfield WHERE user.userid == usertextfield.userid ORDER BY user.username DESC"); 
   

while($row=$DB_site->fetch_array($GT)) 

     
    $who = $row['
username']; 
    $gtname = $row['
field5']; 

    eval('
$gtbit .= "' . fetch_template('GT_listbit') . '";'); 



eval('
print_output("' . fetch_template('GTLIST') . '");');?

?>



All times are GMT. The time now is 07:10 AM.

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.01224 seconds
  • Memory Usage 1,744KB
  • 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
  • (2)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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