WordPress.org

Ready to get started?Download WordPress

Forums

Strictly Tweetbot
[resolved] Tweet posts created prior to installing the plugin (2 posts)

  1. liveland
    Member
    Posted 2 years ago #

    Hi,

    When I create a new post, this plugin is sending a tweet. Superb :)

    Is there anyway I can make it send a tweet when I edit an old post that was created prior to installing the plugin?

    Thanks

    http://wordpress.org/extend/plugins/strictly-tweetbot/

  2. Strictly Software
    Member
    Plugin Author

    Posted 2 years ago #

    There is code to prevent you tweeting for any posts before installation.

    If you don't want this functionality you will need to remove the code or change the dates on all your posts.

    To remove this functionality that blocks tweets on old posts before the installation date open up the /strictly-tweetbot.class.php file in a text editor (notepad will do) and then find the PostTweets function which should be on line 714 or there abouts e.g

    public function PostTweets($post_id = 0) {
    
    	//ShowTweetBotDebug("IN PostTweets $post_id");
    
    	// no post ID? no tweet
    	if($post_id == 0){
    		return false;
    	// already tweeted?
    	}else if(get_post_meta($post_id, 'strictlytweetbot_posted_tweet', true) == '1'){
    		return false;
    	}
    
    	$post = get_post($post_id);
    
    	if ( $post == false || $post == null ) {
    		return false;
    	}
    
    	// check for private posts OR posts added before the plugin was installed
    	if ($post->post_status == 'private'){
    		return false;
    	}
    
    	<strong>// REMOVE THIS!!!!
    	if(!empty($this->install_date) && $post->post_date <= $this->install_date) {
    		return false;
    	}</strong>
    }

    So you want to remove the 3 lines of code that check whether the date of the post was before the installation date and if it was blocks any tweeting - e.g remove the following lines from the class.

    if(!empty($this->install_date) && $post->post_date <= $this->install_date) {
    	return false;
    }

    If you don't want to do this then the other options are

    1. Pay me to add an option into the admin interface to switch this feature on or off.

    2. On all files you wsnt to edit and re-tweet before the installation of the plugin change the published date of the article to one after the installation date so that the code above will believe the post was published AFTER you installed the plugin.

    Thanks

    Rob

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic