Database interactions, what’s the right way?
- 
		I’ve got a member header with some general stats inside. One of which is a profile completion percentage. In order to achieve this, I’ve done the following inside member-header.php <?php global $bp, $wpdb; $user_id = $bp->displayed_user->id; $total_rows = count($wpdb->get_results("SELECT DISTINCT object_id FROM wp_bp_xprofile_meta")); $total_completed = count($wpdb->get_results("SELECT DISTINCT field_id FROM wp_bp_xprofile_data WHERE user_id = $user_id")) - 1; // Minus one for Base profile field. $percentage = number_format($total_completed / $total_rows * 100, 0); ?>Then just echo $percentage.Will this affect the overall performance of my BuddyPress installation, if so when? Why? and what’s the better way to achieve this? For now, I’m happy with it. 
Viewing 3 replies - 1 through 3 (of 3 total)
	
Viewing 3 replies - 1 through 3 (of 3 total)
	
- You must be logged in to reply to this topic.