diff --git a/src/bp-activity/bp-activity-actions.php b/src/bp-activity/bp-activity-actions.php
index 17f23e6..aac216a 100644
a
|
b
|
function bp_ajax_get_suggestions() { |
753 | 753 | exit; |
754 | 754 | } |
755 | 755 | |
756 | | $results = bp_core_get_suggestions( array( |
| 756 | $args = array( |
757 | 757 | 'term' => sanitize_text_field( $_GET['term'] ), |
758 | 758 | 'type' => sanitize_text_field( $_GET['type'] ), |
759 | | ) ); |
| 759 | ); |
| 760 | |
| 761 | // Support per-Group suggestions. |
| 762 | if ( ! empty( $_GET['group-id'] ) ) { |
| 763 | $args['group_id'] = absint( $_GET['group-id'] ); |
| 764 | } |
| 765 | |
| 766 | $results = bp_core_get_suggestions( $args ); |
760 | 767 | |
761 | 768 | if ( is_wp_error( $results ) ) { |
762 | 769 | wp_send_json_error( $results->get_error_message() ); |
diff --git a/src/bp-activity/js/mentions.js b/src/bp-activity/js/mentions.js
index 2afe163..b5f76b4 100644
a
|
b
|
|
151 | 151 | * @since BuddyPress (2.1.0) |
152 | 152 | */ |
153 | 153 | remote_filter: function( query, render_view ) { |
154 | | var self = $( this ); |
| 154 | var self = $( this ), |
| 155 | params = {}; |
155 | 156 | |
156 | 157 | mentionsItem = mentionsQueryCache[ query ]; |
157 | 158 | if ( typeof mentionsItem === 'object' ) { |
… |
… |
|
163 | 164 | self.xhr.abort(); |
164 | 165 | } |
165 | 166 | |
166 | | self.xhr = $.getJSON( ajaxurl, { 'action': 'bp_get_suggestions', 'term': query, 'type': 'members' } ) |
| 167 | params = { 'action': 'bp_get_suggestions', 'term': query, 'type': 'members' }; |
| 168 | |
| 169 | if ( $.isNumeric( this.$inputor.data( 'suggestions-group-id' ) ) ) { |
| 170 | params['group-id'] = parseInt( this.$inputor.data( 'suggestions-group-id' ), 10 ); |
| 171 | } |
| 172 | |
| 173 | self.xhr = $.getJSON( ajaxurl, params ) |
167 | 174 | /** |
168 | 175 | * Success callback for the @suggestions lookup. |
169 | 176 | * |
diff --git a/src/bp-groups/bp-groups-filters.php b/src/bp-groups/bp-groups-filters.php
index 9e66f3d..b0e4030 100644
a
|
b
|
function groups_filter_forums_root_page_sql( $sql ) { |
233 | 233 | return apply_filters( 'groups_filter_bbpress_root_page_sql', 't.topic_id' ); |
234 | 234 | } |
235 | 235 | add_filter( 'get_latest_topics_fields', 'groups_filter_forums_root_page_sql' ); |
| 236 | |
| 237 | /** |
| 238 | * Should BuddyPress load the mentions scripts and related assets, including results to prime the |
| 239 | * mentions suggestions? |
| 240 | * |
| 241 | * @param bool $load_mentions True to load mentions assets, false otherwise. |
| 242 | * @param bool $mentions_enabled True if mentions are enabled. |
| 243 | * @return bool True if mentions scripts should be loaded. |
| 244 | * @since BuddyPress (2.2.0) |
| 245 | */ |
| 246 | function bp_groups_maybe_load_mentions_scripts( $load_mentions, $mentions_enabled ) { |
| 247 | if ( ! $mentions_enabled ) { |
| 248 | return $load_mentions; |
| 249 | } |
| 250 | |
| 251 | if ( $load_mentions || ( bp_is_group_activity() || bp_is_group_home() ) ) { |
| 252 | return true; |
| 253 | } |
| 254 | |
| 255 | return $load_mentions; |
| 256 | } |
| 257 | add_filter( 'bp_activity_maybe_load_mentions_scripts', 'bp_groups_maybe_load_mentions_scripts', 10, 2 ); |
diff --git a/src/bp-templates/bp-legacy/buddypress/activity/post-form.php b/src/bp-templates/bp-legacy/buddypress/activity/post-form.php
index a45213a..df0dc9c 100644
a
|
b
|
|
27 | 27 | |
28 | 28 | <div id="whats-new-content"> |
29 | 29 | <div id="whats-new-textarea"> |
30 | | <textarea class="bp-suggestions" name="whats-new" id="whats-new" cols="50" rows="10"><?php if ( isset( $_GET['r'] ) ) : ?>@<?php echo esc_textarea( $_GET['r'] ); ?> <?php endif; ?></textarea> |
| 30 | <textarea class="bp-suggestions" name="whats-new" id="whats-new" cols="50" rows="10" |
| 31 | <?php |
| 32 | if ( bp_is_group() ) : ?>data-suggestions-group-id="<?php echo esc_attr( (int) bp_get_current_group_id() ); ?>" <?php endif; |
| 33 | if ( isset( $_GET['r'] ) ) : ?>@<?php echo esc_textarea( $_GET['r'] ); ?> <?php endif; |
| 34 | ?> |
| 35 | ></textarea> |
31 | 36 | </div> |
32 | 37 | |
33 | 38 | <div id="whats-new-options"> |