BETTER CODE for $item_count
-
Hi Larry,
Great plugin! I am using it and very nice work. Though, I just noticed some better tweaks on the codes for the item_count variable:
$query = "SELECT count(*) FROM <code>".$wpdb->prefix."users</code> u LEFT JOIN <code>".$wpdb->prefix."usermeta</code> um ON u.ID=um.user_id "; $query .= "WHERE um.meta_key = '".$wpdb->prefix."capabilities' AND ("; foreach ($this->options['display_roles'] as $key => $value) { if ($value) $query .= " um.meta_value LIKE '%".$key."%' OR"; } $query = substr($query, 0, strlen($query) - 3).") "; $count = $wpdb->get_var($query); $item_count = $count.' vendor'; if ($count !=1) $item_count .= 's';
Hope this helps.:) and thank you very much for this plugin.
- The topic ‘BETTER CODE for $item_count’ is closed to new replies.