๐Ÿ‘ป Halloween Treat: Our biggest-ever 25% OFF memberships โ€” use SPOOKYSOCIAL before Nov 1! ๐ŸŽƒ

BuddyDev

Search

disable the rtmedia comment action in the post until the users are become friend

Tagged: ,

  • Participant
    Level: Enlightened
    Posts: 27
    John Elmer on #41166

    Hi Guys!

    Is possible to disable the rtmedia comment action in the post until the users are become friends?

    THANK YOU!!!

  • Keymaster
    (BuddyDev Team)
    Posts: 25188
    Brajesh Singh on #41169

    Hi John,
    I am sorry, we are not using RT Media. So, I and my team may not be able to assist with it. I hope that someone form the community is able to help you.

    It should not be difficult as you can check on the $activity_type from this function.

    https://buddydev.com/support/forums/topic/disable-the-comment-action-until-the-users-are-become-friends/#post-41152

    Or, if you can tell me their activity type(is it rtm_update?), I can assist with the code.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 27
    John Elmer on #41176

    Hi Brajesh,

    I really appreciate your help.Looks like is rtmedia_update

    In their documentation they have this:

    Adding rtMedia updates to activity show dropdown
    Notes: Starting version 4.2.1, this functionality does not require a filter as this code has been moved to rtMedia Core

    If you want to add or rename rtMedia updates in activityโ€™s show dropdown, use the following piece of code in your function.php file:
    add_filter(‘bp_get_activity_show_filters_options’, ‘add_media_show_filter’, 10, 2);

    function add_media_show_filter( $filters, $context ){
    $filters[‘rtmedia_update’] = ‘rtMedia Updates’;
    return $filters;
    }
    OR

    Use this code: if you are using old buddypress templates in your theme.

    add_action( ‘bp_activity_filter_options’, ‘rtmedia_update_filter’ );

    function rtmedia_update_filter() {
    echo ‘<option value=”rtmedia_update”>rtMedia Updates</option>’;
    }

    Thank you so much!

  • Participant
    Level: Enlightened
    Posts: 27
    John Elmer on #41177
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 25188
    Brajesh Singh on #41219

    Hi John,
    Sorry for the delay.

    Here is the code for hiding the update.

    
    add_filter( 'bp_activity_can_comment', function ( $can, $activity_type ) {
    
    	// already protected, return.
    	if ( ! $can || 'rtmedia_update' !== $activity_type ) {
    		return $can;
    	}
    
    	$logged_user_id   = get_current_user_id();
    	$activity_user_id = bp_get_activity_user_id();
    
    	// if not user's own activity, or not super admin
    	// and the current user is not friends with the activity user, disable comment.
    	if ( $logged_user_id != $activity_user_id &&
    	     ! is_super_admin() && function_exists( 'friends_check_friendship' ) &&
    	     ! friends_check_friendship( $logged_user_id, $activity_user_id )
    	) {
    		$can = false;
    	}
    
    	return $can;
    }, 20, 2 );
    
    

    About MediaPress:- We love when people use MediaPress but we do not recommend switching to it just due to one rating addon. I will recommend sticking with whatever plugin you are using if that works for most of the features. That will create less friction for your members.

    Regards
    Brajes

  • Participant
    Level: Enlightened
    Posts: 27
    John Elmer on #41240

    Hi Brajesh,

    the rtmedia is not working. Is this code to disable the rtmedia comment action in the rtmedia posts or is for the activity? I need it for the posts area.

    I was trying your plugin but it was breaking my site ๐Ÿ™ My problem with rtmedia is the support. I have not idea anything about coding and they are not helpfull at all. I got a issue with them and they did not resolve it. The solution was returning my money back for that add on…

    Thank you!

  • Participant
    Level: Enlightened
    Posts: 27
  • Keymaster
    (BuddyDev Team)
    Posts: 25188
    Brajesh Singh on #41275

    Hi John,
    I am sorry, I am unable to comment where it will stop the comment. That will depend where that activity type is being used.

    I lack the time to test install RT Media and test it due to my current work. I hope you can give the above code to RT media people or someone using RT media to get assistance.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 27
    John Elmer on #41278

    Thank you!

    I really appreciate your coperation! ๐Ÿ™‚

    take care!

    • This reply was modified 4 years ago by John Elmer.
  • Keymaster
    (BuddyDev Team)
    Posts: 25188
    Brajesh Singh on #41299

    Thank you.

You must be logged in to reply to this topic.

This topic is: not resolved