Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter HelgaTheViking

    (@helgatheviking)

    i hate that you can’t edit, b/c I know that admins tend to check on posts w/ no replies first. i’m not bumping my thread, but i’ve been digging into this and have more info to report.

    ————————-

    i have tracked it down to the fact that admin-ajax.php isn’t finding the appropriate ajax action.

    if (open_popup == true) {
                    var data = jQuery('#wpcf-custom-fields-control-form').serialize();  console.log(data);
                    var url = "<?php echo admin_url('admin-ajax.php'); ?>?"+data+"&action=wpcf_ajax&wpcf_action=custom_fields_control_bulk&wpcf_bulk_action="+action+"&keepThis=true&TB_iframe=true&width=400&height=400";
                    var title = jQuery('select[name="'+action_field.attr('name')+'"] option:checked').text();
                    tb_show(title, url);
                    return false;
                }

    taking a look at the resulting console.log(data), i see that the form is already serializing a hidden input called action and it’s value is:
    &action=wpcf-add-to-group-bulk

    but then a couple of lines later the url is adding another action variable. &action=wpcf_ajax

    so now there are 2 actions defined as GET variables.

    i can trace the wpcf_ajax to

    add_action('wp_ajax_wpcf_ajax', 'wpcf_ajax_embedded');

    so the wpcf_ajax_embedded function exists, but there is no switch case for where wpcf_action=custom_fields_control_bulk.

    but there is also no action hook callback for action=wpcf-add-to-group-bulk which is why admin-ajax.php is dying with a 0.

    hope that info helps

    Thread Starter HelgaTheViking

    (@helgatheviking)

    ok, i’m back to report that i found the problem.

    in fields-control.php on line 442:

    echo '<input type="hidden" name="action" value="' . esc_attr($_GET['wpcf_bulk_action']) . '" />';

    should be:

    echo '<input type="hidden" name="wpcf_bulk_action" value="' . esc_attr($_GET['wpcf_bulk_action']) . '" />';

    having it be “action” was causing it to fail with admin-ajax.php since wp_ajax_wpcf_bulk_action isn’t a valid hook.

    but changing the hidden input to “wpcf_bulk_action” allows the function to correctly set the action to the proper ajax action (wpcf_ajax) which is defined manually on line 296.

    var url = "<?php echo admin_url('admin-ajax.php'); ?>?"+data+"&action=wpcf_ajax&wpcf_action=custom_fields_control_bulk&wpcf_bulk_action="+action+"&keepThis=true&TB_iframe=true&width=400&height=400";

    phew: i guess this is resolved, but i won’t mark it as resolved as i hope the devs will see this.

    Hi Helga,
    thanks for finding fix.
    It’s applied and will be included in 1.0.3 release.

    Closing.

    Thread Starter HelgaTheViking

    (@helgatheviking)

    great to hear. glad i could help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Types – Custom Fields and Custom Post Types Management] Bug when adding custom field to Typ’ is closed to new replies.