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
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

greenSkin - September 13, 2007 - 00:28
Status:active» postponed

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

ahneill - September 18, 2007 - 23:32

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

greenSkin - September 20, 2007 - 00:32
Status:postponed» fixed

Teasers should work now. Let me know if there are any problems.

#4

greenSkin - September 26, 2007 - 15:17
Status:fixed» closed

#5

Michelle - February 9, 2008 - 18:44
Version:5.x-1.x-dev» 5.x-2.0-alpha1
Category:bug report» feature request
Status:closed» active

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:

<?php
   
case "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

scottrigby - March 20, 2008 - 21:19

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

greenSkin - March 21, 2008 - 20:13
Status:active» fixed

Fixed, please test next available snapshot.

#8

Anonymous (not verified) - April 4, 2008 - 20:22
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.