Forums

How to check is_editor() like is_admin()??? (4 posts)

  1. DDT
    Member
    Posted 1 year ago #

    Hi,

    I like to tweak a plugin to be accessable by editors, now it's only accessable by is_admin().
    How do i check if a user is an editor???

    regards,

  2. Mark / t31os
    Moderator
    Posted 1 year ago #

    is_admin doesn't determine if a user is an admin, it determines if the currently page is in the administration area..

    http://codex.wordpress.org/Function_Reference/is_admin

    If you want to determine what role a user has you need to look the current user object or check against what capabilities that user has..

    Apparently this works for the role to..
    http://codex.wordpress.org/Function_Reference/current_user_can

    Some partially related topics.
    http://wordpress.org/support/topic/get-a-users-role-by-user-id
    http://wordpress.org/support/topic/how-to-get-the-current-logged-in-users-role

  3. DDT
    Member
    Posted 1 year ago #

    Tx Mark,

    I realize now, and i have read the part about capabilities and use that. Just by
    add_object_page ('ProudThemes » Theme Options', 'Slider fotos', 'edit_posts', 'proud_home', 'proud_page_gen', 'http://www.proudthemes.com/favicon.png');

    so if the user can edit posts he/she is also able to change this theme options

    Tx

  4. Mark / t31os
    Moderator
    Posted 1 year ago #

    Only users that are Editors and Admins can edit_pages, that might be a more suitable cap to use..

    Posts can also be modified by Authors and Contributors.

    :)

Topic Closed

This topic has been closed to new replies.

About this Topic