View Full Version : put profile field out in widget
claudib
01-03-2010, 10:50 PM
Hi,
How can I put a profile field out in a widget?
I am putting out username etc, but I also want to put out field6 which is a custom field?
Thanks
Claudia
Lynne
01-03-2010, 11:55 PM
What type of widget? Post the code you are currently using and let us know what template it is currently using and if it is a default template.
claudib
01-04-2010, 09:59 AM
Hi,
This is my widget code so far:
$dateformat = "m/d"; //Other formats "m/d/Y", "d/m", "d/m/Y"
ob_start();
require_once('./includes/functions_user.php');
require_once('./includes/functions_bigthree.php');
// Get New Members
$newusers_get = vB::$db->query_read("
SELECT * FROM ".TABLE_PREFIX."user
WHERE usergroupid=9
ORDER BY joindate DESC
LIMIT 5");
$output_bits = '';
while($newuser = vB::$db->fetch_array($newusers_get))
{
$joindate = date($dateformat, $newuser[joindate]);
$avatarurl = fetch_avatar_url($newuser[userid]);
if (!$avatarurl) {
$useravatar = 'images/misc/avatar.gif';
} else {
$useravatar = $avatarurl[0];
}
$output_bits .= '<img border="0" src="'.$useravatar.'"><br />
<a href="member.php?u='.$newuser[userid].'">'.$newuser[username].'</a> in {vb:raw post.field6} <div style="float: right;">'.$joindate.'</div><br />';
}
$output = $output_bits;
ob_end_clean();
The part - {vb:raw post.field6} - does not work. I've been trying various things to get it to work to no avail.
Thanks
Lynne
01-04-2010, 02:26 PM
Two things.... your query is not getting the profile field - it is in the userfield table. You will have to JOIN with that table in your query in order to get it. Secondly, post is certainly not going to work because that is not the name of your array. Your array name is newuser, so it would be $newuser[field6] once you correct your query.
claudib
01-04-2010, 02:59 PM
Thanks Lynne. I understand the second part. I don't know how to JOIN in my query, but you have given me something to try to investigate further so I can learn how to do it.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.