Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hide welcome widget if user is logged

  • @grosbouff

    Participant

    Hi, I’ve seen that the Welcome Widget was hiding the “join” button if the user is logged.

    That’s nice…

    But I would like to hide it completely (not just the button) if the user is logged.

    I searched a little and found this :

    //removes welcome widget if user is logged

    function unregister_widgets() {

    if (is_user_logged_in())

    unregister_sidebar_widget(‘BP_Core_Welcome_Widget’);

    }

    add_action( ‘widgets_init’, ‘unregister_widgets’);

    The problem it’s that I can’t make it work. It is still there.

    I also did try with

    unregister_sidebar_widget(‘Welcome’);

    but this don’t work either.

    How can I do ?

    My solution actually is to hide it with css but I don’t like that…

    (or maybe this feature should be added in the widget !)

Viewing 5 replies - 1 through 5 (of 5 total)
  • @r-a-y

    Keymaster

    Instead of going through all that work, I’d use the Widget Logic plugin and use “!if_user_logged_in()” to show the Welcome Widget only when a user isn’t logged in.

    Just a thought…

    @grosbouff

    Participant

    Yes but this is one more plugin and I’d like to avoid having too much of them.

    @grosbouff

    Participant

    Finally, Widget Logic is great…thanks !

    @r-a-y

    Keymaster

    Glad I could help!

    By the way, how is your classifieds plugin coming?

    @grosbouff

    Participant

    Thanks, I hope i’ll release it this week or the week after…

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Hide welcome widget if user is logged’ is closed to new replies.
Skip to toolbar