The function is messages_new_message()
> when an image is denied an email is sent out to the user
So you have a function or some code that does that, yes?
Then you could use parts of the below in that code or call it as a function
`
function bp_send_image_denied_message() {
global $bp;
//check_admin_referer(message_check”); // adjust if needed
$sender_id = $bp->loggedin_user->id; // moderator id ?
$recip_id = $bp->displayed_user->id; // denied image user id ?
if ( $thread_id = messages_new_message( array(‘sender_id’ => $sender_id, ‘subject’ => ‘Image Denied, ‘content’ => ‘why it was denied], ‘recipients’ => $recip_id ) ) ) {
bp_core_add_message( __( ‘Image Denied Message was sent.’, ‘buddypress’ ) );
bp_core_redirect( $bp->displayed_user->domain ); // adjust as needed
} else {
bp_core_add_message( __( ‘There was an error sending that Private Message.’, ‘buddypress’ ), ‘error’ );
}
}
add_action( ‘wp’, ‘bp_send_image_denied_message’, 3 );
`
Thanks so much for that, it’s used within a plugin so I used:
`
function bp_send_image_denied_message($sender_id, $recip_id, $subject, $message) {
global $bp;
if ( $thread_id = messages_new_message( array(‘sender_id’ => $sender_id, ‘subject’ => $subject, ‘content’ => $message, ‘recipients’ => $recip_id ) ) ) {
bp_core_add_message( __( ‘Image Denied Message was sent.’, ‘buddypress’ ) );
} else {
bp_core_add_message( __( ‘There was an error sending that Private Message.’, ‘buddypress’ ), ‘error’ );
}
} `
and pass the required bits, the only thing it’s not doing is adding a notification item, is there an easy way to add that?
Again, thanks a lot, I would have spent ages trying to figure that out.
Ignore that, I had a look at the messages_new_message function and realised it should be sending a notification so I guessed the issue was I was testing using the same id for uploader and denyer, i changed to another uploader and it worked perfectly