• Resolved GainLine

    (@gainline)


    Hi there,

    When trying to broadcast we ran into a problem where there would be an issue when switching to blog.

    I did some debugging on found that the line which failed was the following.

    [09-Jul-2024 18:09:01 UTC] PHP Fatal error: Uncaught Error: Call to a member function get_linked_child_on_this_blog() on null in /httpdocs/wp-content/plugins/threewp-broadcast-premium-pack/src/gutenberg_protect/Gutenberg_Protect.php:34

    Looking further, i was able to fix the issue by amending the following code in the following file.

    threewp-broadcast-premium-pack/src/gutenberg_protect/Gutenberg_Protect.php:34

    $child_post_id = $bcd->broadcast_data->get_linked_child_on_this_blog(); if ( ! $child_post_id ) return;

    to

    $child_post_id = $bcd->broadcast_data?->get_linked_child_on_this_blog() ?? null; if ( ! $child_post_id ) return;

    Could you advise if this is a bug, or why this is happening?

    Thanks

    Jonathan

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author edward_plainview

    (@edward_plainview)

    From a quick look, that can only happen if you are not using the “link this post” checkbox in the meta box during broadcasting.

    Is that the case?

    Blocks can only be protected if there is an existing child post, so that the blocks can be extracted and saved.

    Thread Starter GainLine

    (@gainline)

    Hi,

    Our client has requested NOT to keep the link between posts as once broadcasted they then make regional content changes.

    Is there anyway to implement the suggested fix into the broadcast function as this was their primary requirement and it does stop this happening when broadcasted?

    Otherwise we will have to manually apply this fix everytime the plugin is updated.

    M

    Plugin Author edward_plainview

    (@edward_plainview)

    It’s no problem for me to add that patch to the code.

    Could you try replacing the first part of the function with this?

       $bcd = $action->broadcasting_data;
    $this->protected_blocks = [];

    // broadcast_data only exists if linking is enabled.
    if ( ! $bcd->broadcast_data )
    return;

    // Does this child exist?
    $child_post_id = $bcd->broadcast_data->get_linked_child_on_this_blog();
    if ( ! $child_post_id )
    return;
    Thread Starter GainLine

    (@gainline)

    Thanks for this, the fix has been working for a couple of weeks now.

    Is it possible for you to implement this into any future updates to the premium plugin?

    Thanks

    Jonathan

    Plugin Author edward_plainview

    (@edward_plainview)

    If have added it to the code today and it will be released officially in the next version.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.