/** * Initialize the messages template loop for a specific thread. * * @param array|string $args { * Array of arguments. All are optional. * @type int $thread_id ID of the thread whose messages you are displaying. * Default: if viewing a thread, the thread ID will be parsed from * the URL (bp_action_variable( 0 )). * @type string $order 'ASC' or 'DESC'. Default: 'ASC'. * @type bool $update_meta_cache Whether to pre-fetch metadata for * queried message items. Default: true. * } * @return bool True if there are messages to display, otherwise false. */ function bp_thread_has_messages($args = '') { global $thread_template; $r = bp_parse_args($args, array('thread_id' => false, 'order' => 'ASC', 'update_meta_cache' => true), 'thread_has_messages'); if (empty($r['thread_id']) && bp_is_messages_component() && bp_is_current_action('view')) { $r['thread_id'] = (int) bp_action_variable(0); } // Set up extra args. $extra_args = $r; unset($extra_args['thread_id'], $extra_args['order']); $thread_template = new BP_Messages_Thread_Template($r['thread_id'], $r['order'], $extra_args); return $thread_template->has_messages(); }
/** * Initialize the messages template loop for a specific thread. * * @param array $args { * Array of arguments. All are optional. * @type int $thread_id ID of the thread whose messages you are displaying. * Default: if viewing a thread, the thread ID will be parsed from * the URL (bp_action_variable( 0 )). * @type string $order 'ASC' or 'DESC'. Default: 'ASC'. * } * @return bool True if there are messages to display, otherwise false. */ function bp_thread_has_messages($args = '') { global $thread_template; $r = bp_parse_args($args, array('thread_id' => false, 'order' => 'ASC'), 'thread_has_messages'); if (empty($r['thread_id']) && bp_is_messages_component() && bp_is_current_action('view')) { $r['thread_id'] = (int) bp_action_variable(0); } $thread_template = new BP_Messages_Thread_Template($r['thread_id'], $r['order']); return $thread_template->has_messages(); }
function bp_thread_has_messages($args = '') { global $thread_template; $defaults = array('thread_id' => false, 'order' => 'ASC'); $r = wp_parse_args($args, $defaults); extract($r, EXTR_SKIP); if (empty($thread_id) && bp_is_messages_component() && bp_is_current_action('view')) { $thread_id = (int) bp_action_variable(0); } $thread_template = new BP_Messages_Thread_Template($thread_id, $order); return $thread_template->has_messages(); }
function bp_thread_has_messages( $args = '' ) { global $bp, $thread_template, $group_id; $defaults = array( 'thread_id' => false, 'order' => 'ASC' ); $r = wp_parse_args( $args, $defaults ); extract( $r, EXTR_SKIP ); if ( !$thread_id && $bp->current_component == BP_MESSAGES_SLUG && 'view' == $bp->current_action ) $thread_id = (int)$bp->action_variables[0]; $thread_template = new BP_Messages_Thread_Template( $thread_id, $order ); return $thread_template->has_messages(); }