Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-12-30 21:29:22

vagari
Plugin Author
Registered: 2004-08-25
Posts: 19

vag_tumblr_import: Import Tumblr posts to your TXP site.

Download version 0.9.8.5

Summary

A friend of mine has had a Textpattern weblog for a few years and posts sporadically. She discovered Tumblr and has been using it to spit out quick thoughts more regularly. But now everyone needs to subscribe to another site. So I suggested we pull in the Tumblr posts so she could keep using Tumblr but her audience could stay to one location.

As opposed to asv_tumblelog this polls the API and pulls in the new posts. Amit’s plugin effectively recreates Tumblr within Textpattern. Though his plugin did help me get started and I repurposed some of his functions for things like setting preferences.

Requirements

  • PHP5 – This plugin uses functions only available in PHP5.
  • cURL or remote capabilities of file_get_contents – To actually poll the Tumblr API.

Installation

The install is straightforward. Copy the code into Textpattern like any other plugin and activate it. The settings tab will appear in the Extensions parent tab. Set the mandatory settings of your Tumbr username and the default user to import into Textpattern. More info is in the help file.

Anything else?

I hope others get some use out of this plugin! :-)

Updates

0.9.6 – Checks to see if Tumblr site is responding.
0.9.7 – Moved some things around and added cURL support.
0.9.8 – Recently moved to a new host and noticed that get_headers isn’t supported. Added cURL alternative.
0.9.8.1 – Changed MySQL column for “tumblr_ID” to BIGINT.
0.9.8.2 – Added a simple check to upgrade “tumblr_ID” to BIGINT on the fly.
0.9.8.5 – Added an option in the config for picking the section articles are imported to.

Last edited by vagari (2013-05-19 23:51:11)

Offline

#2 2007-12-31 20:06:49

variaas
Plugin Author
From: Chicago
Registered: 2005-01-16
Posts: 402
Website

Re: vag_tumblr_import: Import Tumblr posts to your TXP site.

vagari – this looks pretty cool. Great work!

Offline

#3 2007-12-31 23:37:15

variaas
Plugin Author
From: Chicago
Registered: 2005-01-16
Posts: 402
Website

Re: vag_tumblr_import: Import Tumblr posts to your TXP site.

So I just installed it and played with it. My server doesn’t allow file get content of a url, so I have to use a curl operation. I would recommend that you check to see if curl is enabled first, and use that. If not then you can fall back to file_get_content

Offline

#4 2008-01-04 16:56:31

vagari
Plugin Author
Registered: 2004-08-25
Posts: 19

Re: vag_tumblr_import: Import Tumblr posts to your TXP site.

Thanks Amit!

I’ll take a look into Curl (I’m currently traveling). It seemed a bit overkill just to snag some XML. I imagine fopen wrappers is disabled for you. It says that needs to be turned on for remote connections.

I did just add in a check for the 200 status header since I got a couple “warning” messages in my inbox from CRON that the Tumblr service was unavailable.

Guess with curl I’ll have to redo that whole status section too. Time to do some research. ;-)

Offline

#5 2008-01-08 01:03:47

vagari
Plugin Author
Registered: 2004-08-25
Posts: 19

Re: vag_tumblr_import: Import Tumblr posts to your TXP site.

Here’s a question for everyone… I believe the first round of this will be PHP5 only. Should I work everything in the future to be backwards compatible?

Also Amit, does file_get_contents work for local files? From what I’ve seen it sounds like just the remote calls would be blocked. Thanks!

Offline

#6 2008-01-08 01:15:30

variaas
Plugin Author
From: Chicago
Registered: 2005-01-16
Posts: 402
Website

Re: vag_tumblr_import: Import Tumblr posts to your TXP site.

Well they released the last update for php4, but you know that people will probably still stay on php4 for at least another couple years. I moved all my servers to php5 and am going to build future plugins with php 5.2+ support.

And file_get_contents will work on local files (given you have the right permissions) even if the url_access is disabled.

Offline

#7 2008-01-08 02:06:51

vagari
Plugin Author
Registered: 2004-08-25
Posts: 19

Re: vag_tumblr_import: Import Tumblr posts to your TXP site.

Thanks Amit. I added cURL support and moved some things around. Since I am using a bunch of other functions that are PHP5 only, like simplexml_load_string, it makes sense to just make it mandatory.

Guess I better add that to the documentation. ;-)

Offline

#8 2010-03-13 22:59:05

vagari
Plugin Author
Registered: 2004-08-25
Posts: 19

Re: vag_tumblr_import: Import Tumblr posts to your TXP site.

Everything is still functional. Thinking about adding in a new backend piece for doing a full import. Right now the plugin can only grab the latest posts… Not very helpful if you’ve been posting on Tumblr for years.

Offline

#9 2010-03-13 23:11:39

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: vag_tumblr_import: Import Tumblr posts to your TXP site.

Does your post mean we can remove the [ORPHAN] flag in the topic title?

Offline

#10 2010-03-13 23:43:30

vagari
Plugin Author
Registered: 2004-08-25
Posts: 19

Re: vag_tumblr_import: Import Tumblr posts to your TXP site.

Sure, I’m still around. Hoping to do a bit of updating. Thanks.

Offline

#11 2010-03-14 00:42:33

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: vag_tumblr_import: Import Tumblr posts to your TXP site.

Thank you for still being around :) Flag removed.

Offline

#12 2010-11-15 14:54:27

freethrow
New Member
Registered: 2010-06-15
Posts: 3

Re: vag_tumblr_import: Import Tumblr posts to your TXP site.

please forgive my stupidity, but how does this work? are there any tags, how about categories/sections?

Offline

#13 2010-11-15 19:11:42

vagari
Plugin Author
Registered: 2004-08-25
Posts: 19

Re: vag_tumblr_import: Import Tumblr posts to your TXP site.

Hi freethrow,

The way the plugin basically works (honestly I haven’t sifted through the code in a while so bear with me) is on install the plugin adds some nested categories (like tumblr->quote). Then you tell the plugin what your tumblr username is and using the read part of the Tumblr API every time you post to Tumblr the plugin pulls the content into your Textpattern site as a new post. This is done either on page refresh or based on a cron job you set up (with caching).

There are some customizations built in for how the plugin labels the imported posts. Also for what text is used for links back to the post on the Tumblr site.

Do you have any other questions?

Offline

#14 2010-11-16 19:09:49

freethrow
New Member
Registered: 2010-06-15
Posts: 3

Re: vag_tumblr_import: Import Tumblr posts to your TXP site.

Thank you Vagari. Yesterday I figured out that I have a bunch of new categories… Works pretty nice, I think I’m gonna have to make a new section, maybe put it on the fron page and start tumblin… Good work!

This is a bit of topic, but since you do write plugins for TP, I would be interested in your opinion> is there a future for textpattern, it’s been my favourite for a very long time, but I was away from webdev for a couple of years and I saw that there are a lot of problems, plugin incompatibilities etc…

Offline

#15 2011-12-18 22:20:16

dnwng
New Member
Registered: 2011-12-18
Posts: 3

Re: vag_tumblr_import: Import Tumblr posts to your TXP site.

Hello,
I installed this plugin and it pulls the posts in okay but when I set it to Page Load, it re-imports every single post every time the page loads instead of just the new ones. This also happens when I push the manual refresh—it pulls in everything from Tumblr again, creating duplicates. I haven’t been able to get the cron job option to work so I can’t say if this happens with that as well.

Is there something I need to do to prevent it from pulling in everything and just pull in the new posts?

Thanks!

Offline

Board footer

Powered by FluxBB