{"id":1967617,"date":"2025-10-29T13:44:13","date_gmt":"2025-10-29T17:44:13","guid":{"rendered":"https:\/\/theeventscalendar.com\/knowledgebase\/?p=1967617"},"modified":"2026-04-10T12:56:13","modified_gmt":"2026-04-10T16:56:13","slug":"custom-users-export-attendee-data","status":"publish","type":"post","link":"https:\/\/theeventscalendar.com\/knowledgebase\/custom-users-export-attendee-data\/","title":{"rendered":"Granting Custom User Roles Access to Attendee Data"},"content":{"rendered":"\n<p>If you\u2019re managing events and need to allow a user with limited permissions to view or export attendee data, you may notice that the Attendees menu or export button isn\u2019t available\u2014even when permissions seem correctly configured. This article explains why that happens and how to safely open up attendee access using a few small code snippets.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-understanding-the-issue\">Understanding the Issue<\/h3>\n\n\n\n<p>By default, the Attendees admin menu and its sub-pages (like Ticket Fieldsets) require the <code>manage_options<\/code> capability, which is typically reserved for Administrators. Users with other roles\u2014Editor, Contributor, or custom roles\u2014won\u2019t see the menu, and visiting it directly returns a &#8220;You do not have permissions to access this page&#8221; error.<\/p>\n\n\n\n<p>The <strong>Export Attendees<\/strong> feature has its own requirement: it\u2019s gated behind the <code>publish_pages<\/code> capability, which is typically available to Super Admins, Admins, and Editors. So even after a user can see the Attendees list, they may still not see the export button.<\/p>\n\n\n\n<p>Granting <code>manage_options<\/code> or <code>publish_pages<\/code> outright isn\u2019t ideal, since it gives broader access than needed. Thankfully, there\u2019s a safer approach that involves up to three steps: making the menu visible, granting the role enough capability to manage the content, and enabling the export button.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-enable-access-to-the-attendees-list\">Enable access to the Attendees list<\/h3>\n\n\n\n<p>The snippet below lowers the required capability from <code>manage_options<\/code> to <code>edit_posts<\/code>, which Editors and Contributors typically already have.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n&lt;?php\n\/**\n * Lower the capability required for Tickets post type\n * can access the Attendees list and other subpages (e.g., Fieldsets list).\n *\/\nadd_filter( &#039;tec_admin_pages_capability&#039;, function( $capability ) {\n\treturn &#039;edit_posts&#039;;\n} );\n<\/pre><\/div>\n\n\n<p>With this in place, anyone who has the <code>edit_posts<\/code> capability will be able to view the Attendees list on the Tickets post type in the dashboard.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-add-permissions-to-read-edit-delete-or-publish-posts\">Add permissions to read, edit, delete or publish posts<\/h3>\n\n\n\n<p>The Attendees list is now visible, but users still won\u2019t have the permissions they need to edit, publish, or delete content on those pages\u2014like updating an attendee record. The following snippet grants a specific role the capabilities required to fully manage these posts.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n&lt;?php\n\/**\n * Ensure a custom role can read, edit, and publish Ticket Fieldsets.\n *\/\nadd_action( &#039;init&#039;, function () {\n\t\/\/ Replace &#039;sample&#039; with your user role slug.\n\t$role = get_role( &#039;sample&#039; );\n\tif ( ! $role ) {\n\t\treturn;\n\t}\n\n\t$role-&gt;add_cap( &#039;read&#039; );\n\t$role-&gt;add_cap( &#039;edit_posts&#039; );\n\t$role-&gt;add_cap( &#039;edit_others_posts&#039; );\n\t$role-&gt;add_cap( &#039;edit_published_posts&#039; );\n\t$role-&gt;add_cap( &#039;publish_posts&#039; );\n\t$role-&gt;add_cap( &#039;delete_posts&#039; );\n} );\n<\/pre><\/div>\n\n\n<p><strong>Important:<\/strong> Be sure to replace <code>'sample'<\/code> with the slug of your target role (for example, <code>'contributor'<\/code> or your own custom role).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-enable-attendee-export\">Enable attendee export for limited or custom roles<\/h3>\n\n\n\n<p>The ability to <a href=\"https:\/\/theeventscalendar.com\/knowledgebase\/tickets-managing-your-orders-and-attendees\/\" target=\"_blank\" rel=\"noreferrer noopener\">export attendees<\/a> in the <a href=\"https:\/\/theeventscalendar.com\/products\/wordpress-event-tickets\/\">Event Tickets<\/a> plugin is controlled by the <code>tec_tickets_attendees_user_can_export_csv<\/code> filter. You can use it to extend export access to other roles\u2014for example, allowing users with the <code>edit_posts<\/code> capability (such as Contributors) to export attendee lists. Add the following snippet to your site:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nadd_filter( &#039;tec_tickets_attendees_user_can_export_csv&#039;, function( $can_export ) {\n    \/\/ If current user can edit posts (is a contributor), allow attendee export.\n    return current_user_can( &#039;edit_posts&#039; );\n});\n\n<\/pre><\/div>\n\n\n<p>This lets users with limited permissions export attendees while keeping your overall site permissions tightly scoped. The same filter can also target a specific custom role\u2014just replace the capability check with logic that confirms the current user has your role slug.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-adding-custom-code-to-your-site\">Adding custom code to your site<\/h3>\n\n\n\n<p>You can add these PHP snippets to your theme\u2019s <code>functions.php<\/code> file, but we recommend using a dedicated code snippets plugin like <strong><a href=\"https:\/\/wordpress.org\/plugins\/code-snippets\/\" target=\"_blank\" rel=\"noreferrer noopener\">Code Snippets<\/a><\/strong> so your changes survive theme updates. For more details, see our guide on the <a href=\"https:\/\/theeventscalendar.com\/knowledgebase\/best-practices-for-implementing-custom-code-snippets\/\">best practices for implementing custom code snippets<\/a>.<\/p>\n\n\n\n<p>Once the snippets are in place, make sure the target role has the base capabilities (like <code>edit_posts<\/code>) enabled in your user role management plugin. Then log in as that user and confirm that the Attendees menu is visible and the <strong>Export Attendees<\/strong> button appears on the Attendees page.<\/p>\n\n\n\n<p><strong>Related Articles:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/wordpress.org\/plugins\/code-snippets\/\" target=\"_blank\" rel=\"noreferrer noopener\">Using the Code Snippets Plugin<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/wordpress.org\/documentation\/article\/roles-and-capabilities\/\" target=\"_blank\" rel=\"noreferrer noopener\">Managing User Roles and Capabilities in WordPress<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/theeventscalendar.com\/knowledgebase\/how-to-export-the-attendee-list-with-all-custom-fields\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Export Attendees in Event Tickets<\/a><\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>If you\u2019re managing events and need to allow a user with limited permissions to view or export attendee data, you may notice that the Attendees menu or export button isn\u2019t available\u2014even when permissions seem correctly configured. This article explains why that happens and how to safely open up attendee access using a few small code&#8230;<\/p>\n","protected":false},"author":62,"featured_media":1955565,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_swpsp_post_exclude":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"ep_exclude_from_search":false,"footnotes":""},"categories":[59],"tags":[297],"stellar-product-taxonomy":[155,156],"class_list":["post-1967617","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php-function-snippets","tag-roles-capabilities","stellar-product-taxonomy-event-tickets","stellar-product-taxonomy-event-tickets-plus"],"acf":[],"taxonomy_info":{"category":[{"value":59,"label":"PHP Functions &amp; Snippets"}],"post_tag":[{"value":297,"label":"Roles and Capabilities"}],"stellar-product-taxonomy":[{"value":155,"label":"Event Tickets"},{"value":156,"label":"Event Tickets Plus"}]},"featured_image_src_large":["https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/02\/social-share-1024x538.png",1024,538,true],"author_info":{"display_name":"Darian","author_link":"https:\/\/theeventscalendar.com\/knowledgebase\/author\/darian\/"},"comment_info":0,"category_info":[{"term_id":59,"name":"PHP Functions &amp; Snippets","slug":"php-function-snippets","term_group":0,"term_taxonomy_id":59,"taxonomy":"category","description":"","parent":24,"count":127,"filter":"raw","term_order":"0","cat_ID":59,"category_count":127,"category_description":"","cat_name":"PHP Functions &amp; Snippets","category_nicename":"php-function-snippets","category_parent":24}],"tag_info":[{"term_id":297,"name":"Roles and Capabilities","slug":"roles-capabilities","term_group":0,"term_taxonomy_id":297,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw","term_order":"0"}],"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1967617","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/users\/62"}],"replies":[{"embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=1967617"}],"version-history":[{"count":4,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1967617\/revisions"}],"predecessor-version":[{"id":1968769,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1967617\/revisions\/1968769"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media\/1955565"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=1967617"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=1967617"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=1967617"},{"taxonomy":"stellar-product-taxonomy","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/stellar-product-taxonomy?post=1967617"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}