MyBB Community Forums

Full Version: Extra statistics of custom fields
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
anybody interested in this thing?
ZAHER, help!!!
zahers mo has this code:
//total males
$tm_q = $db->query("SELECT count( * ) AS fid FROM ".TABLE_PREFIX."userfields WHERE fid3 = '".$lang->male."'");
while($tm_f = $db->fetch_array($tm_q))
{
	$tmale = $tm_f['fid'];
}
if($tmale > '1' || $tmale == '0')
	{
		$add_sex_ms = "s";
	}
//total Undisclosed
$tu_q = $db->query("SELECT count( * ) AS fid FROM ".TABLE_PREFIX."userfields WHERE fid3 = '".$lang->undisclosed."' OR fid3 = '".$lang->other."' ");
while($tu_f = $db->fetch_array($tu_q))
{
	$tundi = $tu_f['fid'];
}
//total Females
$tf_q = $db->query("SELECT count( * ) AS fid FROM ".TABLE_PREFIX."userfields WHERE fid3 = '".$lang->female."'");
while($tf_f = $db->fetch_array($tf_q))
{
	$tfem = $tf_f['fid'];
}
 if($tfem > '1' || $tfem == '0')
	{
		$add_sex_fs = $lang->s;

what should i edit and where should i put this code? in a new file?
I don't know where Zaher went. He's been gone for a while.
yes, but maybe someone else could help me?
I've work out 1ex. Don't know what fid the select box has, but you probably need to change that "fid3" too.

$name = "Toyota Yaris";

//Total x Cars
$total = $db->query("SELECT count( * ) AS fid FROM ".TABLE_PREFIX."userfields WHERE fid3 = '".$name."'");
$tot = $db->fetch_field($total, fid);
if($tot == 1)
{
	$cars_x = $tot." ".$name." Car.";
}
else
{
	$cars_x = $tot." ".$name." Cars.";
}
LeX- Wrote:I've work out 1ex. Don't know what fid the select box has, but you probably need to change that "fid3" too.

that field has 1 ID (fid1) What else should I edit? and where should I put this code? in zaher's mod file or into separate one?

$name = "Toyota Yaris";

//Total x Cars
$total = $db->query("SELECT count( * ) AS fid FROM ".TABLE_PREFIX."userfields WHERE fid1 = '".$name."'");
$tot = $db->fetch_field($total, fid);
if($tot == 1)
{
	$cars_x = $tot." ".$name." Car.";
}
else
{
	$cars_x = $tot." ".$name." Cars.";
}
Can you try the attached file ?
It's a "plugin", the only variable in the file is the $fid , but the $fid is 1 you've told me already so i've filled it in for you. Just upload to your inc/plugins/ folder and activate!
When activating, there will be a new template created, along with a templatechange in the stats page. So when you visit the Forum Statistics, you will see the "extra stats" from that customfield.

[Image: ses.jpg]

I've used the examples for filling the selectbox you gave in previous posts and selected one in my UCP - options. With result ... see the image above.
Pages: 1 2