Change URLs (Login, Register, Profile, etc)
Quote from Asgaros on February 25, 2018, 7:18 pmIf you are using custom pages for certain areas of your website and you want to change specific URLs, you have to use one of the available filter which are provided by WordPress or Asgaros Forum. Here are a few code-examples which you have to add to your themes functions.php-file.
Change Login URL
add_filter('login_url', 'my_login_url', 10, 3); function my_login_url($login_url, $redirect, $force_reauth) { return home_url('/my-login-page'); }
Change Register URL
add_filter('register_url', 'my_register_url'); function my_register_url($register_url) { return home_url('/my-register-page'); }
Change Members List URL
add_filter('asgarosforum_filter_members_link', 'my_members_list_url'); function my_members_list_url($members_list_url) { return home_url('/my-members-page'); }
Change Profile URL
add_filter('asgarosforum_filter_profile_link', 'my_profile_url', 10, 2); function my_profile_url($profile_url, $user_object) { return home_url('/my-profile-page/'.$user_object->user_nicename); }
Change Edit Profile URL
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); }
If you are using custom pages for certain areas of your website and you want to change specific URLs, you have to use one of the available filter which are provided by WordPress or Asgaros Forum. Here are a few code-examples which you have to add to your themes functions.php-file.
Change Login URL
add_filter('login_url', 'my_login_url', 10, 3); function my_login_url($login_url, $redirect, $force_reauth) { return home_url('/my-login-page'); }
Change Register URL
add_filter('register_url', 'my_register_url'); function my_register_url($register_url) { return home_url('/my-register-page'); }
Change Members List URL
add_filter('asgarosforum_filter_members_link', 'my_members_list_url'); function my_members_list_url($members_list_url) { return home_url('/my-members-page'); }
Change Profile URL
add_filter('asgarosforum_filter_profile_link', 'my_profile_url', 10, 2); function my_profile_url($profile_url, $user_object) { return home_url('/my-profile-page/'.$user_object->user_nicename); }
Change Edit Profile URL
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 samuel on February 25, 2018, 8:43 pmGibt es einen Code für die Funktion das sobald man auf ein Username klickt das dieser zum BuddyPress Profil weitergeleitet wird?
Gibt es einen Code für die Funktion das sobald man auf ein Username klickt das dieser zum BuddyPress Profil weitergeleitet wird?
Quote from Asgaros on March 20, 2018, 6:00 am@samuel
Das letzte Beispiel sollte dir weiterhelfen. Wie der Code genau aussieht, kann ich dir leider nicht sagen, da ich die BuddyPress-API nicht kenne. Ich denke, dass dir deren Support-Forum ein Code-Beispiel liefern kann, welches weiterhilft. 🙂
Das letzte Beispiel sollte dir weiterhelfen. Wie der Code genau aussieht, kann ich dir leider nicht sagen, da ich die BuddyPress-API nicht kenne. Ich denke, dass dir deren Support-Forum ein Code-Beispiel liefern kann, welches weiterhilft. 🙂
Quote from maxter on April 9, 2018, 12:50 amPlease help me set this up. I have Ultimate Member and this didn’t work.
I added the following to my functions.php
add_filter(‘login_url’, ‘my_login_url’, 10, 3);
function my_login_url($login_url, $redirect, $force_reauth) {
return home_url(‘/login’);
}
This worked for anyone trying to go to my_site/wp-admin/, but it didn’t work for the Forum link to login. Please add in a way to change the links YOU have there.
Please help me set this up. I have Ultimate Member and this didn’t work.
I added the following to my functions.php
add_filter(‘login_url’, ‘my_login_url’, 10, 3);
function my_login_url($login_url, $redirect, $force_reauth) {
return home_url(‘/login’);
}
This worked for anyone trying to go to my_site/wp-admin/, but it didn’t work for the Forum link to login. Please add in a way to change the links YOU have there.
Quote from Asgaros on April 9, 2018, 7:40 pmHello @maxter
This seems to be a WordPress problem. The code is working fine with any URL as long as it is not /login. Maybe you can use a different URL-slug, for example /login-page.
Hello @maxter
This seems to be a WordPress problem. The code is working fine with any URL as long as it is not /login. Maybe you can use a different URL-slug, for example /login-page.
Quote from maxter on April 9, 2018, 9:37 pmThank you, Asgaros, it worked. I apologize for not trying that before, it hadn’t crossed my mind
Thank you, Asgaros, it worked. I apologize for not trying that before, it hadn’t crossed my mind
Quote from cooper86 on July 19, 2018, 9:49 amHallo,
ich habe die Schnippel nun erfolgreich eingefügt; aber der Erfolg bleibt aus. Die Links wollen noch immer zum WP-Login.
Hallo,
ich habe die Schnippel nun erfolgreich eingefügt; aber der Erfolg bleibt aus. Die Links wollen noch immer zum WP-Login.
Quote from Asgaros on July 21, 2018, 2:38 pmHallo @cooper86
Der Code sollte ohne Probleme funktionieren. Wenn dies nicht der Fall ist, dann pfuscht ein anderes Plugin oder dein Theme dazwischen.
Hallo @cooper86
Der Code sollte ohne Probleme funktionieren. Wenn dies nicht der Fall ist, dann pfuscht ein anderes Plugin oder dein Theme dazwischen.
Quote from cooper86 on July 21, 2018, 2:51 pmDanke für die Antwort.
Da ich ein Seiten-Widget mit Login habe, habe ich dies im Forum-Menü einfach deaktiviert. Danke das es auch diese Möglichkeit gibt 😃
Danke für die Antwort.
Da ich ein Seiten-Widget mit Login habe, habe ich dies im Forum-Menü einfach deaktiviert. Danke das es auch diese Möglichkeit gibt 😃
Quote from FatalFrame on January 16, 2020, 5:23 amI know this is an old thread but I have a question:
Let’s say my custom login url is “https://mysite.com/login23
Now which part from the Change Login URL posted above should I change before adding it to functions.php?
Thank you for this awesome plugin 🙂
Update: There is an option in settings to change url for both login and registration 🙂
So nvm .
I know this is an old thread but I have a question:
Let’s say my custom login url is “https://mysite.com/login23
Now which part from the Change Login URL posted above should I change before adding it to functions.php?
Thank you for this awesome plugin 🙂
Update: There is an option in settings to change url for both login and registration 🙂
So nvm .