Redirect after profile edit back to profile

I need a little help with a line of code to redirect a user from pedit, after undtating their profile, back to the profile. I am working with DeeEmm code where he put in the line in the pedit.php:

 

if( empty( $this -> aErrors[0] ) and empty( $this -> aErrors[1] ) ) { // do not save in ajax mode

                if (!$this -> bAjaxMode or $this->bForceAjaxSave) {

        $this -> saveProfile();

        $sStatusText = '_Save profile successful';

 

header(‘Location: index.php”);

exit;

 

I have change the location to profile.php and it works, but it’s ugly. Instead of getting:

 

www.mydomain/admin

I get 

www.mydomain/profile.php

 

So I have 2 questions, is this the correct way to do this in 7.1 and am I even using the correct file? Thanks in advance for you time.  

Michael
Quote · 9 Dec 2012

 

I need a little help with a line of code to redirect a user from pedit, after undtating their profile, back to the profile. I am working with DeeEmm code where he put in the line in the pedit.php:

 

if( empty( $this -> aErrors[0] ) and empty( $this -> aErrors[1] ) ) { // do not save in ajax mode

                if (!$this -> bAjaxMode or $this->bForceAjaxSave) {

        $this -> saveProfile();

        $sStatusText = '_Save profile successful';

 

header(‘Location: index.php”);

exit;

 

I have change the location to profile.php and it works, but it’s ugly. Instead of getting:

 

www.mydomain/admin

I get 

www.mydomain/profile.php

 

So I have 2 questions, is this the correct way to do this in 7.1 and am I even using the correct file? Thanks in advance for you time.  

 
You need to get the username if you want the username used instead of profile.php.

So instead of this

header(‘Location: profile.php');

Use this

header(‘Location: ' . BX_DOL_URL_ROOT . getUsername());


https://www.deanbassett.com
Quote · 9 Dec 2012

 

So instead of this

header(‘Location: profile.php');

Use this

header(‘Location: ' . BX_DOL_URL_ROOT . getUsername());

Thanks for the reply Deano. I made the change you suggested, but doing it stopped the pedit.php file from loading. I must be getting an error message, but i am not seeing it. If I remove your line and put the old one back it works. If I remove both it works. Do you see anything that could cause this or do you have anything else in your toolbox ;) Thanks for your help. 

Michael
Quote · 9 Dec 2012

 

 

So instead of this

header(‘Location: profile.php');

Use this

header(‘Location: ' . BX_DOL_URL_ROOT . getUsername());

Thanks for the reply Deano. I made the change you suggested, but doing it stopped the pedit.php file from loading. I must be getting an error message, but i am not seeing it. If I remove your line and put the old one back it works. If I remove both it works. Do you see anything that could cause this or do you have anything else in your toolbox ;) Thanks for your help. 

 
Yea, It appears the quote at the start of the word Location is the wrong type. I pasted and changed from your origional post whch must be damaged by the forum. So try this one which i typed manually.

header('Location: ' . BX_DOL_URL_ROOT . getUsername());


https://www.deanbassett.com
Quote · 9 Dec 2012

 

Yea, It appears the quote at the start of the word Location is the wrong type. I pasted and changed from your origional post whch must be damaged by the forum. So try this one which i typed manually.

header('Location: ' . BX_DOL_URL_ROOT . getUsername());

 That worked beautifully Deano. Thanks a million Laughing

Michael
Quote · 9 Dec 2012
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.