• Hi,

    I have added
    ‘read_wpcf7’
    ‘manage_wpcf7’

    capabilitied to my user role editor to restrict access to contact form 7

    How can I add these capabilities into the Contact Forms Group on the left? Currently they only show in All

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Vladimir Garagulya

    (@shinephp)

    “Contact Form 7” plugin declares own custom user capabilities and protects its admin menu this way:

    Contact wpcf7_read_contact_forms
    Contact Forms wpcf7_read_contact_forms
    Add New wpcf7_edit_contact_forms
    Integration wpcf7_manage_integration

    But really plugins maps them to these WordPress built-in capabilities:

    
    'wpcf7_edit_contact_form' => 'publish_pages',
    'wpcf7_edit_contact_forms' => 'publish_pages',
    'wpcf7_read_contact_forms' => 'edit_posts',
    'wpcf7_delete_contact_form' => 'publish_pages',
    'wpcf7_manage_integration' => 'manage_options'
    

    So you can use these built-in capabilities to manage access to the “Contact” menu.
    If you wish to use another capabilities it’s possible to change this mapping via filter ‘wpcf7_map_meta_cap’. This filter takes a single parameter – array with a default mapping of user capabilities, like shown above.

    Plugin Author Vladimir Garagulya

    (@shinephp)

    I published more details here.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add Custom capability to group’ is closed to new replies.