The MU forums have moved to WordPress.org

Disabling or enabling widgets for different users? (5 posts)

  1. jayemm
    Member
    Posted 15 years ago #

    Hey folks,

    I've written a custom widget for a particular user, however I'd like to restrict it to just that user. Does anyone know exactly where the code is to display all of the widgets? Example on the sidebar under Design -> Widgets would be the widget I've written, but trying to display it only for a certain user.

    Thanks VERY much!

    Jayemm

  2. dsader
    Member
    Posted 15 years ago #

    Wrap everything in the the widget except the sidebar output in a if( ( $current_user->id ) == ???)

  3. jayemm
    Member
    Posted 15 years ago #

    Hmm, I put the widget in wp-includes/widgets.php. I'm not sure where just the sidebar output for the admin is honestly. If I put the if statement in there, it shows on the blog itself only if the person is logged in and matches that username. Could you be a little more specific please? Your feedback is really appreciated, thanks for your time. :)

    Jayemm

  4. indojepang
    Member
    Posted 15 years ago #

    just a beginner solution hehehe..
    make different theme with the widget for the specific user maybe? :D

  5. jayemm
    Member
    Posted 15 years ago #

    indojepang,

    The only problem with that is I don't even know where the list of available widgets is stored so I could simply exclude it based on the user logged in as admin. Thanks for the input though. :)

About this Topic