- Timestamp:
- 05/06/2015 11:42:53 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-templates/bp-legacy/buddypress-functions.php
r9838 r9846 177 177 'messages_send_reply' => 'bp_legacy_theme_ajax_messages_send_reply', 178 178 ); 179 180 // Conditional actions 181 if ( bp_is_active( 'messages', 'star' ) ) { 182 $actions['messages_star'] = 'bp_legacy_theme_ajax_messages_star_handler'; 183 } 179 184 180 185 /** … … 308 313 wp_enqueue_script( $asset['handle'] . '-password-verify', $asset['location'], $dependencies, $this->version); 309 314 } 315 316 // Star private messages 317 if ( bp_is_active( 'messages', 'star' ) && bp_is_user_messages() ) { 318 wp_localize_script( $asset['handle'], 'BP_PM_Star', array( 319 'strings' => array( 320 'text_unstar' => __( 'Unstar', 'buddypress' ), 321 'text_star' => __( 'Star', 'buddypress' ), 322 'title_unstar' => __( 'Starred', 'buddypress' ), 323 'title_star' => __( 'Not starred', 'buddypress' ), 324 'title_unstar_thread' => __( 'Remove all starred messages in this thread', 'buddypress' ), 325 'title_star_thread' => __( 'Star the first message in this thread', 'buddypress' ), 326 ), 327 'is_single_thread' => (int) bp_is_messages_conversation(), 328 'star_counter' => 0, 329 'unstar_counter' => 0 330 ) ); 331 } 310 332 } 311 333 … … 1688 1710 exit; 1689 1711 } 1712 1713 /** 1714 * AJAX callback to set a message's star status. 1715 * 1716 * @since BuddyPress (2.3.0) 1717 */ 1718 function bp_legacy_theme_ajax_messages_star_handler() { 1719 if ( false === bp_is_active( 'messages', 'star' ) || empty( $_POST['message_id'] ) ) { 1720 return; 1721 } 1722 1723 // Check nonce 1724 check_ajax_referer( 'bp-messages-star-' . (int) $_POST['message_id'], 'nonce' ); 1725 1726 // Check capability 1727 if ( ! is_user_logged_in() || ! bp_core_can_edit_settings() ) { 1728 return; 1729 } 1730 1731 if ( true === bp_messages_star_set_action( array( 1732 'action' => $_POST['star_status'], 1733 'message_id' => (int) $_POST['message_id'], 1734 'bulk' => ! empty( $_POST['bulk'] ) ? true : false 1735 ) ) ) { 1736 echo '1'; 1737 die(); 1738 } 1739 1740 echo '-1'; 1741 die(); 1742 }
Note: See TracChangeset
for help on using the changeset viewer.