bp_activity_filter_mentions_scope( array $retval = array(), array $filter = array() )
Set up activity arguments for use with the ‘favorites’ scope.
Description
Parameters
- $retval
-
(Optional) Empty array by default.
Default value: array()
- $filter
-
(Optional) Current activity arguments.
Default value: array()
Return
(array) $retval
Source
File: bp-activity/bp-activity-filters.php
1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 | function bp_activity_filter_mentions_scope( $retval = array (), $filter = array () ) { // Are mentions disabled? if ( ! bp_activity_do_mentions() ) { return $retval ; } // Determine the user_id. if ( ! empty ( $filter [ 'user_id' ] ) ) { $user_id = $filter [ 'user_id' ]; } else { $user_id = bp_displayed_user_id() ? bp_displayed_user_id() : bp_loggedin_user_id(); } // Should we show all items regardless of sitewide visibility? $show_hidden = array (); if ( ! empty ( $user_id ) && $user_id !== bp_loggedin_user_id() ) { $show_hidden = array ( 'column' => 'hide_sitewide' , 'value' => 0 ); } $retval = array ( 'relation' => 'AND' , array ( 'column' => 'content' , 'compare' => 'LIKE' , // Start search at @ symbol and stop search at closing tag delimiter. 'value' => '@' . bp_activity_get_user_mentionname( $user_id ) . '<' ), $show_hidden , // Overrides. 'override' => array ( 'display_comments' => bp_show_streamed_activity_comment()? 'stream' : 'threaded' , 'filter' => array ( 'user_id' => 0 ), 'show_hidden' => true ), ); return $retval ; } |
Changelog
Version | Description |
---|---|
BuddyPress 2.2.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.