Ondersteuning » Code oplossingen gezocht » Hide registration button when logged in

  • 123mijnwebsite

    (@123mijnwebsite)


    Hello Everyone,

    I need to hide a register button when a user is logged in, also I need to hide the my account page and cart page when the user is logged out. But can’t find the right code to get this done.

    Could anyone please help me with this?

    The code in the header is:

    <div class="header-register">
    					<a href="#" class="btn btn-default"><i class="fa fa-plus-circle"></i><?php _e('Register', 'bingo'); ?></a>
    					<div>
    						<form method="post" action="" id="bingo_registration_form">
    							<p class="status-reg"></p>
    							<input type="text" name="user_name" class="form-control" placeholder="<?php _e('Username', 'bingo') ?>">
    							<input type="email" name="email" class="form-control" placeholder="<?php _e('Email', 'bingo') ?>">
    							<input type="password" name="reg_password" class="form-control" placeholder="<?php _e('Password', 'bingo') ?>">
    							<input type="submit" class="btn btn-default" name="registration_submit" id="bingo_registration_form_submit" value="<?php _e('Register', 'bingo') ?>">
    						</form>
    					</div>
    				</div> 
    
    <div class="header-register2">
    					<a href="/my-account" class="btn btn-default"><i class="fa fa-user"></i>Mijn account</a>
    					<a href="/cart" class="btn btn-default"><i class="fa fa-shopping-cart"></i>Winkelwagen</a>
    
    </div>

1 reactie aan het bekijken (van in totaal 1)
  • Hello 123mijnwebsite,

    You can change this in the CSS of your website.
    When a user is logged in, the <body> tag will automatically get a class for that. So for example, you could do this in the CSS:

    .logged-in .register-button {
    display: none;
    }

    Regards,
    Joren

    • Deze reactie is gewijzigd 3 jaren, 1 maand geleden door Richard van Denderen. Reden: handtekening verwijderd
1 reactie aan het bekijken (van in totaal 1)
  • Het onderwerp ‘Hide registration button when logged in’ is gesloten voor nieuwe reacties.