I am trying your suggest code but no any result.
1st i add below code in theme functions.php & then user-items.php but no luck.
<?php function bet_item_stats( $item_id ) {
if( $item_id <> '' ) {
$db_prefix = DB_TABLE_PREFIX;
//$query = "SELECT sum(coalesce(i_num_phone_clicks, 0)) as phone_clicks FROM {$db_prefix}t_item_stats_beta s WHERE fk_i_item_id = " . $item_id . ";";
$query = "SELECT sum(b_enabled) as enabled, sum(b_spam) as spam, sum(b_active), count(pk_i_id) as total_ads_active FROM oc_t_item WHERE fk_i_user_id = " . $user_id .";";
$result = ItemStats::newInstance()->dao->query( $query );
if( !$result ) {
$prepare = array();
return '0';
} else {
$prepare = $result->row();
if($prepare['total_ads_active'] <> '') {
return $prepare['total_ads_active'];
} else {
return '0';
}
}
}
}
?>
<?php echo $total_ads_active; ?> or <?php echo bet_item_stats(); ?>
this code not any output. pls have a look in code, might be coding error.
Also, currently i am used below code & its show only active ads count but not spam, block.
<?php
if( osc_is_web_user_logged_in() ) {
$user_id = osc_logged_user_id();
}
$user = User::newInstance()->findByPrimaryKey($user_id);
$num_items_user = $user['i_items'];
echo $num_items_user;
?>