Results 1 to 1 of 1
Like Tree1Likes
  • 1 Post By roidayan

Thread: map always showing, even if the user did not enter address

  1. #1
    Marketplace Seller roidayan's Avatar
    Join Date
    Apr 2014
    Location
    Israel
    Posts
    1,196
    Thanks
    34
    Thanked 157 Times in 144 Posts

    map always showing, even if the user did not enter address

    Even if the user doesn't enter address at all I get google map to show with a message address not found.
    I looked in the code and saw that actually the map should not show and there is a bug with the check.

    In sidebar-ad.php find in the top:
    PHP Code:
    // make sure google maps has a valid address field before showing tab
    $custom_fields get_post_custom();
    if ( ! empty( 
    $custom_fields['cp_zipcode'] ) || ! empty( $custom_fields['cp_country'] ) || 
        ! empty( 
    $custom_fields['cp_state'] ) || ! empty( $custom_fields['cp_city'] ) || 
        ! empty( 
    $custom_fields['cp_street'] ) ) {
        
    $gmap_active true

    the bug is empty() is only if the form doesn't request for a string.
    else the post_custom var will contain an array with 1 item which is empty string.

    To fix this I replaced the code with this:
    PHP Code:
    // make sure google maps has a valid address field before showing tab
    $gmap_active false;
    $custom_fields get_post_custom();
    $_fields = array("cp_zipcode""cp_country""cp_state""cp_street""cp_city");
    foreach (
    $_fields as $i) {
        if (! empty( 
    $custom_fields[$i]  ) && ! empty( $custom_fields[$i][0] )) {
            
    $gmap_active true;
            break;
        }

    samcy likes this.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Expired Listing - On renew, the user is made to enter the info again. Why?
    By pjreynolds in forum Help Using Vantage (Legacy)
    Replies: 5
    Last Post: February 5th, 2014, 02:17 AM
  2. Replies: 1
    Last Post: October 15th, 2012, 09:23 AM
  3. User enter their own password?
    By chelb74 in forum Report ClassiPress Bugs
    Replies: 1
    Last Post: August 28th, 2012, 10:48 PM
  4. Cannot post an ad or enter to user menu
    By jgutierrez in forum Report ClassiPress Bugs
    Replies: 1
    Last Post: March 6th, 2012, 01:47 AM
  5. Please enter a valid URL - not very user friendly
    By teamnoob in forum Report Clipper Bugs
    Replies: 2
    Last Post: November 12th, 2011, 05:51 PM