View Full Version : PHP code to get user info from my database
MozyMac
07-30-2009, 11:42 AM
I was wondering what's the vbulletin code for fetching the user avatar and his/her user name.
Dismounted
07-30-2009, 12:23 PM
$userinfo = fetch_userinfo($userid, 2);
MozyMac
07-30-2009, 12:38 PM
thanks Dismounted, I wondering how to do this:
i want to make a kind of user avatar gallery, but i don't want it to show all my users but just the ones that want to be shown, any idea how to make this (even if just prototype)
Thanks for quick help :)
James Birkett
07-30-2009, 01:39 PM
You'd have to create user CP permissions so they can select if to show or not. Then you'd have to grab each user's avatar and place them in the gallery.
MozyMac
07-30-2009, 02:00 PM
what about if i let them join a user group and only show pictures for this user group but how can i just show the pictures from a certain user group
--------------- Added 1248979590 at 1248979590 ---------------
guys how should i enter the code?
should i put it in template or php file for the custom vb page
MozyMac
07-31-2009, 04:13 PM
any help here please?
toonysnn
07-31-2009, 05:51 PM
php page. templates won't accept php.
MozyMac
07-31-2009, 06:06 PM
but where should i put it and then what should i put in the template here is the code of the page:
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'imamac'); // change this depending on your filename
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array(
);
// get special data templates from the datastore
$specialtemplates = array(
);
// pre-cache templates used by all actions
$globaltemplates = array(
'imamac',
);
// pre-cache templates used by specific actions
$actiontemplates = array(
);
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################
$navbits = array();
$navbits[$parent] = 'Im a Mac';
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('imamac') . '");');
$userinfo = fetch_userinfo($userid, 2);
$test123 = "test";
echo "$test123";
?>
Dismounted
08-01-2009, 03:58 AM
i want to make a kind of user avatar gallery, but i don't want it to show all my users but just the ones that want to be shown, any idea how to make this (even if just prototype)
Now this is a little more complicated. You'll have to create a query to fetch the avatars (instead of using the function), and join the userfield table to check if it should be shown. This requires more in-depth PHP knowledge, and can't really be done in a short tutorial.
MozyMac
08-01-2009, 04:14 AM
Now this is a little more complicated. You'll have to create a query to fetch the avatars (instead of using the function), and join the userfield table to check if it should be shown. This requires more in-depth PHP knowledge, and can't really be done in a short tutorial.
this could be list the memberlist, ok so I checked my database found usergroup table, know i have to make query to fetch data from certain usergroup using the id as key. is that the correct way?
thanks
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.