Jump to content

How do I navigate users to the login popup when they click on a 'like' button and not logged in at the same time?


koon0789

Recommended Posts

I have dynamic images that have the "Like" button, it's basically like a wishlist. The way I want it to work is that when a user is not logged in, the 'Like' button will navigate them to a login popup (which I already made). 

 

This is my code for the sign in/register

 

<?php if(isset($logged_user)){ ?>

                <a href="<?php echo SITE_URL; ?>user/account" id="namebutton">Hello, <?php echo ucfirst($logged_user->first_name); ?></a>

                <a href="<?php echo SITE_URL; ?>user/logout" id="logoutbutton">Log Out</a>

                <?php }else{ ?>

            <a class="loglink" href="javascript:void(0)" onclick="toggle_visibility('popupBoxTwoPosition');">Sign in</a>

            <a class="reglink" href="javascript:void(0)" onclick="toggle_visibility('popupBoxOnePosition');">Register</a>

                <?php } ?>

 

This is my code for the Like button:

 

 

<?php if(count($model->wish) > 0){ ?>

<a href="<?php echo SITE_URL; ?>category/wishlist_delete?id=<?php echo $model->wish{0}->id; ?>"><img src="<?= SITE_IMG ?>heart_icon2.png" alt="hearticon" class="hearticon2" /></a>

<?php }else{ ?>

<a href="<?php echo SITE_URL; ?>category/wishlist_post?id=<?php echo $products{0}->id; ?>"><img src="<?= SITE_IMG ?>heart_icon4.png" alt="hearticon" class="hearticon4" /></a>

<?php } ?> 

 

How do I combine the two if statements together?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.