Title: using if logged in function
Last modified: August 31, 2016

---

# using if logged in function

 *  Resolved [durangod2](https://wordpress.org/support/users/durangod2/)
 * (@durangod2)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/using-if-logged-in-function/)
 * Hi, i am trying to do something like this in a text widget.
 *     ```
       <?php
       if(is_user_logged_in())
       { ?>
   
       <a href="http://webpage.usplayersonly.x10host.com/wp-login.php?action=logout">Logout</a>
   
       <br />
   
       <?php
       }else{
       ?>
   
       <a href="http://webpage.usplayersonly.x10host.com/wp-login.php">Login</a>
   
       <br />
   
       <a href="http://webpage.usplayersonly.x10host.com/wp-login.php?action=register">Register</a>
   
       <?php
       }
       ?>
       ```
   
 * its not working, am i doing something wrong in the widget?
 * thanks 🙂
 * [https://wordpress.org/plugins/php-code-widget/](https://wordpress.org/plugins/php-code-widget/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [durangod2](https://wordpress.org/support/users/durangod2/)
 * (@durangod2)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/using-if-logged-in-function/#post-7100303)
 * Nevermind i got it, i did not know it created a php widget to use for this. I
   just happen to find another article in my search talking about this php widget
   and so i decided to look to see if i had one and there it was.
 * I was using a plain text widget. The words “creates a new widget” would have 
   been helpful in the description lol 🙂 But then again im a wp noob.
 * Thanks for a nice plugin 🙂

Viewing 1 replies (of 1 total)

The topic ‘using if logged in function’ is closed to new replies.

 * ![](https://ps.w.org/php-code-widget/assets/icon.svg?rev=992095)
 * [PHP Code Widget](https://wordpress.org/plugins/php-code-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/php-code-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/php-code-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/php-code-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/php-code-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/php-code-widget/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [durangod2](https://wordpress.org/support/users/durangod2/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/using-if-logged-in-function/#post-7100303)
 * Status: resolved