{"id":16760621,"url":"https://github.com/ryanve/access","last_synced_at":"2025-03-16T09:22:54.339Z","repository":{"id":9258697,"uuid":"11084141","full_name":"ryanve/access","owner":"ryanve","description":"WP plugin to control user access via taxonomy terms","archived":false,"fork":false,"pushed_at":"2020-09-21T22:20:37.000Z","size":12,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-15T21:51:20.515Z","etag":null,"topics":["role-based-access-control","role-manager","roles","wordpress","wordpress-plugin","wp-plugin"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryanve.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-01T04:04:45.000Z","updated_at":"2017-02-14T06:08:27.000Z","dependencies_parsed_at":"2022-09-22T15:52:00.597Z","dependency_job_id":null,"html_url":"https://github.com/ryanve/access","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Faccess","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Faccess/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Faccess/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Faccess/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanve","download_url":"https://codeload.github.com/ryanve/access/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243848314,"owners_count":20357534,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["role-based-access-control","role-manager","roles","wordpress","wordpress-plugin","wp-plugin"],"created_at":"2024-10-13T04:24:04.973Z","updated_at":"2025-03-16T09:22:54.270Z","avatar_url":"https://github.com/ryanve.png","language":"PHP","readme":"# [Access](../../)\n\n#### \u003cb\u003eAccess\u003c/b\u003e is a simple scalable WordPress plugin to control user access via the [taxonomy API](http://codex.wordpress.org/Taxonomies) and user [roles/capabilities](http://codex.wordpress.org/Roles_and_Capabilities)/IDs.\n\n## Usage\n\nCreate access terms via \u003cb\u003ePosts\u003c/b\u003e \u0026rarr; \u003cb\u003eAccess\u003c/b\u003e \u0026rarr; \u003cb\u003eAdd New\u003c/b\u003e. Choose any \u003cb\u003ename\u003c/b\u003e and set its \u003cb\u003eslug\u003c/b\u003e to a [role](http://codex.wordpress.org/Roles_and_Capabilities#Roles), [capability](http://codex.wordpress.org/Roles_and_Capabilities#Capabilities), or user ID. \n\n#### Example Terms\n\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003cth scope=\"col\"\u003eName\u003c/th\u003e\n        \u003cth scope=\"col\"\u003eSlug\u003c/th\u003e\n        \u003cth scope=\"col\"\u003eRestricts By\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003ckbd\u003eMembers\u003c/kbd\u003e\u003c/td\u003e\n        \u003ctd\u003e\u003ckbd\u003eread\u003c/kbd\u003e\u003c/td\u003e\n        \u003ctd\u003ecapability\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003ckbd\u003eEditors\u003c/kbd\u003e\u003c/td\u003e\n        \u003ctd\u003e\u003ckbd\u003eeditor\u003c/kbd\u003e\u003c/td\u003e\n        \u003ctd\u003erole\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003ckbd\u003eJohn Doe\u003c/kbd\u003e\u003c/td\u003e\n        \u003ctd\u003e\u003ckbd\u003e47\u003c/kbd\u003e\u003c/td\u003e\n        \u003ctd\u003euser ID\u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\nAccess terms can be added to any post type via \u003cb\u003eEdit\u003c/b\u003e (or \u003cb\u003eQuick Edit\u003c/b\u003e) similar to how categories are added. Posts with access terms are only seen by users logged in with sufficient capability. Denied posts are excluded from the loop.\n\n## UX\n\n### Contexts\n\n- Viewing an access-controlled \u003cb\u003esingular\u003c/b\u003e item. (Its [permalink](http://en.wikipedia.org/wiki/Permalink).)\n- Viewing a \u003cb\u003ecollection\u003c/b\u003e that includes (all or some) access-controlled items. In this case only items that the current user has permission to view are displayed.\n\n### Customization\n\nUse a hook to display a [login form](http://codex.wordpress.org/Function_Reference/wp_login_form) and/or message to inform users that they can log in to access more content.\n\n#### Hooks\n\n##### Filter hooks during the `'loop_start'` action \n\n- `'@access:message'` runs for all cases\n  - `'@access:message:!denied'` runs if all posts are \u003cb\u003enot\u003c/b\u003e denied\n  - `'@access:message:!limited'` runs if posts are all granted \u003cb\u003eor\u003c/b\u003e all denied\n  - `'@access:message:!granted'` runs if all posts are \u003cb\u003enot\u003c/b\u003e granted\n  - `'@access:message:denied'` runs if all posts are denied\n  - `'@access:message:limited'` runs if some posts are granted, some denied\n  - `'@access:message:granted'` runs if all posts are granted\n\n##### Example Message\n\n```php\nadd_filter('@access:message', function($message, $grants, $denies) {\n    if (is_user_logged_in()) return;\n    $url = admin_url();\n    return \"\u003ca href='$url'\u003eLogin\u003c/a\u003e to view additional content.\";\n}, 10, 3);\n```\n\n##### Example Login Form \n\n```php\nadd_filter('@access:message', function($message, $grants, $denies) {\n    if (is_user_logged_in()) return;\n    $form = \"\u003ch3\u003eLogin\u003c/h3\u003e\" . wp_login_form(array('echo' =\u003e 0));\n    return \"\u003cdiv class='loop-login'\u003e$form\u003c/div\u003e\";\n}, 10, 3);\n```\n\n#### CSS\n\nFor CSS purposes, messages are wrapped in a `div.access-message` with an applicable contextual class.\n\n## Install\n\n\u003cb\u003eRequires:\u003c/b\u003e PHP 5.3+\n\n1. Upload to the `/wp-content/plugins/` directory\n1. Activate through the Plugins menu in WordPress\n\n## Fund\n\nFund development with [tips to @ryanve](https://www.gittip.com/ryanve/) =)\n\n## License: [MIT](http://opensource.org/licenses/MIT)\n\nCopyright (C) 2013 by [Ryan Van Etten](https://github.com/ryanve)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanve%2Faccess","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanve%2Faccess","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanve%2Faccess/lists"}