Skip to content

Commit

Permalink
Add support for 10ups Autoshare
Browse files Browse the repository at this point in the history
  • Loading branch information
dshanske committed Feb 25, 2024
1 parent 4c027f9 commit 09415cd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions includes/class-social-plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public static function init() {
add_filter( 'get_post_syndication_links', array( 'Social_Plugins', 'add_syn_plugins' ) );
add_filter( 'syn_links_url_to_name', array( 'Social_Plugins', 'url_to_name_plugins' ), 10, 2 );
add_action( 'wpt_tweet_posted', array( 'Social_Plugins', 'wptotwitter_to_syn_links' ), 10, 2 );
add_action( 'autoshare_for_twitter_after_status_update', array( 'Social_Plugins', 'autoshare_for_twitter_after_status_update' ), 10, 3 );
}

public static function url_to_name_plugins( $name, $url ) {
Expand Down Expand Up @@ -85,6 +86,17 @@ public static function add_syn_plugins( $urls ) {
return array_merge( $see_on, $urls );
}

public static function autoshare_for_twitter_after_status_update( $response, $update_data, $post ) {
$post = get_post( $post );
if ( $post ) {
$data = get_post_meta( $post->ID, 'autoshare_status', true );
$tweet_id = $tweet_status['twitter_id'] ?? '';
$handle = $tweet_status['handle'] ?? 'i/web';
$url = esc_url( 'https://twitter.com/' . $handle . '/status/' . $tweet_id );
add_post_syndication_link( $post->ID, $url );
}
}

public static function add_links_from_snap() {
global $nxs_snapAvNts;
global $post;
Expand Down

0 comments on commit 09415cd

Please sign in to comment.