• Resolved thePixelPixie

    (@yourbusybee)


    First of all, loving this plugin. Very nice job. Considering purchasing the pro version.

    Here’s the issue I’m having:

    Before I installed this plugin to use for my login/reg/password area, I had already created a frontend My Account page, complete with the ability to edit and update the info from right there. Problem is, there seems to be some sort of conflict between my user validation script and yours, which is causing the page info to no longer be displayed. If I deactivate your plugin, my page content appears again.

    Here’s the script I’m using for that page. Perhaps you’ll know what the conflict might be…

    /* Load the registration file. */
    require_once( ABSPATH . WPINC . '/registration.php' );
    $error = array();
    /* If profile was saved, update profile. */
    if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'update-user' ) {
    
        /* Update user password. */
        if ( !empty($_POST['pass1'] ) && !empty( $_POST['pass2'] ) ) {
            if ( $_POST['pass1'] == $_POST['pass2'] )
                wp_update_user( array( 'ID' => $current_user->ID, 'user_pass' => esc_attr( $_POST['pass1'] ) ) );
            else
                $error[] = __('The passwords you entered do not match.  Your password was not updated.', 'profile');
        }
    
        /* Update user information. */
        if ( !empty( $_POST['url'] ) )
           wp_update_user( array ('ID' => $current_user->ID, 'user_url' => esc_attr( $_POST['url'] )));
        if ( !empty( $_POST['email'] ) ){
            if (!is_email(esc_attr( $_POST['email'] )))
                $error[] = __('The Email you entered is not valid.  please try again.', 'profile');
            elseif(email_exists(esc_attr( $_POST['email'] )) != $current_user->id )
                $error[] = __('This email is already used by another user.  try a different one.', 'profile');
            else{
                wp_update_user( array ('ID' => $current_user->ID, 'user_email' => esc_attr( $_POST['email'] )));
            }
        }
    
        if ( !empty( $_POST['first-name'] ) )
            update_user_meta( $current_user->ID, 'first_name', esc_attr( $_POST['first-name'] ) );
        if ( !empty( $_POST['last-name'] ) )
            update_user_meta($current_user->ID, 'last_name', esc_attr( $_POST['last-name'] ) );
        if ( !empty( $_POST['display_name'] ) )
            wp_update_user(array('ID' => $current_user->ID, 'display_name' => esc_attr( $_POST['display_name'] )));
          update_user_meta($current_user->ID, 'display_name' , esc_attr( $_POST['display_name'] ));
        if ( !empty( $_POST['description'] ) )
            update_user_meta( $current_user->ID, 'description', esc_attr( $_POST['description'] ) );
    
        /* Redirect so the page will show updated info.*/
    	/*I am not Author of this Code- i dont know why but it worked for me after changing below line to if ( count($error) == 0 ){ */
        if ( count($error) == 0 ) {
            //action hook for plugins and extra fields saving
            do_action('edit_user_profile_update', $current_user->ID);
            wp_redirect( get_permalink().'?updated=true' ); exit;
        }
    }

    (that goes at the very top of the page template, before get_header)

    Any ideas?

    I know you have a shortcode for a frontend display of the User Info. Does it also allow for editing on the frontend? If so, I could just replace my code entirely with your shortcode, and that’d be that.

    https://www.ads-software.com/plugins/ppress/

Viewing 1 replies (of 1 total)
  • Plugin Author Collins Agbonghama

    (@collizo4sky)

    > there seems to be some sort of conflict between my user validation script and yours, which is causing the page info to no longer be displayed. If I deactivate your plugin, my page content appears again.

    Can you tell me the error message displayed when this conflict happened?

    > I know you have a shortcode for a frontend display of the User Info. Does it also allow for editing on the frontend? If so, I could just replace my code entirely with your shortcode, and that’d be that.

    The PRO version has a shortcode that can display an edit profile form at the front-end. See some examples https://profilepress.net/demos/memories-edit-profile/ https://profilepress.net/demos/flatui-edit-profile-template/

    Cheers.

Viewing 1 replies (of 1 total)
  • The topic ‘Problem with frontend My Account page now…’ is closed to new replies.