Hi guys,
Recently had a request from a client to use custom short urls for sharing of pages.
I used Short URL and Shorten to achieve this, but of course, needed to adapt AddThis to get the shortened URL to pass through.

Figured this is a useful patch, although Twitter applies its own URL shortening not all of them do and http://domain.com/nodetype/somelongtitle/bla can get a bit tedious to look at.

In the advanced settings on the admin page, is the checkbox to enable Shorten for URLs, which just wraps around the node url generation in the .module.

Hope its of use!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Les Lim’s picture

Status: Needs review » Needs work

I haven't tested the patch, but I'm open to including this functionality.

It needs some work before that can happen, though:

* I'd want the setting on the administration form to appear conditionally based on whether or not Shorten module is already enabled.
* It needs to support AddThis when displayed as a block as well as within node links.
* In addthis_getlink(), you check for a module called "shorten" but then call a function from the shorturl module instead.
* It should follow Drupal coding standards for indentation and control structures.

Do you have the time and inclination to post a new patch?

ChrisDarke’s picture

OK on the requests above..

* I'd want the setting on the administration form to appear conditionally based on whether or not Shorten module is already enabled.

I had considered this but thought if I left it in regardless, it would let users see that there is such functionality, I guess I could disable the checkbox which would meet both requirements no?

* It needs to support AddThis when displayed as a block as well as within node links.

Ok, I thought it did, I will get onto that.

* In addthis_getlink(), you check for a module called "shorten" but then call a function from the shorturl module instead.

Ach yes I threw the wrong api call in there.. my bad..

* It should follow Drupal coding standards for indentation and control structures.

Will look into that

ChrisDarke’s picture

Status: Needs work » Needs review
FileSize
2.89 KB

OK So here is the new patch

1. Disables checkbox in admin if Shorten module not installed
2. Supports AddThis blocks as well as links
3. Fixed API call to call Shorten rather than Short URL
4. Tidied up indentations and control structures

Hope it passes muster this time!

Les Lim’s picture

Status: Needs review » Needs work

Integrations with other modules can be documented in the README.txt file, which I should get around to writing. The administration form is already too complicated to expose options for integrating with modules that most people will not have installed in the first place. That said, I'll probably end up reorganizing that form myself at some point soon, so don't worry about it for now.

This is closer, but the implementation specifically for the block should be written to be able to shorten the current URL path regardless of whether it's a node or not. One of the main reasons people use the block is to be able to place a share widget on non-node page paths like panels, views, etc.

gisle’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

The Drupal 6 version of AddThis is no longer supported.

Please open a new issue if you want this feature in a supported version of the module

However, the user interface is too complex already. It will probably not be added unless a patch is provided and it is requested by more than a few people.