Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: place content distribution behind a constant #162

Merged

Conversation

miguelpeixe
Copy link
Member

Place the feature behind a constant so it can be merged to trunk and we can work outside of epic branches.

As we are still without any UI, the constant will only prevent hooks from allowing distribution to occur. The classes and methods should remain available via code.

Testing

  1. Set define( 'NEWPACK_NETWORK_CONTENT_DISTRIBUTION', true ); in your wp-config.php
  2. Make sure you have a network setup with at least 1 hub and 1 node
  3. On the hub, create a new post and configure its distribution:
$post_id = 0; // Change to your post ID.
$outgoing_post = new Newspack_Network\Content_Distribution\Outgoing_Post( $post_id );
$outgoing_post->set_config( [ 'http://node1.local' ] ); // Change to match your node URL.
Newspack_Network\Content_Distribution::distribute_post( $outgoing_post );
  1. Confirm the node receives the post
  2. Change the constant to false in wp-config.php
  3. Make a change to the original post and save
  4. Confirm the changes are not distributed

@miguelpeixe miguelpeixe self-assigned this Dec 10, 2024
@miguelpeixe miguelpeixe requested a review from a team as a code owner December 10, 2024 16:34
@miguelpeixe miguelpeixe requested a review from naxoc December 10, 2024 16:34
Copy link
Member

@naxoc naxoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works! 👍

@miguelpeixe miguelpeixe merged commit e5f3622 into epic/content-distribution Dec 12, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants