/** * Get accounts from db * * @param string $type Type of account (=site) * @return array */ public static function get_accounts_object($type) { global $wpdb; $table_accounts = $wpdb->prefix . 'microblogposter_accounts'; $table_user_accounts = $wpdb->prefix . 'microblogposter_user_accounts'; $sql = "SELECT * FROM {$table_accounts} WHERE type='{$type}'"; if (MicroblogPoster_Poster::is_method_callable('MicroblogPoster_Poster_Ultimate', 'resolve_sql')) { $sql .= MicroblogPoster_Poster_Ultimate::resolve_sql(); } else { $sql .= " AND account_id NOT IN (SELECT DISTINCT account_id FROM {$table_user_accounts})"; } $rows = $wpdb->get_results($sql); return $rows; }