public function questionAction() { /**Note *Test ok */ try { $page_id = $this->_request->getParam('page_id_poll'); $question = $this->_request->getParam('question'); $op1 = $this->_request->getParam('op1'); $op2 = $this->_request->getParam('op2'); $type = "questions"; $data = array('question' => $question, 'options' => array($op1, $op2)); $page_info = Fb_Facebook::api($page_id . "?fields=access_token"); if (!empty($page_info['access_token'])) { $data['access_token'] = $page_info['access_token']; $post = new Application_Model_Facebook_Post(); $question_post = $post->createPost($page_id, $type, $data); if ($question_post) { echo $question_post['id']; exit; } else { echo 'fail'; exit; } } else { echo "empty access token"; } } catch (FacebookApiException $e) { echo $e; exit; } }
public function hidePost($post_id, $is_hidden = true) { /**Note * Must be manage_pages and have access_token * $data is array from facebook develop graph api * $data = array( * 'access_token' => string, if you have * 'is_hidden' => boolean, Whether a post is hidden * ) **/ try { $data['is_hidden'] = $is_hidden; return $post = Fb_Facebook::api($post_id, "POST", $data); } catch (FacebookApiException $e) { throw new Exception($e); } }
public function setPageSettings($page_id, $data) { /**Note * Must be manage_pages and have access_token * $data is array from facebook develop graph api * $data = array( * 'access_token' => string, if you have * 'setting' => string, Which single setting to update: USERS_CAN_POST, USERS_CAN_POST_PHOTOS, USERS_CAN_TAG_PHOTOS, USERS_CAN_POST_VIDEOS * 'value' => boolean, true or false * ) **/ try { return $page = Fb_Facebook::api($page_id, "POST", $data); } catch (FacebookApiException $e) { throw new Exception($e); } }