• Resolved codesmith32

    (@codesmith32)


    I updated Contact Form 7 from v6.0.6 to v6.2.3. Now none of my forms can be edited (??).
    I just get an error whenever trying to edit them:

    Cannot load wpcf7.

    Should I downgrade? How do I edit the contact forms again?

    Details:

    • WP 7.1.3
    • Plugin version 6.2.3
    • PHP 8.3

    I currently have WP debug mode enabled with logging on but display off. Nothing related to Contact Form 7 appears in the debug log when trying to load the page.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Where can we see the website in question?

    Thread Starter codesmith32

    (@codesmith32)

    Thread Starter codesmith32

    (@codesmith32)

    Note, I cannot provide a login. However, I’m a developer with full cPanel access. Feel free to provide instructions, and I’ll report whatever details needed (redacting security information, of course).

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    What other plugins and theme do you use on the site?

    Thread Starter codesmith32

    (@codesmith32)

    The major plugins the site uses include WooCommerce, some of the EventON plugins, and some of the Sabai directory listing plugins. The theme is Divi.

    I’m willing to provide a full list with version information, but not publically. If you’d like more detail, let me know how I can send a PM.

    I’ll do a little digging in the meantime, and try to track down the point of failure.

    Thread Starter codesmith32

    (@codesmith32)

    Update:

    I added some logs, and determined that the menu registration code is reached:
    https://github.com/rocklobster-in/contact-form-7/blob/trunk/admin/admin.php#L54

    However, the menu renderer is not getting reached when visiting the editor page:
    https://github.com/rocklobster-in/contact-form-7/blob/trunk/admin/admin.php#L465

    For clarity, the form list page does load (?page=wpcf7).
    But not a single form edit page (?page=wpcf7&post=…&action=edit).

    I also tried replacing the wpcf7_read_contact_forms capability requirement with manage_options to see if it was a capability issue, but that didn’t fix it either.

    Thread Starter codesmith32

    (@codesmith32)

    I found the issue:

    I discovered that, when ‘post’ appears as a parameter in the query string, the page has a different parent:

    • When ‘post’ is absent, the parent page is admin.php – which is correct.
    • But, when ‘post’ is present, the parent page suddenly becomes
      admin.php?post_type=wpcf7_contact_form

    This switch, of course, causes get_plugin_page_hookname to generate the wrong hookname for the registered submenu page:
    Instead of contact_page_wpcf7, which is returned by the add_submenu_page call, it gets admin_page_wpcf7, which of course doesn’t exist.

    To be clear, I’m not sure where this behavior comes from, whether WP or a plugin or theme. What I can say, though, is that, if I change the query variable name to something other than ‘post’ here, it works:

    https://github.com/rocklobster-in/contact-form-7/blob/trunk/admin/admin.php#L441

    I will check to find the source of this behavior.

    Thanks

    Thread Starter codesmith32

    (@codesmith32)

    Yep. I’ve confirmed this is a bug due to the EventON plugin, which screws with global $typenow variable. It has the following code snippet (and variants) copied all over the codebase:

    if ( $typenow == 'post' && ! empty( $_GET['post'] ) ) {
    $typenow = $post->post_type;
    } elseif ( empty( $typenow ) && ! empty( $_GET['post'] ) ) { // <---
    $post = get_post( $_GET['post'] );
    $typenow = $post->post_type; // <---
    }

    As horrific as the EventON plugin code is… is this something you’d be willing to fix on your end?

Viewing 8 replies - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.