I made a code to display user's friends and the name,id and profile pic of the friend. The problem was to get the gender of the friend and made the code below the first code .but it does not seems to work but it works in case of getting my gender information .
function displayUsersIcons($criteria) { $users = $criteria['users']; $nb_display = $criteria['nb_display']; $width = $criteria['width']; echo 'data'.$gen = $criteria['gen']; if($width=='') $width="200"; if($nb_display>count($users) || $nb_display=='') $nb_display=count($users); //display value never bigger than nb users $display = ''; for($i=0;$i<$nb_display;$i++) { $name = $users[$i]['name']; $picture = $users[$i]['picture']; $url = $users[$i]['url']; $user_id = $users[$i]['id']; $cookie = self::$cookie; if($cookie['access_token']!='') { $url = 'https://graph.facebook.com/'.$name.'?access_token='.$cookie['access_token']; //echo '<a href="'.$url.'" target="_blank">'.$url.'</a><br>'; $data = json_decode($this->getDataFromUrl($url)); $fb['gender'] = $data->gender; $gender=$fb; $display .= '<li class="mispan main-span" gen="'.$gender.'" data="'.$user_id.'" unme="'.$name.'" upic="'.$picture.'">'; $display .= '<div class="thumbnail">'; $display .= '<h3 class="miheader">'.$name.'</h3>'; $display .= '<a href="'.$url.'" target="_blank" title="'.$name.'">'; $display .= '<div class="miprofile-pic-cnt" style="background-image:url('.$picture.')" ></div>'; $display .= '</a>'; $display .= '<div class="caption" style="text-align:center;">'; $display .= '<p><a href="#" class="btn kssico miclickks"><img src="Iconos/lips.png" /></a> <a href="#" class="btn bdico miclickbd"><img src="Iconos/bed.png" /></a></p>'; $display .= '</div>'; $display .= '</div>'; $display .= '</li>'; } return $display; }
the code to get friends gender
$cookie = self::$cookie; if($cookie['access_token']!='') { $url = 'https://graph.facebook.com/'.$name.'?access_token='.$cookie['access_token']; //echo '<a href="'.$url.'" target="_blank">'.$url.'</a><br>'; $data = json_decode($this->getDataFromUrl($url)); $fb['gender'] = $data->gender; $gender=$fb;