Results 1 to 2 of 2

Thread: BUG FIX - WP_Error when Google Maps not available

  1. #1
    Thread Starter
    sebet's Avatar
    Join Date
    Oct 2010
    Location
    Portugal
    Posts
    1,491
    Thanks
    138
    Thanked 207 Times in 182 Posts

    BUG FIX - WP_Error when Google Maps not available

    Sometimes, when editing/submiting a job, I was getting the error "Cannot use object of type WP_Error as array on theme_geolocation.php line #31".

    This error happen when for some reason, google maps cannot be reached and It returns an error instead of the map details on line #31 on the theme_geolocation.php, file, here:

    PHP Code:
    $json json_decode($result['body']); 
    To fix this I've replaced that line with the following:
    PHP Code:
    if ( array_key_exists('body'$result) )            
            
    $json json_decode($result['body']);
        else                                     
            
    $json ''
    To avoid further errors you can add the following IF before the foreach:

    PHP Code:
    if ($json
       foreach (
    $json->results as $result

    ----------------------------------------------------------------------
    Elo Criativo Owner & Developer - developed using JobRoller

    Need help with your theme? - Maybe I can help

  2. #2
    jomarkosabel's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    40,701
    Thanks
    166
    Thanked 3,390 Times in 3,261 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Please help our moderating team work more efficiently by not sending us support questions via PM. You can read more about how AppThemes support works here. However, you can send a PM to follow up and remind me if I missed your support request/thread.

    Thank you and have a nice day.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Google maps
    By cazuk in forum Help Using ClassiPress
    Replies: 9
    Last Post: May 4th, 2011, 06:09 PM
  2. Google Maps
    By shatoony26 in forum Report ClassiPress Bugs
    Replies: 1
    Last Post: August 3rd, 2010, 02:57 AM
  3. Google Maps
    By bidatio1 in forum ClassiPress General Discussion
    Replies: 1
    Last Post: May 7th, 2010, 03:36 PM