Tagged: x
-
AuthorPosts
-
April 21, 2016 at 2:56 pm #894248
Hi, I would like to split account and register page in woocommerce. How to do it?
I have another question. I want to display the “Login” page (after the split or to point to the page http://www.mysiteurl.it/wp-login) if user is not logged in and to display my account page and all pages which are under it if logged in:
Mio account (My account)
— Modifica account (Edit account)
— Modifica indirizzo (Edit address)
— LogoutConsequently the login page must be hidden until the customer logouts.
I read in google in some posts that you can and there is some code provided (php code and such), but I cannot understand really good how to do it 🙁 Can you please point me in the right direction? Thank you!
April 22, 2016 at 2:55 am #894936I tried this code to show/hide pages:
add_action('wp_head','jg_user_nav_visibility'); function jg_user_nav_visibility() { if ( is_user_logged_in() ) { $output=" .nav-login { display: none !important; } "; } else { $output=" .nav-account { display: none !important; } "; } echo $output !important; }
I added “nav-login” class to my login page and “nav-account” to my account page and did not work 🙁
April 22, 2016 at 4:23 am #895039Hi,
Please remove the code you added in your functions.php file.
Then add this in custom > edit global css in the customizer
.logged-in .nav-login { display:none; } .nav-account { display:none; } .logged-in .nav-account { display:block !important; }
Hope that helps.
April 22, 2016 at 4:43 am #895057It worked like a charm, thank you!
Now, how to split registration and login page?
I found this here: http://stackoverflow.com/questions/23821488/separate-registration-page-in-woo-commerce-website
edit your form-login.php file and seperate the login form and registration form in two different sections say section A and B.
now check for a GET parameter in the page which will define which section to show. By default login will be shown, if parameter is found and is “register”, show registration section
if( isset( $_GET['action']) && $_GET['action'] == "register"){ // Section for registration }else { // Section for Login form }
you can provide a link for registration as
<a href="' .get_permalink(woocommerce_get_page_id('myaccount')). '?action=register"> register </a></blockquote>
and this one here: https://www.tmdhosting.com/kb/question/how-to-create-separate-log-in-and-registration-pages-in-woocommerce/
You can create a copy of the Woocommerce form-login.php and name it form-register.php. The form-login.php is located in /woocommerce/templates/myaccount/ folder.
Then in the form-login.php you can create a link to the form-register.php using this code:
<a href="' .get_permalink(woocommerce_get_page_id('myaccount')). '?action=register"> register </a>
Next you need to modify your themes function.php file by adding the following code:
/*// Separete Login form and registration form */ add_action('woocommerce_before_customer_login_form','load_registration_form', 2); function load_registration_form(){ if(isset($_GET['action'])=='register'){ woocommerce_get_template( 'myaccount/form-registration.php' ); } }
April 22, 2016 at 10:38 am #895541Hi, I could personalize my wp_signup.php page. The fact is: I do not like how woocommerce treat the login page, because it is not separated from the register page, then I thought I could use the wp-login.php page for login and the wp-signup page for registrations. If you register your account from wp-signup.php page do you become admin rights or client rights? Another solution would be to split the register and login page… what do you suggest? Thx!
April 22, 2016 at 7:56 pm #896103Hi there,
It depends on WordPress’s setting as it will take the role that you set at Admin > Settings > General > New User Default Role . By default, registration is for the subscriber. And you can only create Admin account if you’re logged in as an admin. I think it’s okay with that current role setup.
Hence, no need for splitting the registration. But, if you’re going to use multiple roles and custom login page. Then that’s when you need a split registration. Since there is only one role (eg. Client), then I guess one page is enough.
Thanks!
April 23, 2016 at 2:57 am #896394Hi Rad, I am the only one admin and I created an account (manually and I have assigned its rights manually) only for my customer, who has to use woocommerce. Maybe I’ll have to create another account for the marketing department (maybe another admin), all other accounts should be customers that want to buy something from the shop. Is my current setup ok?
P.s. I disable the page wp_signup.php (topic here https://community.theme.co/forums/topic/blank-space-under-footer-problem/#post-896021)
April 24, 2016 at 3:19 am #897229Hi there,
Yes that’s okay, unless you wish to let them signup for their own account. Are you planning to create registrations for specific users?
Thanks!
April 26, 2016 at 4:31 am #899990Hi Rad, the only users that are not admin and can register are customers, all other users will be created manually from me (ie admins, shop manager etc.) 🙂 is it then ok?
April 26, 2016 at 10:01 pm #901349Hi There,
That is ok. Just set Admin > Settings > General > New User Default Role to Customers.
Hope this helps.
April 27, 2016 at 9:31 am #902259Hi Lely, I cannot find this setting (there is none) but new users seems to be assigned standard to this role, so no problem anyway! Thank you!
April 27, 2016 at 5:34 pm #903150Glad it works for you now 🙂
-
AuthorPosts