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.
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
Comment | File | Size | Author |
---|---|---|---|
#3 | tweetbutton_1186348.patch | 574 bytes | robcarr |
Comments
Comment #1
luco CreditAttribution: luco commentedsubscribing :)
Comment #2
entilza72 CreditAttribution: entilza72 commentedSubscribing.
I can confirm I had the same issue with Tweebutton ignoring my node type selections, and this fix works for me.
Ent.
Comment #3
robcarrHad the same problem. Rolled patch from yaworsk's post
Comment #4
robcarrOn the assumption that this minor patch has effectively been tested, changed to RTBC... Please commit
Comment #5
joestewart CreditAttribution: joestewart commentedIt 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?
Comment #6
bcurry CreditAttribution: bcurry commentedThanks 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)
Comment #7
govind.maloo CreditAttribution: govind.maloo commentedI 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')),
);
Comment #8
govind.maloo CreditAttribution: govind.maloo commented