viewData['request']; if(is_user_logged_in()){ //this block checks whether the user is logged in and already has an affiliate account global $wpdb; $current_user = wp_get_current_user(); $user_id = $current_user->ID; $query = "SELECT * FROM ".WPAM_AFFILIATES_TBL." WHERE userId = %d"; $affiliate = $wpdb->get_row($wpdb->prepare($query, $user_id)); if($affiliate != null) { //The affiliate has an account already _e("Looks like you already have an affiliate account. So you don't need to register again. Simply go to the affiliate portal and start referring users.", 'affiliates-manager'); return; } } ?>