• Resolved jconni02

    (@jconni02)


    I got the following code:

     global $wpdb;     
     $user = wp_get_current_user();
    	$user_id = $user->ID;
     
    	$koordinaten = $wpdb->get_results("SELECT location_latitude,location_longitude FROM nogfd_em_locations WHERE location_owner = ".$user_id); 
      foreach($koordinaten as $koordinate)
      {
        $koordinate1 = $koordinate->location_latitude;
    	$koordinate2 = $koordinate->location_longitude;
      }
    	
    	echo EM_Events::output( array('limit'=>'10','near'=>'$koordinate1,$koordinate2','near_unit'=>'km','near_distance'=>'1') );

    My idea is that every user just creates one location that is his house. Therefore I can filter the coordinates of his location in the database. As I am not experienced with php and WordPress overall (doing this for a few days) I do not know how i can get this to work. The problem is that ‘near’=>'[…]’, only accepts numbers and no variables. Any help is appreciated (probably the most newbie question and I just need to convert the variable to a string or something:))

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    maybe you can try something like this

    
    echo EM_Events::output( array('limit'=>'10','near'=>$koordinate1.','.$koordinate2,'near_unit'=>'km','near_distance'=>'1') );
    
    Thread Starter jconni02

    (@jconni02)

    Thank you very much. This works perfectly fine now:) Apprciate the fast answer!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Event List filtered by distance to the event’ is closed to new replies.