Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Redirecting to profile page after submitting a valid edit profile form


Greg
Participant

@rebootnow

Like many things, this wasn’t as hard as I initially thought it would be. I replaced “xprofile_edit()” with my own version “_xprofile_edit()” that I put in functions.php.

I removed all html output from the new function and put it in a variable instead. This way I could call my “_xprofile_edit()” before the header in /profile/edit.php (in the member theme) and use “wp_redirect( $bp->loggedin_user->domain )” to send the user back to the profile page if their input was valid.

My new function returns the html markup for the form, which is rendered where the theme previously called “bp_edit_profile_form()”.

My one slight concern is that I had to change the call to “wp_nonce_field()” in the function. I can’t allow it to echo anything, since this code is run before the header, so I set the last parameter of “wp_nonce_field()” to $echo = false. I understand the nonce in principle, but I’m not quite sure what this echo was achieving in the first place, so there is a chance that I have removed something that was important for security.

Any thoughts on that would be appreciated.

Skip to toolbar