I created a new content type in order to post link stories to Twitter, rather than just my own stories. By doing this, I can also provide a listing of these same links in my sidebar, without carrying around the Twitter baggage (i.e. the URL shorteners). In addition, I can also maintain my own history of these items, without depending on Twitter maintaining the history.
To make my new content type work, though, I needed another option for posting content: the post's body. I format the link correctly in the body, but then put the expanded URL in a linked field I added via CCK. The full link gets served in the sidebar, while the abbreviated link, and Twitter text, is preserved in the body. This way if the URL shortening service ever disappears, I still have the full link. In addition, the site gets search engine mojo from my direct link in my Drupal site.
I modified two files, twitter.module and twitter.pages.inc to add the body option, and have successfully tested. Attached are two patch files. I am hoping that the Twitter module maintainers will agree with this feature request, and can use the patch files.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | updated_twitter.patch | 3.55 KB | marqpdx |
| twitterpagesbody.patch | 686 bytes | shelleyp | |
| twittermodulebody.patch | 1.3 KB | shelleyp |
Comments
Comment #1
shelleyp commentedComment #2
gregglesIf it were up to me I would won't fix this issue.
What twitter actions needs is token support.
Edit: #346435: Token support for Actions.
Comment #3
Skyr commentedI'd love to see a !body token as well... great would be the following features:
Comment #4
marqpdx commentedThis would be a great addition. It would allow a very interesting integration w/ Twitter.
I'll d/l and try the patch above. Thank you for that.
best,
m
Comment #5
gregglesNow that token support has landed, I think it's fair to mark this truly as "won't fix" because the functionality is there in a new way.
Comment #6
marqpdx commentedHi,
i have edited the 6.x-2.6 version of the module as patched per #1 above, and attached it. my first patch, but i wanted to post it in case it's useful to anyone:
i added:
1) support for bit.ly
2) a stripping out of html tags from the body
3) added a function i found on php.net (_substr) which does word bound substrings
4) added a bit of math so the body will automatically be truncated (at a word boundary) to fit in with whatever length title is used for the post.
so, it will post the first number of words of the body so that with the title and the bitly url, it will just come in under 140 chars.
it's working great on my end, and i don't see any glaring errors.
thanks!
m
Comment #7
rickharington commentedHey M, I would love to see this functionality but I'm not exactly sure what you are patching against above? It doesn't look like twitter.module as the patch states. is it somewhere else? Thanks for the help.
EDIT: went into twitter_post.module and twitter_post.pages.inc and updated those. Works like a charm. Thanks.