Edit profile front page function
Quote from Mrfresh on January 5, 2018, 3:33 pmI will love to have my members edit their profile from the front page.
Can you assist with the code
I will love to have my members edit their profile from the front page.
Can you assist with the code
Quote from Asgaros on January 5, 2018, 5:25 pmHello 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.
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.
Quote from Mrfresh on January 5, 2018, 6:02 pmQuote from Asgaros on January 5, 2018, 5:25 pmHello 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
Quote from Asgaros on January 5, 2018, 5:25 pmHello 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
Quote from hilo90mhz on February 13, 2018, 9:45 amI 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 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(); } }
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(); } }
Quote from Asgaros on February 13, 2018, 12:20 pmHello @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. 🙂
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. 🙂
Quote from speedi on March 25, 2019, 11:09 pm@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
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
Quote from Asgaros on March 28, 2019, 5:27 amHello @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); }
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); }
Quote from Era31 on May 26, 2019, 3:11 amThank 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 🙂
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 🙂
Quote from Asgaros on May 27, 2019, 8:43 pmHello @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; }
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; }