• Resolved bartas139

    (@bartas139)


    Hi I have some problems with getting details from IMDb, I have this code

    <?php
    $movie = get_post_custom_values("imdb");
    $vote = get_imdb_movie($movie[0]);
        echo $vote["year"];
    ?>

    And it works very well, it displays the year of movie with specificed ID, but when I want to get Country, Actors, Writers, Director… it doesnt work

    <?php
    $movie = get_post_custom_values("imdb");
    $vote = get_imdb_movie($movie[0]);
        echo $vote["director"];
    ?>

    And one bonus question. Imdbrating works well, but a few days ago the rating has lost by the older posts. The new posts have it, older not.

    https://wordpress.org/plugins/imdb-connector/

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

    (@thaikolja)

    That’s understandable since some data output strings and some arrays (“directors”, for example). I’ve listed them all in the documentation. For those, you may want to use PHP’s explode() function.

    Thread Starter bartas139

    (@bartas139)

    I am not very skilled in php, can u help me a bit more.

    $id = get_post_custom_values("imdb"); //This gets "tt1911658"
    $film = get_imdb_connector_movie($id[0]);

    What more to do? Thank u very much

    Plugin Author thaikolja

    (@thaikolja)

    Well, that depends on what you want to do with the information. A simple for displaying some information would be:

    <?php
    	/** This gives us the IMDb ID or title which we need */
    	$movie_id 	= get_post_meta(get_the_ID(), "imdb", true); // This gets "tt1911658"
    
    	/** This gives us the WHOLE movie details as an array */
    	$movie 		= get_imdb_connector_movie($movie_id);
    
    	/** An example for displaying a string */
    	echo "This movie is called " . movie["title"] . "<br />";
    
    	/** An example for displaying an array */
    	echo "The actors are " . explode(", ", movie["actors"]) . "<br />";
    
    	/** But we can also display a selected element of an array */
    	echo "One of the actors is " . $movie["actors"][0] . "<br />";

    I didn’t test this code, but this is how it should work.

    Thread Starter bartas139

    (@bartas139)

    $id = get_post_custom_values("imdb");
    $film = get_imdb_connector_movie($id[0]);
    echo explode(", ", $film["actors"]);

    This shows just “Array”

    Plugin Author thaikolja

    (@thaikolja)

    Sorry, my fauly, replace explode with implode and it should work. I always tend to mix them up…

    Thread Starter bartas139

    (@bartas139)

    I am maybe stupid, it works now for actors, but not for other arrays like directors, countries…

    Plugin Author thaikolja

    (@thaikolja)

    Some movies don’t contain all details, unfortunately I have no influence on that. An easy way to get an idea what details exist and – more importantly – if they’re inside an array is by using print_r(get_imdb_connector_movie($movie_id));. Try to see if the directors are actually there and filled out. And try it with different movies.

    Thread Starter bartas139

    (@bartas139)

    So I tested it before with shorcode and via shortcode its display everything. I think there is same source of data fot shortcodes and php gets

    Plugin Author thaikolja

    (@thaikolja)

    Please show me the output of print_r(get_imdb_connector_movie($movie_id));.

    Thread Starter bartas139

    (@bartas139)

    Plugin Author thaikolja

    (@thaikolja)

    Nothing?!

    Thread Starter bartas139

    (@bartas139)

    I cant copy it right now So heres the screen

    Plugin Author thaikolja

    (@thaikolja)

    That’s exactly what I get when I do it on my testing server. Here you’ll see it a bit more clearly:

    http://pastebin.com/02iVcbjP

    As you can see, some of the values are strings and some are arrays. Again, displaying a string, I would do:

    $movie_id = "tt1911658";
    $movie = get_imdb_connector_movie($movie_id);
    echo $movie["awards"];

    This gives me the following output:

    6 nominations.

    As for arrays, you can use them like this:

    $movie_id = "tt1911658";
    $movie = get_imdb_connector_movie($movie_id);
    echo implode(", ", $movie["directors"]);

    The output:

    Eric Darnell, Simon J. Smith

    Please repeat these procedures and tell me if that worked for it. It might also be a good idea to clear the cache on the plugin’s settings page before you do it.

    Thread Starter bartas139

    (@bartas139)

    Oh, the problem could be solved by the cache clear, but I just realised that there is an problem with my plugin, I tryd it redownload, but it didnt help, my administration is simply crashed 😀

    IMDB Connecter admin

    Plugin Author thaikolja

    (@thaikolja)

    IMDb Connector’s settings page crashes? A few more information would be appreciated so I can solve this.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘IMDb doesnt take some details’ is closed to new replies.