• Hi. How do I make an automated message using this plugin? The scenario is this, after viewing the profile of a member, there is a private message button there, I want to send a pre made message after clicking the button without redirecting to compose message. Is it possible? And how?

    • This topic was modified 5 years, 6 months ago by iamallysa.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author wordplus

    (@wordplus)

    Hi there!

    This is example how to send message on any action:

    https://www.wordplus.org/knowledge-base/how-to-add-welcome-message-for-new-users/

    Thread Starter iamallysa

    (@iamallysa)

    @wordplus Thank you for your time replying this issue. Is there a way to do that with other users messaging another user?

    Plugin Author wordplus

    (@wordplus)

    Yes, you can use same function. Just change sender and recipient to the users you need.

    Thread Starter iamallysa

    (@iamallysa)

    Thank you @wordplus !

    But is it possible when I click the private message button, it will work?
    Sorry if I have many questions as I’m just new in this buddypress plugin.

    Plugin Author wordplus

    (@wordplus)

    Plugin replace private message button automatically.

    Thread Starter iamallysa

    (@iamallysa)

    @wordplus here’s my code. my function seems to not working, are there ways to make this work? Thanks!

    button submit function
    ——-
    function mapbtn_quickmessage_button() {
    echo ‘<button type=”submit” onclick=”sendQuickMessage()” title=”Send a quick message” class=”btn-message”><i class=”fa fa-comments”></i></button>’;
    }
    add_filter( ‘bp_before_member_header_meta’, ‘mapbtn_quickmessage_button’ );

    send message function
    ———
    function bp_messages_private_message( $user_id, $key, $user ){
    if ( ! function_exists( ‘messages_new_message’ ) ) return false;

    $args = array(
    ‘sender_id’ => bp_loggedin_user_id(), // message sender user ID
    ‘thread_id’ => false, // leave always false to create new thread
    ‘recipients’ => $user_id,
    ‘subject’ => ‘Hi!’, // Put here your subject
    ‘content’ => ‘Hi! How are you?’, // Put here your message
    ‘date_sent’ => bp_core_current_time()
    );

    $result = messages_new_message( $args );
    }

    add_action(‘mapbtn_quickmessage_button’, ‘bp_messages_private_message’, 10, 3);

    Plugin Author wordplus

    (@wordplus)

    Hi there!

    What is JavaScript code you are using also?

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Automated Message’ is closed to new replies.