Chose a user role at registration
This topic contains 13 replies, has 2 voices, and was last updated by Atilla Boz 7 years, 7 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
March 20, 2017 at 9:49 am #368528
Hi guys,
I need a solution to let users chose what user role they wanna take when they register. Like normal user or advertiser. for now I use the plugin Adding drop down roles in registration which hasnt been updated in years but still works. Bad thing: It only works with the normal WP login form.
Could you provide a code snippet making it possible to chose user roles with the GD register form, too?
I found this page, showing how it works with normal WP form:
http://wordpress.stackexchange.com/questions/195603/how-to-add-users-roles-dropdown-in-registration-in-wordpressThanks in advance,
AtillaMarch 20, 2017 at 1:02 pm #368569Hi Atilla,
Usually we just recommend checking if a user owns a place or not, if not they are not a advertiser, but if you want to go this way you could just divert the registration link to the normal WP registration link?
Stiofan
March 20, 2017 at 7:03 pm #368702That is exactly what I did. And on my local instalation it works just perfect, but for some reason om my online test site, the Redirection works only for the login but NOT for the registration. I already tried the snippet Nr 2 from this site but it has no effect so far :/
https://wpgeodirectory.com/docs/redirecting-the-login-page/
I opened another thread for that, too and hope we find a solution.
Atilla
March 20, 2017 at 7:08 pm #368707You would also need snippet no1
Stiofan
March 20, 2017 at 7:18 pm #368712I added 1 & 2 now, like this…
// Login add_filter('geodir_login_url','change_geodir_login_url',10,3); function change_geodir_login_url($login_url,$args,$gd_page_id){ //change the url to whatever you want. $login_url = 'http://boz1.timmeserver.de/wp-login.php'; return $login_url; } // Registrierung add_filter('geodir_login_url','_my_geodir_login_url',10,3); function _my_geodir_login_url($login_url,$args,$gd_page_id){ if(isset($args['signup'])){ //change the url to whatever you want. $login_url = 'http://boz1.timmeserver.de/wp-login.php?action=register'; } return $login_url; }
but nothing happens / happened.
March 20, 2017 at 7:21 pm #368714Please provide wp-admin login and let me know where u added the code and i will take a look.
Stiofan
March 20, 2017 at 7:29 pm #368716This reply has been marked as private.March 21, 2017 at 2:55 pm #368847I added our login widget to the footer and the link all look ok?
Stiofan
March 21, 2017 at 7:17 pm #368930I used your code snippets to deactivate the GD login and to redirect it to somewehere else. And that somewhere else is where the WP forms for login and registration are. Login works so far since we get to the link I added in your snippet.
And when I hover the registration link it also shows the correct link but still redirects me to somewhere else and I dont know why…
March 22, 2017 at 11:45 am #369052Yeah that other redirect is not us, i think that is buddypress?
Stiofan
March 23, 2017 at 5:56 am #369240Yes you`re right Stiofan. I just checked the difference between local and online installation. On the local I did not have Buddypress in use.
Gotta find out how to stop Buddypress from the redirection I guess…
Gonna get back with (hopefully good) news.Atilla
March 23, 2017 at 6:17 am #369242Here we go with the solution. I am still using your code snippets and now, at the same time this here. You have to create a new file called bp-custom.php and add it to /wp-content/plugins/
And this is how I added the Code:
<?php /** * Disables BuddyPress' registration process and fallsback to WordPress' one. */ function my_disable_bp_registration() { remove_action( 'bp_init', 'bp_core_wpsignup_redirect' ); remove_action( 'bp_screens', 'bp_core_screen_signup' ); } add_action( 'bp_loaded', 'my_disable_bp_registration' ); add_filter( 'bp_get_signup_page', "firmasite_redirect_bp_signup_page"); function firmasite_redirect_bp_signup_page($page ){ return bp_get_root_domain() . '/wp-login.php?action=register'; } ?>
Had these sources to figure out how it works:
https://gist.github.com/r-a-y/5578432
https://buddypress.org/support/topic/use-standard-wordpress-registration/Thanks again,
AtillaMarch 23, 2017 at 2:58 pm #369337Great, thanks for sharing 🙂
March 23, 2017 at 5:42 pm #369379But you know what 🙁 Now I tried the first time to register from that form and it gives me a lame ERROR… The plugin was not tested yet for the newest WP version. Gonna get back with news.
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket