• Resolved hadimneef

    (@hadimneef)


    Hi, Is there any way to pull content from one blog to another via api?
    I know there’s broadcast_children() function which takes post id and child blog id… What I want is the opposite post id and PARENT blog id.

    Something else, I want to give the the blog admin of child post the flexibility to change anything but when parent post deleted, all children deletes. How can I achieve that?

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

    (@edward_plainview)

    You can “pull” content by doing a switch_to_blog() to the parent blog and then broadcast_children().

    Regarding your second point, it should already be so that whatever happens to the parents also happens to the linked children: updating, trashing, restoring and deleting. Is that not the case?

    Thread Starter hadimneef

    (@hadimneef)

    Thank you, Yes switch to blog should solve the problem.

    The second point, if child post updated the post title does that make it unlinked from parent post automatically? If yes then is there a way to not unlink it after any change? If no it shouldn’t be unlinked automatically then its my fault as I did modified some of the plugin codes for testing.
    I’m asking that because I want to make posts repository inside the network where every site could post and pull posts from that repository, then whoever pulled a post he can modify it as he want “basically translate it” but when the original post deleted, it should also delete all of the copied posts. In simple words the parent post should not have any control on children posts other than deleting them.

    Thank you in advance.

    • This reply was modified 6 years, 3 months ago by hadimneef.
    • This reply was modified 6 years, 3 months ago by hadimneef.
    Plugin Author edward_plainview

    (@edward_plainview)

    The posts do not automatically unlink, but there’s an add-on for that: Unlink On Edit.

    Then you mention that nothing should happen to the child posts other than deletions. Perhaps you can do this by just disabling all updates?

    You can do this by hooking into broadcasting_after_switch_to_blog and setting ->broadcast_here to false all the time. You can query whether this is a new broadcast or an update using

    $bcd->parent_broadcast_data->has_linked_child_on_this_blog()

    Thread Starter hadimneef

    (@hadimneef)

    I will try it, Thank you so much!

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

The topic ‘Pull content’ is closed to new replies.