• Resolved therealgilles

    (@chamois_blanc)


    Hello,

    I just updated to the Events Calendar (and Pro) v6 release and I am getting the following PHP fatal error when trying to edit events. Not sure if it is related to the Pods plugin but the stack trace mentions the plugin so I thought I would bring it to your attention. I am using Pods to add a custom field to the tribe_event post type.

    [18-Sep-2022 19:40:51 UTC] PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function TotalTheme\Integration\Relevanssi::parse_title(), 1 passed in .../public_html/wp-includes/class-wp-hook.php on line 307 and exactly 2 expected in .../public_html/wp-content/themes/Total/inc/integration/relevanssi.php:63
    Stack trace:
    #0 .../public_html/wp-includes/class-wp-hook.php(307): TotalTheme\Integration\Relevanssi::parse_title('dj-dance-party-...')
    #1 .../public_html/wp-includes/plugin.php(191): WP_Hook->apply_filters('dj-dance-party-...', Array)
    #2 .../public_html/wp-content/plugins/pods/classes/fields/pick.php(2795): apply_filters('the_title', 'dj-dance-party-...')
    #3 .../public_html/wp-content/plugins/pods/classes/fields/pick.php(1962): PodsField_Pick->get_object_data(Array)
    #4 .../public_html/wp-content/plugins/pods/classes/PodsForm.php(243): PodsField_Pick->data('pods_meta_li in .../public_html/wp-content/themes/Total/inc/integration/relevanssi.php on line 63
Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Support pdclark

    (@pdclark)

    The stack trace says the Total theme integration for Relevanssi is trying to use add_filter, probably on the_title, with too few arguments. the_title takes two arguments: title and post ID, for example.

    Thread Starter therealgilles

    (@chamois_blanc)

    Correct but the call with two arguments comes from here:

    // pods/classes/fields/pick.php:
    $result[ $field_index ] = call_user_func_array( 'apply_filters', $filter_args );

    in the Pods plugin, as:

    FILTER_ARGS = Array
    (
        [0] => the_title
        [1] => ...event slug here...
    )

    The ID 2nd parameter is missing. Somehow it’s calling the_title on an event slug.

    • This reply was modified 3 years, 8 months ago by therealgilles.
    Thread Starter therealgilles

    (@chamois_blanc)

    My custom field is configured to use {@permalink} as Display Field in Selection List. I see the $field_index var is changed from post_title to post_name, leading to the_title being called with the slug.

    Thread Starter therealgilles

    (@chamois_blanc)

    I have trouble understanding why the following call:

    $display_filter_args = pods_v( 'display_filter_args', pods_v( $field_index, $search_data->pod_data['object_fields'] ) );

    results in the FILTER_ARGS above, when $field_index is post_name. There lies the problem.

    Plugin Support pdclark

    (@pdclark)

    The quickest route to a solution would be to file a bug at https://github.com/pods-framework/pods/issues/new/choose with a Pods Package Export (Pods Admin > Components > Import/Export Packages) and a site Health Check report, which will list the plugins and versions being used.

    Thread Starter therealgilles

    (@chamois_blanc)

    Thanks for the quick replies. I need to fix this up today, so trying to figure out what I can do right now. Somehow the default field_index gets set to post_title for the tribe_events post type. Which is probably closer to the source of the issue. Feels odd that a post title would be the default field index, to me.

    default_field_index = post_title

    If you have a hint on how the default field index is computed, let me know (well if you have time).

    Thread Starter therealgilles

    (@chamois_blanc)

    Okay, I tried reverting the TEC plugins and same result so it’s not due to the update.

    I see the Total theme reactivated this the_title filter in their most recent update:

    -               // add_filter( 'the_title', __CLASS__ . '::parse_title', 10, 2 );
    +               add_filter( 'the_title', __CLASS__ . '::parse_title', 10, 2 );
    

    so looks like the bug lies in the Pods plugin, and it may have been there for a while, as far as I can tell. Will file the issue on GitHub.

    Thread Starter therealgilles

    (@chamois_blanc)

    Okay I understand the default field index as post title. Now I see that $display_filter is computed as:

    $display_filter = pods_v( 'display_filter', pods_v( $search_data->field_index, $search_data->object_fields ) );

    but then the field index is changed in the $results for loop. So I would think that $display_filter needs to be recomputed with the new field index before being used.

    Thread Starter therealgilles

    (@chamois_blanc)

    Looks like the bug was already filed here but got closed mistakenly.

    Thread Starter therealgilles

    (@chamois_blanc)

    Adding the following line seems to fix the bug:

                $display_filter = pods_v( 'display_filter', pods_v( $field_index, $search_data->object_fields ) ); // <-- ADD THIS
    
                if ( 0 < strlen( $display_filter ) ) {
    Thread Starter therealgilles

    (@chamois_blanc)

    Plugin Author Jory Hogeveen

    (@keraweb)

    Than you for your research!
    Closing here in favor of GitHub~and will reply there.

    Cheers, Jory

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

The topic ‘Possible integration issue with tribe_event post type’ is closed to new replies.