User Profile Page – Edit Profile Update Message
Hello Rahul,
Thanks for the recent update in Askbug where you fixed the edit user profile page issue. Just a small addition to that, the page doesn’t display any message on updating the user profile. For now you are just printing “true”, which is the ajax call response in the JS Console. Is it possible to process the response of the ajax call and display a snackbar message?
Hello Lisa,
Thanks for posting your solution here. But achieving this is much simpler then you think. you just have to replace wp_die()
with this:
if ( ! is_wp_error( $user_id ) ) { ap_send_json( array( 'success' => true, 'snackbar' => [ 'message' => __( 'Profile Updated Successfully', 'askbug' ) ], ) ); } ap_send_json( array( 'success' => false, 'snackbar' => [ 'message' => __( 'Failed to update profile', 'askbug' ) ], ) );
No JS code required. I have added this to theme.
Cheers.
Not yet. Will publish new release after few more bug fixes.
I just updated the code with the above one and removed the extra JS I had added. It still works.. !! Great.
Thanks.
Awesome. But, don’t you need the AnsPress.trigger(‘snackbar’, parsedData) function in JS to display the message? Right now, it is just printing the response to the JS Console.
Also, Is the update ready to download?