Chat Friends plugin with all connected members

Hello,
I'm using chat plugin and in particular, friends chat plugin in order to place private chats between members.
Currently, this plugin allows to add an "available" link on the profile of the members that are friends. I would like to extend this to all connected members (and if possible, all members that have a valid membership). I have already started to analyse your file wordpress-chat/lib/wpmudev_chat_widget.php and it seems this should not be of big difficulty to make some modifications for this.
Could you have a look and let me know if there is a chance to propose a modification in a short period of time, even if I need to modify core file in a first step.
Thanks
Pat

  • poco06

    Hi and thanks for your quick answer.
    I need to propose private chats to the members of a site. So, I'm using your plugin and have select only private chat. This means I can have 2 ways to launch a private chat :
    - thanks to the admin bar where you can select one of your friends that are connected
    - or when you visit the profile of one of your friends, you can see a link with a green button (when your friend is connected) and if you click on it, then you launch a private chat with him.
    What I would like, is to have the ability to open private chat, not only with friends, but with all connected members (or all connected members with a valid membership).
    This requires to modify a little the file I mentionned in my first post and I would like to know if this is something you can provide support on.
    Regards
    Pat

  • Ash

    Hello @poco06

    Currently the chat is available for buddypress friends or friends using our friends plugin. I am afraid, we don't have any plan yet to open the chat for all connected members.

    Please note that, we always keep improving all of our plugins, so new feature will be added. So, if you share your code/changes with us, I would like to discuss with the developer if that is something he can include.

    Cheers
    Ash

  • poco06

    Hi,
    I have modified the plugin in order to have all members appearing in the admin bar chat, but I still need to advice for adding a link in the member profile (not only the friends, but all members).
    If you could give some help here, that would be appreciated. There is no issue modifying core files as this site will not be updated inthe future.
    I can share the way I modified the admin chat bar, but this need to modify the core files !!!
    Regards
    Pat

  • Ash

    Hello @poco06

    I hope you are well today.

    Please go to /plugins/wordpress-chat/lib/wpmudev_chat_buddypress.php line no 57 to 106 and replace:

    function wpmudev_chat_buddypress_member_header_actions() {
    	global $bp, $members_template, $wpmudev_chat, $current_user;
    
    	if ( $bp->loggedin_user->id === bp_displayed_user_id() ) {
    		return;
    	}
    
    	//if (!is_object('BP_Friends_Friendship')) return;
    	if ( ! bp_is_active( 'friends' ) ) {
    		return;
    	}
    
    	if ( ! class_exists( 'BP_Friends_Friendship' ) ) {
    		return
    
    			$is_friend_ret = BP_Friends_Friendship::check_is_friend( bp_loggedin_user_id(), bp_displayed_user_id() );
    	}
    	//echo "is_friend_ret[". $is_friend_ret ."]<br />";
    
    	// Set this so when we get to wp_footer it knows we need to load the JS/CSS for the Friends display.
    	$wpmudev_chat->_chat_plugin_settings['blocked_urls']['front'] = false;
    	if ( ( BP_Friends_Friendship::check_is_friend( bp_loggedin_user_id(), bp_displayed_user_id() ) == 'is_friend' )
    	     || ( $bp->loggedin_user->is_site_admin == true )
    	) {
    
    		$content = '';
    
    		$content .= '<div id="wpmudev-chat-now-button-' . bp_displayed_user_id() . '" class="generic-button wpmudev-chat-now-button">';
    		$friends_status = wpmudev_chat_get_friends_status( $bp->loggedin_user->id, bp_displayed_user_id() );
    
    		if ( ! empty( $friends_status[0] ) ) {
    			$friends_status = $friends_status[0];
    		} else {
    			$friends_status = '';
    		}
    
    		$friend_data = wpmudev_chat_get_chat_status_data( bp_displayed_user_id(), $friends_status );
    		//echo "friend_data<pre>"; print_r($friend_data); echo "</pre>";
    
    		$friend_status_display = $friend_data['icon'] . $friend_data['label'];
    		if ( ! empty( $friend_data['href'] ) ) {
    			$content .= '<a class="button wpmudev-chat-button ' . $friend_data['href_class'] . '" title="' . $friend_data['href_title'] . '" href="#" rel="' . $friend_data['href'] . '">' . $friend_status_display . '</a>';
    		} else {
    			$content .= '<a onclick="return false;" disabled="disabled" class="wpmudev-chat-button ' . $friend_data['href_class'] . '" title="' . $friend_data['href_title'] . '" href="#">' . $friend_status_display . '</a>';
    		}
    		$content .= '</div>';
    
    		echo $content;
    	}
    }

    with

    function wpmudev_chat_buddypress_member_header_actions() {
    	global $bp, $members_template, $wpmudev_chat, $current_user;
    
    	if ( $bp->loggedin_user->id === bp_displayed_user_id() ) {
    		return;
    	}
    
    	//if (!is_object('BP_Friends_Friendship')) return;
    	if ( ! bp_is_active( 'friends' ) ) {
    		return;
    	}
    
    	if ( ! class_exists( 'BP_Friends_Friendship' ) ) {
    		return
    
    			$is_friend_ret = BP_Friends_Friendship::check_is_friend( bp_loggedin_user_id(), bp_displayed_user_id() );
    	}
    	//echo "is_friend_ret[". $is_friend_ret ."]<br />";
    
    	// Set this so when we get to wp_footer it knows we need to load the JS/CSS for the Friends display.
    	$wpmudev_chat->_chat_plugin_settings['blocked_urls']['front'] = false;
    
    		$content = '';
    
    		$content .= '<div id="wpmudev-chat-now-button-' . bp_displayed_user_id() . '" class="generic-button wpmudev-chat-now-button">';
    		$friends_status = wpmudev_chat_get_friends_status( $bp->loggedin_user->id, bp_displayed_user_id() );
    
    		if ( ! empty( $friends_status[0] ) ) {
    			$friends_status = $friends_status[0];
    		} else {
    			$friends_status = '';
    		}
    
    		$friend_data = wpmudev_chat_get_chat_status_data( bp_displayed_user_id(), $friends_status );
    		//echo "friend_data<pre>"; print_r($friend_data); echo "</pre>";
    
    		$friend_status_display = $friend_data['icon'] . $friend_data['label'];
    		if ( ! empty( $friend_data['href'] ) ) {
    			$content .= '<a class="button wpmudev-chat-button ' . $friend_data['href_class'] . '" title="' . $friend_data['href_title'] . '" href="#" rel="' . $friend_data['href'] . '">' . $friend_status_display . '</a>';
    		} else {
    			$content .= '<a onclick="return false;" disabled="disabled" class="wpmudev-chat-button ' . $friend_data['href_class'] . '" title="' . $friend_data['href_title'] . '" href="#">' . $friend_status_display . '</a>';
    		}
    		$content .= '</div>';
    
    		echo $content;
    
    }

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers
    Ash

  • Anton

    @Ashok -

    You helped me before with a very similar way of enabling Chat to ALL BuddyPress members (which was very helpful!).
    Right now I'm looking for a way to enable Chat to users of a site that does NOT have BuddyPress (for various reasons), and is also entirely "front-end" driven for members (so the Friends plugin is useless in this case too). Is it at all possible to get Chat working for non-BP front-end-only users of a site?
    I have various other front-end-related dilemmas that you can read about in this thread.

    Thanks

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.