Support » Plugins and Hacks » Magicmembers and error messages on frontend

  • Kenn Nielsen

    (@sonyfreak)


    Hi there

    I got problems when i sign up users from frontend via the plugin magicmembers.

    I can see that the error messages is handle by magicmembers in the source code of the frontend:
    <div class=”mgm_message_error”></div>

    But the error message doesn’t show – e.g. ‘Email not in correct format’.

    The souce code of the magicmembers handling the error message is as followin:

    Do anybody see a mistake in this part of the code?

    Thank you all in advance.

    function mgm_set_errors($wp_error, $return = false) {	
    
    	// init
    
    	if ( empty($wp_error) ) $wp_error = new WP_Error();
    
    	// if(defined('MGM_DONE_SET_ERRORS')) return;
    
    	// check
    
    	if ( $wp_error->get_error_code() ) {
    
    		$error_string = '';
    
    		$errors = array('error'=>array(), 'message'=>array());	
    
    		$codes  = array();	
    
    		foreach ( $wp_error->get_error_codes() as $code ) {
    
    			if(in_array($code, $codes)) continue;
    
    			$severity = $wp_error->get_error_data($code);
    
    			foreach ( $wp_error->get_error_messages($code) as $error ) {				
    
    				$error = mgm_replace_message_links($code, $error);
    
    				if ( 'message' == $severity )
    
    					$errors['message'][$code] = $error . "<br />\n";
    
    				else
    
    					$errors['error'][$code] = $error . "<br />\n";
    
    				break;
    
    			}
    
    			// set for repeat
    
    			$codes[] = $code;
    
    		}	
    
    		// css 
    
    		$css_group = mgm_get_css_group();
    
    		// issue #867
    
    		if($css_group != 'none') {
    
    			$error_string .= "\n".'<link rel="stylesheet" href="'. MGM_ASSETS_URL . 'css/'.$css_group.'/mgm.messages.css' .'" type="text/css" media="all" />';			
    
    		}
    
    		// build
    
    		if ( !empty($errors['error']) ){
    
    			$error_string .= '<div class="mgm_message_error">' . apply_filters('login_errors', implode(' ', $errors['error'])) . "</div>\n";
    
    		}else if ( !empty($errors['message']) ){
    
    			$error_string .= '<div class="mgm_message_success">' . apply_filters('login_messages', implode(' ',$errors['message'])) . "</div>\n";		
    
    		}
    
    		// return
    
    		if($return)
    
    			return $error_string;
    
    		else 	
    
    			echo $error_string;		
    
    	}
    
    	//let return false if $return = true;	
    
    }
Viewing 5 replies - 1 through 5 (of 5 total)
  • ironraiden

    (@ironraiden)

    Hi,

    I had a similar issue and the cause was one of the security plugins I used. It had a setting to remove error messages. That might be the case for you, too.

    Kenn Nielsen

    (@sonyfreak)

    Hi

    Thank you for your post!

    I have try to disable every plugin, one by one, except magic members and it is still the same 🙁

    I did have a security pluigin and i deleted it without luck.

    ironraiden

    (@ironraiden)

    Hi,

    Deactivate Magic Members, too. Then try to login with default WordPress login form by entering incorrect information to see if the errors display properly. If it’s still not showing, then your theme might strip the error messages. If the message is showing properly, then it’s best for you to contact Magic Members support.

    Kenn Nielsen

    (@sonyfreak)

    The funny part is, that the standard wordpress login/register works just fine. It is only magic members register form the error won’t show.

    So it can only be the plugin, right?

    I’ve fixed this by adding:

    echo '<div class="mgm_message_error">' . $errors['error'][$code] . '</div>';

    instead:

    $error_string .= '<div class="mgm_message_error">' . apply_filters('login_errors', implode(' ',$errors['error'])) . "</div>\n";

    Now, error messages and success messages are displayed, the only problem is on register page. Plugin prints same error message twice, and I still can’t figure out where is the problem.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Magicmembers and error messages on frontend’ is closed to new replies.