WordPress.org

Ready to get started?Download WordPress

Forums

name of database field(s) for user Roles/permissions? (3 posts)

  1. rlbrown
    Member
    Posted 4 years ago #

    Hi, searched the forums here via Google and also the Docs and couldn't find the names of the database fields that control the users roles/privileges.

    I'm still using 2.9.2 (for a few more days)

    I looked at this document:
    http://codex.wordpress.org/Database_Description/2.9

    I was first thinking it was the "user_status" field in the wp_users table (http://codex.wordpress.org/Database_Description/2.9#Table:_wp_users) but then I noticed that all of my users (both admins and regular users) had status of 0 so that can't be it.

    I'm guessing it's one of the fields in the wp_options table or maybe wp_usermeta?

    I want to make sure that only one of my users is an administrator in the database. I'm cleaning up after a hack and would rather not install a plug-in to do this.

    Thanks in advance!

  2. Hax
    Member
    Posted 4 years ago #

    They are under $prefix_options table with the option name $prefix_user_roles and the role is assign via user_metadata

  3. rlbrown
    Member
    Posted 4 years ago #

    Thank you!

    I see a table called "wp_options" with a row named "wp_user_roles".

    It contains:

    a:5:{s:13:"administrator";a:2:{s:4:"name";s:13:"Administrator";s:12:"capabilities";a:62:{s:13:"switch_themes";b:1;s:11:"edit_themes";b:1;s:16:"activate_plugins";b:1;s:12:"edit_plugins";b:1;s:10:"edit_users";b:1;s:10:"edit_files";b:1;s:14:"manage_options";b:1;s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:6:"import";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:8:"level_10";b:1;s:7:"level_9";b:1;s:7:"level_8";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;s:12:"delete_users";b:1;s:12:"create_users";b:1;s:17:"unfiltered_upload";b:1;s:14:"edit_dashboard";b:1;s:14:"update_plugins";b:1;s:14:"delete_plugins";b:1;s:15:"install_plugins";b:1;s:13:"update_themes";b:1;s:14:"install_themes";b:1;s:11:"update_core";b:1;s:10:"list_users";b:1;s:12:"remove_users";b:1;s:9:"add_users";b:1;s:13:"promote_users";b:1;s:18:"edit_theme_options";b:1;s:13:"delete_themes";b:1;s:6:"export";b:1;}}s:6:"editor";a:2:{s:4:"name";s:6:"Editor";s:12:"capabilities";a:34:{s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;}}s:6:"author";a:2:{s:4:"name";s:6:"Author";s:12:"capabilities";a:10:{s:12:"upload_files";b:1;s:10:"edit_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:4:"read";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;s:22:"delete_published_posts";b:1;}}s:11:"contributor";a:2:{s:4:"name";s:11:"Contributor";s:12:"capabilities";a:5:{s:10:"edit_posts";b:1;s:4:"read";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;}}s:10:"subscriber";a:2:{s:4:"name";s:10:"Subscriber";s:12:"capabilities";a:2:{s:4:"read";b:1;s:7:"level_0";b:1;}}}

    I can not find any table or option named "user_metadata".

    I'm guessing that the roles are assigned in the "wp_usermeta" table?

    How does it work there?

    here's what my wp_usermeta table looks like:

    umeta_id user_id meta_key meta_value
    1 1 nickname Dave
    2 1 rich_editing true
    3 1 comment_shortcuts false
    4 1 admin_color classic
    5 1 wp_capabilities a:1:{s:13:"administrator";b:1;}
    7 1 wp_user_level 10
    8 1 wp_usersettingstime 1268608634
    9 1 first_name David
    10 1 last_name fisherman
    11 1 wp_usersettings align=center&editor=tinymce&m3=o&hidetb=1&galfile=1&galcols=2&m4=o&m8=o&m0=o&m5=o&m7=o&m1=c&m2=c
    12 1 wp_autosave_draft_ids a:6:{i:-1268454452;i:8;i:-1268455316;i:17;i:-1268458522;i:42;i:-1268462136;i:57;i:-1268477259;i:69;i:-1268603508;i:79;}
    13 1 closedpostboxes_dashboard a:2:{i:0;s:17:"dashboard_primary";i:1;s:19:"dashboard_secondary";}
    14 1 metaboxhidden_dashboard a:1:{i:0;s:0:"";}
    15 1 closedpostboxes_page a:1:{i:0;s:0:"";}
    16 1 metaboxhidden_page a:1:{i:0;s:7:"slugdiv";}
    17 1 closedpostboxes_post a:1:{i:0;s:0:"";}
    18 1 metaboxhidden_post a:1:{i:0;s:0:"";}
    21 1 wp_dashboard_quick_press_last_post_id 94
    20 1 screen_layout_post 2

    Are all 20 of those lines for my 1 user?
    (i only have 1 user right now).

    Is there any document out there that breaks down how it works?
    (if not, i think i'll make one after i deciper it all! :) )

    Thanks,

    Roger

Topic Closed

This topic has been closed to new replies.

About this Topic