WordPress.org

Ready to get started?Download WordPress

Forums

Widget Logic
[resolved] Show widget only when a subscriber is logged in (7 posts)

  1. InnoRuptive
    Member
    Posted 2 years ago #

    Is it possible to only show a widget when a subscriber is logged in?

    The author gave this one as an example: current_user_can('level_10'), but this only shows the widget for admins. Is there a "level" number for just regular subscribers in which a widget will only show they are logged in?

    Thanks in advance.

    http://wordpress.org/extend/plugins/widget-logic/

  2. Big Bagel
    Member
    Posted 2 years ago #

    Use is_user_logged_in().

    Function Reference/is user logged in

  3. Submerged06
    Member
    Posted 2 years ago #

    I have tried is_user_logged_in(), doesn't seem to work. It's the "Welcome back" tab currently on the right side of http://mygreekstudies.com/ (it should only appear when they are logged in, it currently appears whether they are or not).

    The exact input in the widget logic area is:
    is_user_logged_in()

    That is all it needs, isn't it?

    Thanks!

  4. Submerged06
    Member
    Posted 2 years ago #

    Actually . . . nvm. I reloaded the widget page and the code wasn't there anymore. Put it in, saved it, and it works perfectly. Bit odd that it "poofed", but as long as it sticks now there's no harm done :).

  5. Submerged06
    Member
    Posted 2 years ago #

    Ah, I found the problem. I had a Social Login installed, and, while the widget page was open, I logged in on the actual site with Facebook (which kicked me out of the admin access); so the updates I did weren't actually updating. Which explains the "poof". Lol. Live and learn, right? I'll shut up now :).

  6. bojanski
    Member
    Posted 2 years ago #

    Any ideas, how to have the opposite of is_user_logged_in()?
    Like "is_user_logged_out()...

    Thanks

  7. bojanski
    Member
    Posted 2 years ago #

    got it! it is just: !is_user_logged_in()

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic