Please or Register to create posts and topics.

Edit profile front page function

Page 1 of 2Next

I will love to have my members edit their profile from the front page.

Can you assist with the code

Hello Mrfresh,

providing frontend profile-editing is a general problem. WordPress has its own profile-editing system which is only available in the backend. By default there is no profile-editing system in the frontend. Thats the reason why I only implement stuff in locations where they can be available for all users by default.

When I have to implement all profile-related stuff in the frontend as well, then this will lead to redundancy and it will get much harder to keep the system running, because I have to implement and maintain all the settings twice for the frontend and backend. At the same time some of the default WordPress settings can only get changed in the backend (change display names, password, mails, etc). Some people also want to have the possibility that this kind of stuff will be implemented in their own third-party extensions as well.

You see, if I start once to go away from the default-approach, then I have to implement the same stuff multiple times for multiple systems/extensions/approaches. Thats the reason why I cannot do this at the moment because its just too much work without any big advantages. When WordPress will provide a frontend-profile by default one day, I will implement this stuff there as well for sure.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!
Quote from Asgaros on January 5, 2018, 5:25 pm

Hello Mrfresh,

providing frontend profile-editing is a general problem. WordPress has its own profile-editing system which is only available in the backend. By default there is no profile-editing system in the frontend. Thats the reason why I only implement stuff in locations where they can be available for all users by default.

When I have to implement all profile-related stuff in the frontend as well, then this will lead to redundancy and it will get much harder to keep the system running, because I have to implement and maintain all the settings twice for the frontend and backend. At the same time some of the default WordPress settings can only get changed in the backend (change display names, password, mails, etc). Some people also want to have the possibility that this kind of stuff will be implemented in their own third-party extensions as well.

You see, if I start once to go away from the default-approach, then I have to implement the same stuff multiple times for multiple systems/extensions/approaches. Thats the reason why I cannot do this at the moment because its just too much work without brining big advantages. When WordPress will provide a frontend-profile by default one day, I will implement this stuff there as well for sure.

Thanks i love your response.

Please keep the good work going

I also had this issue recently – the “Ultimate Member” plugin has a nice way to edit your local profile. The default location to edit your user profile (if not admin) is at http://www.myurl.com/user/

One issue was the default “My Profile” link from Asgaros forum works, but the “Edit Profile” button does not work with ultimate plugin as the backend is blocked by “ultimate member” plugin and we want it to go to the /user/ location.

Solution I am currently using is this in my child theme functions.php to override the profile edit location:

// below function redirects the forum users to the "Ultimate Member" Profile editing page
add_action ('init' , 'prevent_profile_access'); 

function prevent_profile_access() {
   		if (current_user_can('manage_options')) return '';
    
   		if (strpos ($_SERVER ['REQUEST_URI'] , 'wp-admin/profile.php' )){
      		wp_redirect ("https://yoururl.com/user/");
            die();
 		 }

}

 

kingoloj has reacted to this post.
kingoloj

Hello @hilo90mhz

Asgaros Forum uses the official get_edit_profile_url() WordPress-function to retrieve the edit-profile-url for a user. I really dont understand why third-party-extensions always dont overwrite those filters so that the WordPress core-functions can link to the correct locations.

But you can also easily do it with the WordPress edit_profile_url-filter:

https://codex.wordpress.org/Plugin_API/Filter_Reference/edit_profile_url

The solution will be much more straight-forward compared to your current implementation. 🙂

hilo90mhz and Era31 have reacted to this post.
hilo90mhzEra31
If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Wow that was fast! Okay I will give that a try in the morning. Thanks!

@asgaros

How do I do it with the edit_profile_url?

I found it in the “forum-profile.php” but I don’t know what to do to change the link to e.g.  “www.mydomain.com/profile”.

Kind regards

Hello @speedi

The custom-code must be added via the functions.php file of your theme. Dont change core-files of the plugin because changes to it will be gone after an update.

The URL which you have to use depends on the frontend-profile-plugin which you are using. For example the code can look like this:

add_filter('edit_profile_url', 'my_edit_profile_url', 10, 3);

function my_edit_profile_url($url, $user_id, $scheme) {
    return home_url('/my-edit-profile-page/'.$user_id);
}

 

WoMo Olli and Era31 have reacted to this post.
WoMo OlliEra31
If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Thank you @asgaros it’s works but…

How can I exclude the administrator please ?

When I try to edit my own profile (Admin), I no longer have access to the Back-end profile (wordpress panel)!

Help please !

Merci 🙂

Hello @era31

You can try to use the following code so that the overwritten link is only used for non-administrators:

add_filter('edit_profile_url', 'my_edit_profile_url', 10, 3);
function my_edit_profile_url($url, $user_id, $scheme) {
    if (user_can($user_id, 'administrator')) {
        return home_url('/my-edit-profile-page/'.$user_id);
    }

    return $url;
}

 

WoMo Olli and Era31 have reacted to this post.
WoMo OlliEra31
If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!
Page 1 of 2Next