• Resolved Benjamin Dubé

    (@bdube30)


    Hi,

    I found a bug. When we activate the Advanced share method, and a post doesn’t have a featured image, it’s cause an error, because the function get_the_post_thumbnail_url() doesn’t get an image (on line 498 and 610 of wp-linkedin-auto-publish.php).

    For my need I’ve done a quick fix like this for the two places :

    if ( has_post_thumbnail() ) {
                $json = json_encode( array(
                    'visibility' => array(
                        'code' => $options['wp_linkedin_autopublish_share_with']
                    ),
                    'comment' => $linkedinComment,
                    'content' => array(
                        'submitted‐image-url' => get_the_post_thumbnail_url($post->ID, 'full'),
                        'title' => html_entity_decode(get_the_title($post->ID)),
                        'submitted-url' => get_permalink($post->ID),
                        'description' => get_the_excerpt($post->ID)
                    ),
                ) );
            } else {
                $json = json_encode( array(
                    'visibility' => array(
                        'code' => $options['wp_linkedin_autopublish_share_with']
                    ),
                    'comment' => $linkedinComment,
                    'content' => array(
                        'title' => html_entity_decode(get_the_title($post->ID)),
                        'submitted-url' => get_permalink($post->ID),
                        'description' => get_the_excerpt($post->ID)
                    ),
                ) );
            }

    But I’m not a developper, so there maybe/probably a best way to fix this.

    I will stay tuned for next update, because I hate to have to modify plugin file!

    Thank you,

    Benjamin Dubé

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Northern Beaches Websites

    (@northernbeacheswebsites)

    Hi Benjamin,

    Thanks for your comment and contributing to the plugin, I appreciate it! I am definitely keen to resolve any issue you are having.

    I did a test on my end of a post with no featured image and with the settings set to advanced mode and I didn’t experience any error and the post still published to LinkedIn it just doesn’t have an image. But I didn’t experience any error or anything. You can checkout this screenshot here showing my test post: https://www.dropbox.com/s/jf478gjww82z2yt/Screenshot.jpg?dl=0

    Can you describe what this error is, like what it says exactly, where you are seeing it? A screenshot would be great if you can.

    Thanks,

    Thread Starter Benjamin Dubé

    (@bdube30)

    Hi,

    I have realized, that is due to the old verison of WordPress that the website I work on is (3.9.23), and the function get_the_post_thumbnail_url() does not exist yet in WordPress.

    Sorry for the trouble,

    I will highly suggest to our client to update their website.

    Benjamin Dubé

    Plugin Author Northern Beaches Websites

    (@northernbeacheswebsites)

    Ah good to know – definitely worth updating WordPress for security reasons. Thanks,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Error 500 when using advanced sharing mode with post without image’ is closed to new replies.