Magicmembers and error messages on frontend (6 posts)

  1. Kenn Nielsen
    Posted 2 years ago #

    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";
    					$errors['error'][$code] = $error . "<br />\n";
    			// 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
    			return $error_string;
    			echo $error_string;		
    	//let return false if $return = true;	
  2. ironraiden
    Posted 2 years ago #


    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.

  3. Kenn Nielsen
    Posted 2 years ago #


    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.

  4. ironraiden
    Posted 2 years ago #


    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.

  5. Kenn Nielsen
    Posted 2 years ago #

    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?

  6. Ledeni
    Posted 2 years ago #

    I've fixed this by adding:

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


    $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.

Topic Closed

This topic has been closed to new replies.

About this Topic