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

Postie posts don't display featured image #926

Closed
AndreeaCristinaRadacina opened this issue Mar 1, 2024 · 5 comments
Closed

Postie posts don't display featured image #926

AndreeaCristinaRadacina opened this issue Mar 1, 2024 · 5 comments
Assignees
Labels
bug This label could be used to identify issues that are caused by a defect in the product. doc-needed This issue requires documentation updates or additions once it has been completed. medium (1d) - This label is used for issues that can be completed within 1 day or less. Priority-Medium Expected resolution time - up to 1 month.

Comments

@AndreeaCristinaRadacina
Copy link

AndreeaCristinaRadacina commented Mar 1, 2024

Description

A user that uses Postie to convert emails into WP posts mentions that the posts started to not display the featured image anymore after the latest update.

The only way to make the featured image work is to go to the posts and manually publish them.

Might be related to this - https://github.com/Codeinwp/tweet-old-post-pro/issues/471

Step-by-step reproduction instructions

  1. Configure ROP to share posts on Facebook
  2. Send an email to the admin address from Postie
  3. Check how the posts appear on the Facebook page

Screenshots, screen recording, code snippet or Help Scout ticket

Screenshot 2024-03-01 at 17 22 14 Screenshot 2024-03-01 at 17 19 18

Environment info

No response

Is the issue you are reporting a regression

Yes, this is a regression.

@AndreeaCristinaRadacina AndreeaCristinaRadacina added the bug This label could be used to identify issues that are caused by a defect in the product. label Mar 1, 2024
@pirate-bot pirate-bot added the regression Issue represents a change in behavior from a previous version that is not intended or desired.. label Mar 1, 2024
@vytisbulkevicius vytisbulkevicius removed the regression Issue represents a change in behavior from a previous version that is not intended or desired.. label Mar 4, 2024
@vytisbulkevicius vytisbulkevicius added the Priority-Medium Expected resolution time - up to 1 month. label Mar 4, 2024
@AndreeaCristinaRadacina
Copy link
Author

More details can be found here - https://secure.helpscout.net/conversation/2510363899/404627/

@Soare-Robert-Daniel Soare-Robert-Daniel added the medium (1d) - This label is used for issues that can be completed within 1 day or less. label Mar 7, 2024
@Soare-Robert-Daniel
Copy link
Contributor

One thing to note here is that user is using a custom script to hook the postie to ROP:

/**
 * Postie post after.
 *
 * @param array $details Post data.
 * @return void
 */
function rop_postie_post_after( $details ) {
	if ( empty( $details['ID'] ) ) {
		return;
	}
	if ( ! class_exists( '\Rop_Admin' ) ) {
		return;
	}
	$rop_admin = new \Rop_Admin();

	$services = new \Rop_Services_Model();
	$settings = new \Rop_Settings_Model();
	$enabled  = array();

	$active                       = array_keys( $services->get_active_accounts() );
	$instant_share_custom_content = array();

	foreach ( $active as $account_id ) {
		$content = ! empty( $details['post_content'] ) ? $details['post_content'] : '';
		$content = strip_shortcodes( $content );
		$content = wp_strip_all_tags( html_entity_decode( $content, ENT_QUOTES ) );
		$content = trim( $content );

		$instant_share_custom_content[ $account_id ] = $content;
	}

	// If user wants to run this operation on page refresh instead of via Cron.
	if ( $settings->get_true_instant_share() ) {
		$rop_admin->rop_cron_job_publish_now( $post_id, $instant_share_custom_content );
		return;
	}

	update_post_meta( $post_id, 'rop_publish_now', 'yes' );
	update_post_meta( $post_id, 'rop_publish_now_accounts', $instant_share_custom_content );

	$cron = new Rop_Cron_Helper();
	$cron->manage_cron( array( 'action' => 'publish-now' ) );
}
add_action( 'postie_post_after', 'rop_postie_post_after' );

Conversation: https://secure.helpscout.net/conversation/2433651127/394480/


The user reported that this script was working until the last release. He reported that the normal workflow for featured images is working but on this custom script.

Also as a side note, the custom script is pretty hacky since it uses the custom content feature to display the post's content instead of normal workflow.

Also, we should implement a simple hook for this type of usage so that people can easily integrate it with ROP.

@Soare-Robert-Daniel
Copy link
Contributor

Soare-Robert-Daniel commented Mar 8, 2024

I checked the script, and it is working. Also, the script can be written as (to be more like the real implementation):

/**
 * Hook the Revive Old Post sharing process to the Postie plugin.
 * 
 * This will mark the post as ready to publish now and start the sharing process.
 *
 * @param array $details Post data.
 * @return void
 */
function rop_postie_post_after( $details ) {
	
	if ( empty( $details['ID'] ) ) {
		return;
	}

	// Check if the plugin is installed and available.
	if ( ! class_exists( '\Rop_Admin' ) ) {
		return;
	}

	$postie_post_id = $details['ID']; // The ID of the post that was just created by Postie.

         // Pull the options for available Social Media accounts.
	$services = new \Rop_Services_Model();
	$active_social_accounts  = array_keys( $services->get_active_accounts() );
	$accounts_to_share_the_post = array();

        // Add them to the sharing list.
	foreach ( $active_social_accounts as $account_id ) {
		$accounts_to_share_the_post[ $account_id ] = "";
	}
       
	// Mark the post as ready to publish now and save the list of Social Media accounts to share the post.
	update_post_meta( $postie_post_id, 'rop_publish_now', 'yes' );
	update_post_meta( $postie_post_id, 'rop_publish_now_accounts', $accounts_to_share_the_post );

	$rop_admin = new \Rop_Admin();
	$rop_admin->rop_cron_job_publish_now( $postie_post_id, $accounts_to_share_the_post ); // Start the sharing process.	
}
add_action( 'postie_post_after', 'rop_postie_post_after' );

@AndreeaCristinaRadacina
Copy link
Author

@Soare-Robert-Daniel will this solve the issue, or are there any other steps that I have to wait for?

@Soare-Robert-Daniel
Copy link
Contributor

@AndreeaCristinaRadacina, you can share this code the users and see if it makes a difference: #926 (comment)

Otherwise, we will need some screenshots of the Revive Old Post plugin settings. For the Postie plugin, we will need screenshots with those tabs:

Image

@vytisbulkevicius vytisbulkevicius added the doc-needed This issue requires documentation updates or additions once it has been completed. label Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This label could be used to identify issues that are caused by a defect in the product. doc-needed This issue requires documentation updates or additions once it has been completed. medium (1d) - This label is used for issues that can be completed within 1 day or less. Priority-Medium Expected resolution time - up to 1 month.
Projects
None yet
Development

No branches or pull requests

4 participants