BuddyDev

Search

Force friend connections – admin

  • Participant
    Level: Initiated
    Posts: 5
    Alex on #3181

    I have a peer to peer marketplace where the users are private until the admin connects them.

    How do I make it so the friends do not have the ability to make connections and only the admin has the ability to do that?

    Furthermore if you all could help me to understand how to change the label from “friends” to “connections”

    If you have any questions please let me know. I need to make these changes

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #3183

    Hi Alex,
    Welcome to BuddyDev.

    1. To change “friends” to connections please use a translation tool(like poedit) and you can translate the text.

    For your other question, I will need a few details first:-

    1. How does the admin connects two user? I mean how are you adding two users as friend?
    2. DO you want to remove the add friend/remove friend completely or just add friend?

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 5
    Alex on #3185

    Thanks for the response. I have seen some of the guys excited to get your helping them out 🙂

    The peer to peer marketplace is going to have two different types of members..
    A Coach
    and
    A member ( user | Customer)

    I want to have all the members private and connect the users via the admin’s discretion on the panel.

    I don’t want a member ( customer ) to be able to connect with a coach themselves and I don’t want the coach to be able to connect with a user by themselves

    if that makes sense

    Thanks for your help

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #3187

    Hi Alex,
    Thank you.
    Here is an example filter implementation to show you show to remove the button

    
    
    function buddydev_custom_disable_friends_button( $btn ) {
    
    	//$btn is an associative array
            //two keys are of our interest
    	//'id'                => 'not_friends'/ 'is_friend' / 'awaiting_response' / 'pending',
    	//Other important field is 'link_id'=> 'friendship-button-' . $potential_friend_id
    
    	//you can get the other user id from the link_id and current user id using get_current_user_id()
    	//and decide to change the args as needed
    	//if you return empty array or unset the 'id' key from the array, It will not generate any button
    	return array();
    }
    add_filter( 'bp_get_add_friend_button', 'buddydev_custom_disable_friends_button' );
    
    

    Please try going through it and see if it helps or not?

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 5
    Alex on #3191

    great thanks.

    What do you think about the admin function to connect the friends via the admin panel?

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #3192

    That will need a custom implementation as far as I can think the UI.

    I thought you had a solution for that. It can be a good candidate for a custom plugin itself.

    It is a little complex as it will need to handle:-
    1. Providing UI to select 2 users or Another when doing from some user’s profile
    2. Automatic adding as friends(easy)
    3. having UI to delete the connections.

    If you have some type of implementation and need any assistance with a particular thing, please do let me know.

  • Participant
    Level: Initiated
    Posts: 5
  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #3194

    Hi Alex,
    Thank you for the details.
    1. It seems he did it in the admin and was facing issue with a BuddyPress function(he was looking for ways to stop notification) but he did not share the original code. So, unless the code is available, It will be a complete new plugin.

    If you are not familiar with code, you will need someone to implement it. It will need a couple of hours for anyone to implement.

  • Participant
    Level: Initiated
    Posts: 5
    Alex on #3228

    Intersting. I thought the code that he provided on github was maybe how it was done. I thought i saw something in there about force accept. but I don’t know much about how to read that stuff.

    Do you know anyone that may be able to help me implement this?

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #3230

    Hi Alex,
    The code he linked on github is part of BuddyPress Core.
    I will talk to one of my colleagues and see if he is available, then we can do it, otherwise you may want to post it on BuddyPress.org forums and hope that someone might pick the idea.

    Thank you
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved