Skip to content

Commit

Permalink
Disabled @newonbotwiki on Twitter in response to Musk going back and …
Browse files Browse the repository at this point in the history
…forth on his Twitter API policies.
  • Loading branch information
stefanbohacek committed Feb 5, 2023
1 parent 1f99a4c commit 379741e
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions includes/newonbotwiki.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,31 +228,31 @@ public function post_update( $new_status, $old_status, $post ) {
if ( ENVIRONMENT === 'production' ){
/* Post update on Twitter */

$api_keys = array(
'oauth_access_token' => NEWONBOTWIKI_TWITTER_ACCESS_TOKEN,
'oauth_access_token_secret' => NEWONBOTWIKI_TWITTER_ACCESS_TOKEN_SECRET,
'consumer_key' => NEWONBOTWIKI_TWITTER_API_KEY,
'consumer_secret' => NEWONBOTWIKI_TWITTER_API_SECRET
);

$twitter_api_url = 'https://api.twitter.com/1.1/statuses/update.json';
$request_method = 'POST';
$post_fields = array(
'status' => $status_text_twitter
);

$twitter = new TwitterAPIExchange( $api_keys );
$response = json_decode(
$twitter->buildOauth( $twitter_api_url, $request_method )
->setPostfields( $post_fields )
->performRequest()
);
try {
$tweet_url = 'https://twitter.com/' . $response->user->screen_name . '/status/' . $response->id_str;
update_post_meta( $post_id, 'published_tweet_url', $tweet_url );
} catch (Exception $e) {
/* noop */
}
// $api_keys = array(
// 'oauth_access_token' => NEWONBOTWIKI_TWITTER_ACCESS_TOKEN,
// 'oauth_access_token_secret' => NEWONBOTWIKI_TWITTER_ACCESS_TOKEN_SECRET,
// 'consumer_key' => NEWONBOTWIKI_TWITTER_API_KEY,
// 'consumer_secret' => NEWONBOTWIKI_TWITTER_API_SECRET
// );

// $twitter_api_url = 'https://api.twitter.com/1.1/statuses/update.json';
// $request_method = 'POST';
// $post_fields = array(
// 'status' => $status_text_twitter
// );

// $twitter = new TwitterAPIExchange( $api_keys );
// $response = json_decode(
// $twitter->buildOauth( $twitter_api_url, $request_method )
// ->setPostfields( $post_fields )
// ->performRequest()
// );
// try {
// $tweet_url = 'https://twitter.com/' . $response->user->screen_name . '/status/' . $response->id_str;
// update_post_meta( $post_id, 'published_tweet_url', $tweet_url );
// } catch (Exception $e) {
// /* noop */
// }

/* Post update on Mastodon */

Expand Down

0 comments on commit 379741e

Please sign in to comment.