Title: [Plugin: Widget Logic] user logged in syntax help
Last modified: August 20, 2016

---

# [Plugin: Widget Logic] user logged in syntax help

 *  Resolved [mridl200](https://wordpress.org/support/users/mridl200/)
 * (@mridl200)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-widget-logic-user-logged-in-syntax-help/)
 * Hey guys,
    I am trying to script a small amount of php to change a link based
   on if the user is logged in or not.
 * What I have is :
    <?php if ( is_user_logged_in() ) { echo ‘Welcome, registered
   user!’; } else { echo ‘Welcome, visitor!’; } ?>
 * However I dont really understand how widget logic works. When I place this code
   in my footer widget any text from that widget is removed and nothing is shown.
   Ive tried changing the settings to load after all php has been loaded since is_user_logged_in()
   is part of a different php script but still did not work.
    Any help is appreciated,
   thanks!
 * [http://wordpress.org/extend/plugins/widget-logic/](http://wordpress.org/extend/plugins/widget-logic/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [alanft](https://wordpress.org/support/users/alanft/)
 * (@alanft)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-widget-logic-user-logged-in-syntax-help/#post-2917951)
 * If you put
 * is_user_logged_in()
 * as the Widget Logic for a widget, that widget will only appear if the user is
   logged in. What is displayed in the widget is not controlled by widget logic.
   So you could e.g. have 2 ‘text’ widgets, one with is_user_logged_in() and one
   with !is_user_logged_in(), where ! means ‘NOT the case that’.
 * Hope that helps
 *  Thread Starter [mridl200](https://wordpress.org/support/users/mridl200/)
 * (@mridl200)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-widget-logic-user-logged-in-syntax-help/#post-2917953)
 * That makes perfect sense. Thank you for clearing that up for me.
    I ended up 
   making the two different text widgets like you suggested with is_user_logged_in()
   displaying a different link than when a user is logged out as I originally intended
   to make.
 * Thanks again.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: Widget Logic] user logged in syntax help’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/widget-logic_c8dde5.svg)
 * [Widget Logic](https://wordpress.org/plugins/widget-logic/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/widget-logic/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/widget-logic/)
 * [Active Topics](https://wordpress.org/support/plugin/widget-logic/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/widget-logic/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/widget-logic/reviews/)

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)

 * 2 replies
 * 2 participants
 * Last reply from: [mridl200](https://wordpress.org/support/users/mridl200/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-widget-logic-user-logged-in-syntax-help/#post-2917953)
 * Status: resolved