<?php 
//get_header(); 
//print_r(fb_events_get("30698522313","59614524509"));
//print_r(fb_user_getInfo("719970963"));
$fb_user = fb_get_loggedin_user();
if (isset($fb_user)){
	$pages = fb_get_user_pages($fb_user);
	if ($pages =="ERROR"){
		echo "Error loading pages";
		exit;
	}
}else{
	echo "Not logged as a Facebook user";
	exit;
}
?>


<div>

		<h2>Facebook User Pages</h2>


	<?php 

if(isset($pages)){
	foreach($pages as $page){
			echo '<div class="fbconnect_streampost">';
			echo '<div class="fbconnect_streampic"><a href="'.$page["page_url"].'"><img src="'.$page["pic_square"].'"/></a></div>';
			echo '<b>Page ID:</b> '.$page["page_id"];
			echo "<br/>";
			echo '<b>Page Name:</b> '.$page["name"];
			echo "<br/>";
			echo '<b>Type:</b> '.$page["type"];
			echo "<br/>";
			echo '<a href="'.$page["page_url"].'">'.$page["page_url"].'</a>';
			echo "<br/>";
			$onclickcode="";
			if (isset($_REQUEST["callback"]) && $_REQUEST["callback"]!=""){
				$onclickcode='onclick="'.$_REQUEST["callback"].'('.$page["page_id"].');"';
			}
			echo '<div class="submit fbconnect_select"><input '.$onclickcode.' class="button-primary" type="button" name="select" value="'.__('Select', 'fbconnect').'" /></div>';
			echo '</div>';
	}
}
//print_r($stream);
//print_r(fb_events_get("30698522313","59614524509"));
//print_r(fb_user_getInfo("719970963"));
?>	


</div>


<?php 
//get_footer(); 
?>