• Resolved 7movies

    (@7movies)


    First thank you for this plugin, it works perfectly, except that sometimes it does not import information some movies, I don’t know why! The title is exatement like IMDB, I even tried with ID movies but it still does not work,

    I Use this function:

    function like_content($content) {
    if (is_single()) {
                    $original = $content;
    		$t=get_the_title();
    		$y=get_imdb_movie_detail($t, "year" );
                    $content = "<div>Year : <a href='https://romance7movies.com/tag/".$y."/'><b>";
    		$content .= $y;
    		$content .= "</a></b></div>";
                    $content = $original.$content;
    }
    return $content;
    }
    add_filter('the_content','like_content', 0);

    This is the final result normaly : Romance Movies

    But somtimes, it dosen’t import informations.

    Some idea plz?

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author thaikolja

    (@thaikolja)

    Thanks for your input.

    From what I see it rather looks like it’s your function’s fault. Right now like_content() only returns the – untouched – post content. You’d have to add $y to $content (e.g. $content = $content . $year). Let me know if that worked.

    By the way, hooking the_content is a bit unflexible since it’ll affect all the_content() calls (on front page, in widgets, archives and so on). Better implement it in the loop for example in your singles.php.

    And another by the way: I’m working on a major update right now that brings a lot of new functions and changes. If you have any ideas for improving the plugin, let me know.

    Edit: Oh, I see you’ve just updated your post. So the information is only sometimes imported? You mean if you refresh the post, sometimes it works and sometimes it doesn’t?

    Thread Starter 7movies

    (@7movies)

    no, it’s not that the informations is cleared by refreshing the page, but sometimes function brings just nothing.

    Plugin Author thaikolja

    (@thaikolja)

    Can you show me an example post where no information is being shown? Also, do you use “allo caching”?

    Thread Starter 7movies

    (@7movies)

    that’s it: Pompeii

    Also this one: Winter’s tale

    Thread Starter 7movies

    (@7movies)

    What is “Allo chaching”? is that a plugin?

    Plugin Author thaikolja

    (@thaikolja)

    No, the function on the settings page of IMDb Connector (Admin > Settings > IMDb Connector).

    Thread Starter 7movies

    (@7movies)

    Yes it’s Enabled

    Plugin Author thaikolja

    (@thaikolja)

    I’ve tested everything on my servers and it all seems fine.

    Try deleting the cached file or – if you want to keep the valid cache files – see if there’re some empty .tmp files within your /wp-content/plugins/imdb-connector/cache/ directory. If yes, delete these and refresh the movie page.

    Thread Starter 7movies

    (@7movies)

    Yes, you’re right, now it’s good for “pompeii” post, but stil the same probleme in this post: Winter’s tale

    You do not think that the apostrophe on the title can cause the problem?

    Plugin Author thaikolja

    (@thaikolja)

    You’re right. In most themes, WordPress changes the default apostrophe (&#39) with another one (&#146). For a simple fix you can run the titles that you send to IMDb through

    $title = str_replace("’", "'", get_the_title());

    I’ll implement some safer methods to validate the title in the next version. Thanks for pointing that out.

    Thread Starter 7movies

    (@7movies)

    it dosen’t work with str_replace! i try to see what urlencode(get_the_title()); give… and it replace the apostroph with: %26%238217%3B !!!! this is what result when i apply urlencode on the title: Winter’s Tale: Winter%26%238217%3Bs+Tale

    Strange no?

    Plugin Author thaikolja

    (@thaikolja)

    Over here it works just fine. Why would you use urlencode()? IMDb Connector processes the post title through rawurlencode() itself to make it URL friendly before sending it to the API. Just using str_replace("’", "'", get_the_title()); should be fine.

    Edit: Ah, now I see it. I used ’ instead if ‘. Let me see…

    Plugin Author thaikolja

    (@thaikolja)

    Alright, got it. WordPress uses wptexturize() to render the title. You have to either remove the filter completely or remove it, send the title to the IMDb Connector function and activate it again (if you want to keep the fancy single quote). Here’s an example:

    remove_filter("the_title", "wptexturize");
    echo get_imdb_movie_detail(get_the_title(), "year");
    add_filter("the_title", "wptexturize");

    Or a gentle version:

    if(strstr($title, "%26%238217%3B")) {
    	$title = urlencode($title);
    	$title = str_replace("%26%238217%3B", "'", $title);
    	$title = urldecode($title);
    }

    This will be done automatically in the next version of the plugin.

    Thread Starter 7movies

    (@7movies)

    it works magically when applaying the filter wptexturize. ??

    You are the best, thank you very much (y)

    Thread Starter 7movies

    (@7movies)

    Also, remember to edit the url of the movie poster, it references an invalid url

    For me, I’ve fix it this way:

    $poster0=get_imdb_movie_detail($title, "poster" );
    $poster= str_replace("https://mywebsite.com/wp-content/plugins//home/xxx/public_html/xxx", '', $poster0);

    Thanks again.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘IMDb Connector don't import some movies informations!’ is closed to new replies.