The "Share" link is behaving badly on teasers
christefanø - September 12, 2007 - 02:32
| Project: | Share |
| Version: | 5.x-2.0-alpha1 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
There are two issues here. The first is that any "Share" link in a list of teasers (the front page, for example) only affects the first node in the list.
Second, I'm unable to remove the "Share" link from teasers. Both Forward and Service Links are configured to display only on full-page view.

#1
I'll work on the teaser issue when I get more time, but the 'share' link showing up always on teasers has been fixed. Additionally, I set some validation in the Service Links settings page so if Share is turned on, it won't let you set links to teasers, and you can't have Service Links in the node AND in links.
#2
Excellent to hear the teasers are going to be worked on... this feature is largely needed on teasers to cut down clutter on pages where numerous teasers appear, at least for us... I am promising at least $25 if the share feature can be made to work with teasers. THANK YOU!
#3
Teasers should work now. Let me know if there are any problems.
#4
#5
This seems to be broken again on the 2.x line. I'm looking at the code:
<?php
function share_link($type, $node = NULL, $teaser = FALSE) {
switch (variable_get('share_type', 0)) {
case "share_this":
if (variable_get('share_share_this_where', 0) == '0') {
static $share = 0;
if (_share_share_this_show($node->type, $node->nid) && user_access('use share this')) {
if ($share == '0') {
$share++;
drupal_set_html_head(variable_get('share_share_this_code', 0));
}
$links['share_share_this'] = array(
'title' => "<script language='javascript' type='text/javascript'>
SHARETHIS.addEntry({}, {button:true} );
</script>",
'html' => TRUE,
'attributes' => array('id' => 'share_'.$node->nid)
);
return $links;
}
}
break;
?>
and it doesn't look like it's checking to see if the link is going on a teaser and I can't find anything in options to set it.
I changed it to:
<?phpcase "share_this":
if ($teaser) {
return array();
}
if (variable_get('share_share_this_where', 0) == '0') {
?>
And that works fine for my purposes but adding an option would make it better for general use.
Thanks,
Michelle
#6
Michelle - this works great!
I still haven't figured out how to make a proper patch, otherwise I would.
(A hole in my knowledge... will look into how to do this soon...)
Thanks for this!
:))
Scott
#7
Fixed, please test next available snapshot.
#8
Automatically closed -- issue fixed for two weeks with no activity.