• Hi, i had some notices appearing on the form edit page:
    PHP Notice: Undefined offset: 0 in ***/wp-includes/capabilities.php on line 155
    i fixed it by changing line 22 of admin.php
    changed
    if ( current_user_can( ‘wpcf7_edit_contact_form’ ) ) {
    to
    if ( current_user_can( ‘wpcf7_edit_contact_forms’ ) ) {
    notice then disappears and plugin seems fine.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Jules Colle

    (@jules-colle)

    Interesting. Both the capabilities wpcf7_edit_contact_form and wpcf7_edit_contact_forms seem to exist, but they don’t appear to be well documented.

    Here both capabilities are used in the same file:
    https://github.com/wp-plugins/contact-form-7/blob/master/admin/edit-contact-form.php#L34-L56

    Taking a quick glance, it’s not clear to me what the exact difference is and why one seems to throw a notice and the other doesn’t.

    Once I understand what’s happening and why, I’d be happy to change my plugin code accordingly. Any insights are welcome.

    EDIT: Oh I see now. wpcf7_edit_contact_form seems to require a form ID as extra parameter. wpcf7_edit_contact_forms is more general. Yeah, makes sense to change this, thanks for the bug report!

    • This reply was modified 2 years, 4 months ago by Jules Colle.
Viewing 1 replies (of 1 total)
  • The topic ‘some notices appearing: fix suggested’ is closed to new replies.