Exclude from display on some nodes

jdwfly - June 22, 2009 - 17:35
Project:AddThis Button
Version:6.x-2.7
Component:Code
Category:feature request
Priority:normal
Assigned:wesku
Status:needs work
Description

There needs to be a way to exclude the display of the addthis button on certain nodes. Right now I have it showing up on my 404 and 403 error pages.

Seems like you could create a textbox and then put urls of nodes to exclude from display?

#1

jdwfly - June 22, 2009 - 18:55
Status:active» needs review

Created a patch. Please review and make it better. This works for me, but I have very simple needs as far as excluding from nodes by the number. Someone may want to add wildcards to the mix.

AttachmentSize
addthis-498882.patch 1.47 KB

#2

wesku - July 18, 2009 - 09:15
Assigned to:Anonymous» wesku
Status:needs review» postponed

You can currently do this by using block visibility rules. Another way of doing this is to use addthis theme function. I try to keep the module quite simple and light weight since it's just doing a very simple task. I'll have a look at this feature, but since there already are many ways of doing this I'm not yet convinced about adding this to the module.

#3

jdwfly - July 20, 2009 - 16:11

I am not using the addthis block and therefore cannot use the block visibility rules. Using a theme function would be great but there was not any documentation on that, at least none that I found. It's nice to know that there is a theme function, but I would think that there are many people that don't know what theme functions are and many people that do not know how to use them. There should be a simple way to exclude your addthis by using the interface. Yes, I understand you want a simple module, but more importantly it needs to be usable to the average and below-average user.

Also, I wouldn't consider two ways to do something many. Only one of them would actually work in my case.

#4

KathyIce - September 2, 2009 - 14:31

I would also like to have control over which nodes the addthis button appears on.

any chance you could do something like a "disable addthis" option on the node edit form?

@jdwfly - thanks for the patch... it would be nice to have an option built into the module itself.

#5

wesley_2mpact - September 16, 2009 - 14:00

This small addon module allows you to set where the AddThis buttons is or is not displayed.
It works for me but is not tested beyond that...
Once installed and enabled there should be an extra setting in the settings menu 'Extended AddThis'.

AttachmentSize
extended_addthis.zip 1.67 KB

#6

wesley_2mpact - September 17, 2009 - 14:46

with small bugfix

AttachmentSize
extended_addthis.zip 1.69 KB

#7

wesku - September 26, 2009 - 07:33
Status:postponed» needs work

I have been thinking at this and there are quite a few different requests on this. Most likely the best way to do this would be implementing this on node level following same logic that rest of workflow settings do. This means visibility would be set on content type level by default, but could be overwritten on node level if user has the permission to do so.

#8

jdwfly - September 28, 2009 - 20:28

That is definitely a great plan. Are you going to work on it or do you want one of use to contribute a patch for it?

#9

NickAT - October 2, 2009 - 21:06

I actually already implemented something like this for my own purposes, I used the block visibility settings in conjunction with some more hook functions and form alters. Here I will attach the updated module...LOL I have to warn you, it may not be the most elegant way to do it, but this was my first drupal module editing experience. Hope this helps =) BTW the module now puts a menu on each node to enable the link, it also adds radio buttons to choose which place to put the button. If you use block setting, make sure that you have the addthis block setup. I have not thoroughly tested this module but for my purposes using the block settings and enabling the links that way, seems easy enough for anyone to do and has not produced any bugs yet.

AttachmentSize
addthis.module.zip 3.22 KB

#10

mrfelton - October 14, 2009 - 14:51

subscribing - I currently hack this using a cck field and hook_link_alter(). It's not perfect though, since the css and js still gets added to the page.

#11

wesku - October 17, 2009 - 17:34

This is a surprisingly complex issue. I want to make sure we are not adding too much overhead for such a simple module in order to implement this. There are already many ways of doing this (block visibility, theming, hook_link_alter...). I want to keep this module simple and light weight enough so that it will still be usable even for very large sites.

Implementing this on node level would mean that we need to save some custom data structure for overwriting per content type default values and check for them on each node display. If this will result in yet another SQL query for each node it sounds like an overkill to me. Any ideas or patches on how to implement this with minimal overhead are welcome.

 
 

Drupal is a registered trademark of Dries Buytaert.