bp_dtheme_ajax_messages_send_reply

Send a private message reply to a thread via a POST request.

Description

(string) bp_dtheme_ajax_messages_send_reply(); 

Returns (string)

HTML


Usage

  1. if ( !function_exists( 'bp_dtheme_ajax_messages_send_reply' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-themes/bp-default/_inc/ajax.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_dtheme_ajax_messages_send_reply(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-themes/bp-default/_inc/ajax.php  
  1. function bp_dtheme_ajax_messages_send_reply() { 
  2. // Bail if not a POST action 
  3. if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 
  4. return; 
  5.  
  6. check_ajax_referer( 'messages_send_message' ); 
  7.  
  8. $result = messages_new_message( array( 'thread_id' => (int) $_REQUEST['thread_id'], 'content' => $_REQUEST['content'] ) ); 
  9.  
  10. if ( $result ) { ?> 
  11. <div class="message-box new-message"> 
  12. <div class="message-metadata"> 
  13. <?php echo bp_loggedin_user_avatar( 'type=thumb&width=30&height=30' ); ?> 
  14.  
  15. <strong><a href="<?php echo bp_loggedin_user_domain(); ?>"><?php bp_loggedin_user_fullname(); ?></a> <span class="activity"><?php printf( __( 'Sent %s', buddypress ), bp_core_time_since( bp_core_current_time() ) ); ?></span></strong> 
  16.  
  17. </div> 
  18.  
  19.  
  20. <div class="message-content"> 
  21. <?php echo stripslashes( apply_filters( 'bp_get_the_thread_message_content', $_REQUEST['content'] ) ); ?> 
  22. </div> 
  23.  
  24.  
  25. <div class="clear"></div> 
  26. </div> 
  27. <?php 
  28. } else { 
  29. echo "-1<div id='message' class=error><p>" . __( 'There was a problem sending that reply. Please try again.', buddypress ) . '</p></div>'; 
  30.  
  31. exit;