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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.