BuddyDev

Search

[Resolved] Email message

  • Participant
    Level: Initiated
    Posts: 14
    swati on #8740

    Hi, I am trying buddypress in my local host.

    It’s working fine except some issues.

    1) email notification are not working for the event “New express interest request from XYZ”.
    2) WHen user rejected the other’s friend requested then receipent should get notified by email like “Friend request rejected by xyz”. I didn’t find this option.
    3) Private message button is not working properly.

    Looking for positive response

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #8743

    Hi Swati,
    Welcome to BuddyDev.

    1. What is interest? Is it a custom plugin or code by you? if yes, you can always use wp_mail() top send new email

    2. Something like this should work. Please put it in bp-custom.php and update as you prefer.

    
    
    function buddydev_custom_send_notification_on_friendship_rejection( $friendship_id, BP_Friends_Friendship $friendship ) {
    
    	$initiator_user = get_user_by('id', $friendship->initiator_user_id );
    	$rejected_by_user = get_user_by( 'id', $friendship->friend_user_id );
    
    	$message =<<<'EOT'
    Hi %1$s,
    %2$s has rejected your friendship request.
    
    Team
    Xyz Site
    EOT;
    $message = sprintf( $message, $initiator_user->display_name, $rejected_by_user->display_name );
    	wp_mail($initiator_user->user_email, "Friendship Rejection", $message );
    
    }
    add_action( 'friends_friendship_rejected',  'buddydev_custom_send_notification_on_friendship_rejection', 10, 2 );
    
    

    3. Can you please tell me the issue with the private message button?

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 14
    swati on #8749

    Hi Brajesh Ji,

    Thanks a lot for your response.

    (2) Your code worked, for rejection email, Thanks a lot.
    (1) Ohh sorry, actually the message “[{{{site.name}}}] New express interest request from {{initiator.name}}”, This is not working. The event is “A member has sent a friend request to the recipient.”

    (3) I used the following code for private message button in member loop as given below. It worked fine till the uesr write message. when user click on “send message” button, the message appears as “Message was not sent. Please try again.”

    //This code is for inserting private message button to member loop

    function filter_message_button_link( $link ) {
    $link = wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . ‘/compose/?r=’ . bp_core_get_username( bp_get_member_user_id() ) );
    return $link;
    }

    function display_private_message_button() {
    if( bp_get_member_user_id() != bp_loggedin_user_id() ) {
    bp_send_message_button();
    add_filter(‘bp_get_send_private_message_link’, ‘filter_message_button_link’, 1, 1 );
    }
    }
    add_action( ‘bp_directory_members_item’, ‘display_private_message_button’ );

    Also I used “restrict user access plugin” to allot the different levels to the users. It shows contradict with buddypress, as “Add friend” button not working properly with it. Can you suggest any suitable plugin.

    Looking for your positive response.

    Thank you

  • Participant
    Level: Initiated
    Posts: 14
    swati on #8750

    When the user click on private message button, A popup window with email form should open and user can send message to that particular friend. Is it possible? As right now when I click on private message button, the page redirects to own profile > compose.

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #8768

    Hi Swati,
    Thank you for the details.

    1. My question is still not answered. what is interest? Is it a new component or something else?

    3. Your code is fine. It allows sending message without any issue. The problem seems to be related to something else.

    4. Popup window with email:- Sorry, but we may not be able to help you with that. you can take some inspiration from our BuddyPress extended friendship plugin for how to show popup and provide the message sending functionality. It needs time to implement and right now, I don’t have that.

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 14
    swati on #8786

    Ok.. I will check again my code.

  • Participant
    Level: Initiated
    Posts: 14
    swati on #8819

    Hi Brajesh Ji,

    (3) private message now ok…
    (4) It’s ok…
    (1) I checked again. it is “A member has sent a friend request to the recipient.” The user it not getting email notification for this.

    and another thing, when the recipient rejected the friendship request, then at the sender end the “Add friend” button should be disappear. can we do this?

    Thanks a lot for your valuable time.

  • Participant
    Level: Initiated
    Posts: 14
    swati on #8827

    Hi,
    (1) solved…
    (3) Private message button on member loop:
    I want that, when user click on private message button of respective user, It automatically picked the ID of that user and field “TO” of the message automatically filled.

    I want to remove the line given below from file “custom.php”
    <input type=”text” name=”send-to-input” class=”send-to-input” id=”send-to-input” />
    Instead of it, “To” field of message automatically filled.

    How we can do that.

    Thanks a lot…

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #8898

    Hi Swati,
    that’s good to know.

    The issue you are finding is strange. That is the default behaviour for the private message button.
    Will it be possible for you to share a screenshot?

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 14
    swati on #8919

    Hi Brajesh Ji,

    Screenshot sent on your email.

The topic ‘ [Resolved] Email message’ is closed to new replies.

This topic is: resolved