public static function instance() { if (!isset(self::$instance)) { self::$instance = new DLNPlugin(); self::$instance->constants(); self::$instance->includes(); self::$instance->setup_globals(); } return self::$instance; }
/** * Fetches all the notifications in the database for a specific user. * * @global BuddyPress $bp The one true BuddyPress instance * @global wpdb $wpdb WordPress database object * @param integer $user_id User ID * @param string $status 'is_new' or 'all' * @return array Associative array * @static */ function get_all_for_user($user_id, $status = 'is_new') { global $wpdb; $dln = DLNPlugin::instance(); $is_new = 'is_new' == $status ? ' AND is_new = 1 ' : ''; return $wpdb->get_results($wpdb->prepare("SELECT * FROM {$dln->core->table_name_notifications} WHERE user_id = %d {$is_new}", $user_id)); }