Send Private Static Message
- 
		I need to add a button on single profile pages. 
 The button will send a private message to the user being viewed – but the message is preordained.
 (It’s a promotional thing)
 So we don’t want to go to a compose page – just send the message.In member-header.php, I add a button: 
 `` In bp-custom, I add the functions: 
 `
 function bp_send_private_grrr_link() {
 echo bp_get_send_private_bzzzt_link();
 }
 function bp_get_send_private_bzzzt_link() {
 global $bp;if ( bp_is_my_profile() || !is_user_logged_in() ) 
 return false;return apply_filters( ‘bp_get_send_private_bzzzt_link’, bp_send_private_bzzzt() ); 
 }function bp_send_private_grrr() { 
 $subject = ” I just sent you a BZZT!”;
 messages_new_message( array(‘sender_id’ => 1, ‘subject’ => $subject, ‘content’ => “BZZT!”, ‘recipients’ => 9) );
 // sender_id & recipients hard-coded for testing
 }
 `The above will send a message – But it does so as soon as a profile page is loaded. How can I stop the message from being sent until the “Send a BZZZT!” button is clicked ? 
- The topic ‘Send Private Static Message’ is closed to new replies.