Skip to content

Commit

Permalink
Merge pull request #944 from Codeinwp/fix/custom-image-tag-import
Browse files Browse the repository at this point in the history
fix: use the user defined custom image tag
  • Loading branch information
vytisbulkevicius authored May 30, 2024
2 parents 8355268 + 1daf2ed commit 794270e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cypress/e2e/default/import_feed_free.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ describe('Test Free - Import Feed', function() {

cy.get('[name="feedzy_meta_data[import_post_title]"]').clear({force: true}).invoke('val', PREFIX + feed.title).blur({force: true});
cy.get('[name="feedzy_meta_data[import_post_content]"]').clear({force: true}).invoke('val', PREFIX + feed.fullcontent.content + feed.content).blur({force: true});
cy.get('[name="feedzy_meta_data[import_post_featured_img]"]').clear({force: true}).invoke('val', feed.image.url).blur({force: true});
cy.get('[name="feedzy_meta_data[import_post_featured_img]"]').clear({force: true}).invoke('val', feed.image.tag).blur({force: true});

// check disallowd magic tags
const tags = feed.tags.disallowed;
Expand Down Expand Up @@ -184,7 +184,7 @@ describe('Test Free - Import Feed', function() {
cy.get('[name="feedzy_meta_data[import_post_content]"]').should('have.value', PREFIX + feed.fullcontent.content + feed.content + '\n');

// image from URL
cy.get('[name="feedzy_meta_data[import_post_featured_img]"]').should('have.value', feed.image.url);
cy.get('[name="feedzy_meta_data[import_post_featured_img]"]').should('have.value', feed.image.tag);

// publish
cy.get('button[type="submit"][name="publish"]').scrollIntoView().click({force:true});
Expand Down
4 changes: 2 additions & 2 deletions includes/admin/feedzy-rss-feeds-import.php
Original file line number Diff line number Diff line change
Expand Up @@ -1663,7 +1663,7 @@ private function run_job( $job, $max ) {
$image_source_url = '';
$img_success = true;
$new_post_id = 0;
$default_img_tag = ! empty( $import_featured_img ) ? '[#item_image]' : '';
$default_img_tag = ! empty( $import_featured_img ) && is_string( $import_featured_img ) ? $import_featured_img : '';

// image tag
if ( strpos( $default_img_tag, '[#item_image]' ) !== false ) {
Expand Down Expand Up @@ -1770,7 +1770,7 @@ function( $term ) {

do_action( 'feedzy_import_extra', $job, $item_obj, $new_post_id, $import_errors, $import_info );

$default_img_tag = ! empty( $import_featured_img ) ? '[#item_image]' : '';
$default_img_tag = ! empty( $import_featured_img ) && is_string( $import_featured_img ) ? $import_featured_img : '';
if ( ! empty( $default_img_tag ) && 'attachment' !== $import_post_type ) {
$image_source_url = '';
$img_success = true;
Expand Down

0 comments on commit 794270e

Please sign in to comment.