Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The purpose of Add This is to share content with the world, in other words anonymous users. It does not make sense to share unpublished content (unless of course your site allows anonymous users to access unpublished content).
Could this module do one or more of the following?
- Hide AddThis links on unpublished nodes unless the user has access to view it
- As above, but change the link to a message "you cannot share this page because it is unpublished"
- As above, but change the message to "This page is unpublished, are you sure you want to share it?"
- All of the above, with configuration text and checkboxes
Comments
Comment #1
vesapalmu CreditAttribution: vesapalmu commentedWhile I agree that this is a bug in some cases it's also a feature in some cases where you might want to preview the page before publishing it. Of course if you don't have permission to see a node you will not be able to see the Addthis button on it. This is only a problem if you have views (or something else) displaying unpublished nodes.
Options 2 and 3 are a bit difficult to implement in generic way because you can theme the button in many different ways. To make things even more difficult you can create Addthis block and context of the button is not always perfectly clear. I would go with adding a checkbox to hide the button on unpublished nodes and leave it off by default. Implementing this is trivial when using node links, block and using Addthis directly in your theme are a bit more difficult cases.
I will accept a patch for 2.x branch for this if somebody creates one. However since this is in my opinion sort of a edge case I'm changing priority to minor.
Comment #2
mstrelan CreditAttribution: mstrelan commentedThis should read
"... unless anonymous users have access to view it"
Nonetheless I think the other options are better options. I agree, this is an edge case.
Comment #3
mstrelan CreditAttribution: mstrelan commentedI don't anticipate writing a patch for any of the above options, but if anyone wants to implement Option 1 in their own custom module here is what I have done.
Comment #4
gisleThis problem still exists in 7.x-4.x. Changing version.
The elaborate scheme outlined in the issue summary will not be implemented (at least not by me).
This will be implemented: The buttons will be hidden on unpublished nodes, so that unpublished contents is not shared through carelessness.
Comment #5
matglas86 CreditAttribution: matglas86 as a volunteer commentedAs @vesapalmu said this is a edge case. In the 4.x branch it is possible to use alters to display only if you want that. Please consider that first. I am going to put this in Feature request and active status. Any patches are welcome and we can review the suggestions for that.
Personally I am not a real proponent of this since the unpublished content is many times not accessible to people outside certain people. Besides that. Creating this will create a bload of extra edge cases that will be added as 'bugs' while not really bugs.
I would like to hear any comments.