Hi all,
installed the tweetbutton module and configured it for 2 out of 10 content types on the admin config page but noticed the button was showing on all content types. Made a small change to line 83 in the tweetbutton.module to make the in_array function call strict:

if (in_array($node->type, variable_get('tweetbutton_node_types', array('article')), TRUE)

it was so minor that I didn't create a patch but can if needed.
Pete

CommentFileSizeAuthor
#3 tweetbutton_1186348.patch574 bytesrobcarr
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

luco’s picture

subscribing :)

entilza72’s picture

Subscribing.

I can confirm I had the same issue with Tweebutton ignoring my node type selections, and this fix works for me.

Ent.

robcarr’s picture

FileSize
574 bytes

Had the same problem. Rolled patch from yaworsk's post

robcarr’s picture

Status: Needs review » Reviewed & tested by the community

On the assumption that this minor patch has effectively been tested, changed to RTBC... Please commit

joestewart’s picture

It appears it was committed three days after 7.x-1.1 was released?

http://drupalcode.org/project/tweetbutton.git/blobdiff/c7755007ec35849e0...

It also appears that 7.x-2.0 doesn't have this issue. It was tagged in January but no release node made?

bcurry’s picture

Thanks for this. Pete's solution worked for me too.

However, I also had an issue with the Tweet Button appearing in both the Full view and the Teaser view regardless of how it was configured to appear. To resolve this, I just needed to change the line below the one described above in a similar manner.

Here are the two lines:

if (in_array($node->type, variable_get('tweetbutton_node_types', array('article')), TRUE)
&& in_array($view_mode, variable_get('tweetbutton_node_location', array('full')), TRUE)

govind.maloo’s picture

I also got the same problem and you can also update these line in twitter.admin.inc
line no. 104
code before :
$node_types = node_type_get_types();
foreach($node_types as $node_type) {
$types[$node_type->type] = $node_type->name;
}
this code doesn't make any sense we can just call this function to get node type name : node_type_get_names()

$form['tweetbutton_node_types'] = array(
'#type' => 'checkboxes',
'#title' => t('Node Types'),
'#options' => node_type_get_names(),
'#default_value' => variable_get('tweetbutton_node_types', array('article')),
);

govind.maloo’s picture

Status: Reviewed & tested by the community » Closed (fixed)