delete_user_meta($bp->loggedin_user->id, 'buddystream_googleplus_synctoac'); delete_user_meta($bp->loggedin_user->id, 'buddystream_googleplus_filtermentions'); } if (isset($_GET['oauth_token'])) { //Handle the oAuth requests $buddystreamOAuth = new BuddyStreamOAuth(); $buddystreamOAuth->setRequestTokenUrl('https://www.google.com/accounts/OAuthGetRequestToken'); $buddystreamOAuth->setAccessTokenUrl('https://www.google.com/accounts/OAuthGetAccessToken'); $buddystreamOAuth->setAuthorizeUrl('https://www.google.com/accounts/OAuthAuthorizeToken'); $buddystreamOAuth->setCallbackUrl($bp->root_domain); $buddystreamOAuth->setParameters(array('oauth_verifier' => $_GET['oauth_verifier'])); $buddystreamOAuth->setConsumerKey(get_site_option("buddystream_googleplus_consumer_key")); $buddystreamOAuth->setConsumerSecret(get_site_option("buddystream_googleplus_consumer_secret")); $buddystreamOAuth->setRequestToken(get_user_meta($bp->loggedin_user->id, 'buddystream_googleplus_token_temp', 1)); $buddystreamOAuth->setRequestTokenSecret(get_user_meta($bp->loggedin_user->id, 'buddystream_googleplus_tokensecret_temp', 1)); $accessToken = $buddystreamOAuth->accessToken(); update_user_meta($bp->loggedin_user->id, 'buddystream_googleplus_token', '' . urldecode($accessToken['oauth_token']) . ''); update_user_meta($bp->loggedin_user->id, 'buddystream_googleplus_tokensecret', '' . $accessToken['oauth_token_secret'] . ''); update_user_meta($bp->loggedin_user->id, 'buddystream_googleplus_synctoac', 1); //for other plugins do_action('buddystream_googleplus_activated'); } if ($_POST) { update_user_meta($bp->loggedin_user->id, 'buddystream_googleplus_synctoac', $_POST['buddystream_googleplus_synctoac']); update_user_meta($bp->loggedin_user->id, 'buddystream_googleplus_filtermentions', $_POST['buddystream_googleplus_filtermentions']); //achievements plugins update_user_meta($bp->loggedin_user->id, 'buddystream_googleplus_achievements', $_POST['buddystream_googleplus_achievements']); $message = __('Settings saved', 'buddystream_googleplus'); } //put some options into variables $buddystream_googleplus_synctoac = get_user_meta($bp->loggedin_user->id, 'buddystream_googleplus_synctoac', 1);
global $bp; if ($_GET['reset'] == 'true') { delete_user_meta($bp->loggedin_user->id, 'buddystream_foursquare_token'); delete_user_meta($bp->loggedin_user->id, 'buddystream_foursquare_tokensecret'); delete_user_meta($bp->loggedin_user->id, 'buddystream_foursquare_tokensecret_temp'); delete_user_meta($bp->loggedin_user->id, 'buddystream_foursquare_token_temp'); delete_user_meta($bp->loggedin_user->id, 'buddystream_foursquare_mention'); delete_user_meta($bp->loggedin_user->id, 'buddystream_foursquare_synctoac'); } if (isset($_GET['code'])) { $buddystreamOAuth = new BuddyStreamOAuth(); $buddystreamOAuth->setAccessTokenUrl('https://foursquare.com/oauth2/access_token'); $buddystreamOAuth->setCallbackUrl($bp->loggedin_user->domain . BP_SETTINGS_SLUG . '/buddystream-foursquare'); $buddystreamOAuth->setParameters(array('redirect_uri' => $bp->loggedin_user->domain . BP_SETTINGS_SLUG . '/buddystream-networks/?network=foursquare', 'client_id' => get_site_option("buddystream_foursquare_consumer_key"), 'client_secret' => get_site_option("buddystream_foursquare_consumer_secret"), 'grant_type' => 'authorization_code', 'code' => $_GET['code'])); //get accesstoken and save it $accessToken = json_decode($buddystreamOAuth->accessToken(true)); update_user_meta($bp->loggedin_user->id, 'buddystream_foursquare_token', $accessToken->access_token); update_user_meta($bp->loggedin_user->id, 'buddystream_foursquare_synctoac', 1); //for other plugins do_action('buddystream_foursquare_activated'); } if ($_POST) { update_user_meta($bp->loggedin_user->id, 'buddystream_foursquare_synctoac', $_POST['buddystream_foursquare_synctoac']); //achievements plugins update_user_meta($bp->loggedin_user->id, 'buddystream_foursquare_achievements', $_POST['buddystream_foursquare_achievements']); $message = __('Settings saved', 'buddystream_foursquare'); } //put some options into variables $buddystream_foursquare_synctoac = get_user_meta($bp->loggedin_user->id, 'buddystream_foursquare_synctoac', 1); $buddystream_foursquare_filtermentions = get_user_meta($bp->loggedin_user->id, 'buddystream_foursquare_filtermentions', 1); //achievements plugin