public function set_user($user) { parent::set_user($user); if ($this->is_authenticated()) { $this->access_token = get_user_meta($this->user->ID, '_twitter_oauth_token', true); $this->client = new TwitterOAuth($this->api_key, $this->consumer_secret, $this->access_token['oauth_token'], $this->access_token['oauth_token_secret']); } else { $this->client = new TwitterOAuth($this->api_key, $this->consumer_secret); } }
function __construct() { parent::__construct(); if (!defined('HMA_SSO_FACEBOOK_APP_ID') || !defined('HMA_SSO_FACEBOOK_APPLICATION_SECRET')) { throw new Exception('constants-not-defined'); return new WP_Error('constants-not-defined'); } $this->id = 'facebook'; $this->name = 'Facebook'; $this->app_id = HMA_SSO_FACEBOOK_APP_ID; $this->application_secret = HMA_SSO_FACEBOOK_APPLICATION_SECRET; $this->facebook_uid = null; $this->supports_publishing = true; $this->set_user(wp_get_current_user()); require_once 'facebook-sdk/src/facebook.php'; $this->client = new Facebook(array('appId' => $this->app_id, 'secret' => $this->application_secret, 'cookie' => true)); $this->avatar_option = new HMA_Facebook_Avatar_Option(&$this); }