How to use the chat plugin without e-mail?

Hi there

I need the chat plugin to work without e-mail registration. Due to privacy concerns of our client, we need to have the «registration» for the chat plugin without e-mail. Just a phantasy name should do it.

Any chance you could help me with that?

Thanks
Stefan

  • Hoang Ngo

    Hi @Stefan

    I hope you are well today.

    This is currently out of the box. But we can still archive, In the file wordpress-chat/wordpress-chat.php, between lines 5322 - 5359, you will get the code look like this

    case 'public_user':
    						if ((!isset($user_info['name'])) || (!isset($user_info['email']))) {
    
    							$reply_data['errorText'] 	= __('Please provide valid Name and Email.', $this->translation_domain);
    							$reply_data['errorStatus'] 	= true;
    
    							wp_send_json($reply_data);
    							die();
    						}
    						$user_info['name'] 	= esc_attr($user_info['name']);
    						$user_info['email'] = esc_attr($user_info['email']);
    						if ( (empty($user_info['name'])) || (empty( $user_info['email'] )) || (!is_email( $user_info['email'] )) ) {
    
    							$reply_data['errorText'] 	= __('Please provide valid Name and Email.', $this->translation_domain);
    							$reply_data['errorStatus'] 	= true;
    
    							wp_send_json($reply_data);
    							die();
    						}
    
    						$user_name_id  	= username_exists( $user_info['name'] );
    						if ($user_name_id) {
    
    							$reply_data['errorText'] 	= __('Name already registered. Try something unique', $this->translation_domain);
    							$reply_data['errorStatus'] 	= true;
    
    							wp_send_json($reply_data);
    							die();
    						}
    						$user_name_id = email_exists( $user_info['email'] );
    						if ($user_name_id) {
    
    							$reply_data['errorText'] 	= __('Email already registered. Try something  unique', $this->translation_domain);
    							$reply_data['errorStatus'] 	= true;
    
    							wp_send_json($reply_data);
    							die();
    						}
    						$avatar 					= get_avatar($user_info['email'], 96, get_option('avatar_default'), $user_info['name']);
    						if ($avatar) {
    						    $avatar_parts = array();
    							if (stristr($avatar, ' src="') !== false) {
    						    	preg_match( '/src="([^"]*)"/i', $avatar, $avatar_parts );
    							} else if (stristr($avatar, " src='") !== false) {
    						    	preg_match( "/src='([^']*)'/i", $avatar, $avatar_parts );
    							}
    							if ((isset($avatar_parts[1])) && (!empty($avatar_parts[1])))
    						    	$user_info['avatar'] = $avatar_parts[1];
    						}
    
    						$user_info['ip_address'] 	= (isset($_SERVER['HTTP_X_FORWARD_FOR'])) ? $_SERVER['HTTP_X_FORWARD_FOR'] : $_SERVER['REMOTE_ADDR'];
    						$user_info['auth_hash'] 	= md5($user_info['name'].$user_info['email'].$user_info['ip_address']);
    						$reply_data['user_info']	= $user_info;
    						break;

    Please update this so it will be like this

    case 'public_user':
    if ((!isset($user_info['name'])) /*|| (!isset($user_info['email']))*/) {
    
    							$reply_data['errorText'] 	= __('Please provide valid Name and Email.', $this->translation_domain);
    							$reply_data['errorStatus'] 	= true;
    
    							wp_send_json($reply_data);
    							die();
    						}
    						$user_info['name'] 	= esc_attr($user_info['name']);
    						//$user_info['email'] = esc_attr($user_info['email']);
    						if ( (empty($user_info['name'])) /*|| (empty( $user_info['email'] )) || (!is_email( $user_info['email'] )) */) {
    
    							$reply_data['errorText'] 	= __('Please provide valid Name and Email.', $this->translation_domain);
    							$reply_data['errorStatus'] 	= true;
    
    							wp_send_json($reply_data);
    							die();
    						}
    
    						$user_name_id  	= username_exists( $user_info['name'] );
    						if ($user_name_id) {
    
    							$reply_data['errorText'] 	= __('Name already registered. Try something unique', $this->translation_domain);
    							$reply_data['errorStatus'] 	= true;
    
    							wp_send_json($reply_data);
    							die();
    						}
    						//$user_name_id = email_exists( $user_info['email'] );
    						/*if ($user_name_id) {
    
    							$reply_data['errorText'] 	= __('Email already registered. Try something  unique', $this->translation_domain);
    							$reply_data['errorStatus'] 	= true;
    
    							wp_send_json($reply_data);
    							die();
    						}*/
    						//$avatar 					= get_avatar($user_info['email'], 96, get_option('avatar_default'), $user_info['name']);
    						/*if ($avatar) {
    						    $avatar_parts = array();
    							if (stristr($avatar, ' src="') !== false) {
    						    	preg_match( '/src="([^"]*)"/i', $avatar, $avatar_parts );
    							} else if (stristr($avatar, " src='") !== false) {
    						    	preg_match( "/src='([^']*)'/i", $avatar, $avatar_parts );
    							}
    							if ((isset($avatar_parts[1])) && (!empty($avatar_parts[1])))
    						    	$user_info['avatar'] = $avatar_parts[1];
    						}*/
    
    						$user_info['ip_address'] 	= (isset($_SERVER['HTTP_X_FORWARD_FOR'])) ? $_SERVER['HTTP_X_FORWARD_FOR'] : $_SERVER['REMOTE_ADDR'];
    						$user_info['auth_hash'] 	= md5($user_info['name']/*.$user_info['email']*/.$user_info['ip_address']);
    						$reply_data['user_info']	= $user_info;
    						break;

    Also, you can enable the facebook login, google plus login and twitter login, this will not require email also.

    The code is not well test if we compare to the original version, so it might have potential issues, If you find anything wrong, please revert to the original version.

    And you can always hire a good developer on our job board here https://premium.wpmudev.org/wordpress-development/, who can do the feature for you in short time. I also will move this to Feature and Request box, so the developer can consider this feature for future release.

    Best regards,
    Hoang

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.