This is a great module. I thought I would add this request knowing fully that someone may already be working on it (I can't find a similar issue ticket).

Basically, the existing Facebook and Twitter icons are good, but it would be ideal if we could add support for more advanced integrations like the Tweet Button, and the Facebook Like Button.

Ideally this would play nice with short URL support.

Comments

TheCrow’s picture

Version: 6.x-2.0 » 6.x-2.x-dev
Status: Active » Needs work

Tweet and old Facebook buttons are easy to add, but this new Facebook widget uses iframe... i have to work on it for block the render in links

mattwmc’s picture

Yeah, I would like the new tweet button with counter as well.

Easy to add? Like I could do it? :)

TheCrow’s picture

StatusFileSize
new1.95 KB

i added the widgets and a little patch that should be applied to the latest dev snapshot that save your time using phptemplate for alter some behaviour.

this patch will be added soon in CVS but before i need complete the integration of Sprites and i could change it again...

ravipjoshi’s picture

Holy (The)Crow!

That was fast. I installed it and it appears to be working. A few suggestions:

1. I altered the Twitter widget for Horizontal display-- ideally there would be some config interface for that.
2. The twitter iframe requires a margin-bottom: -6px to make it level with the other items.
3. The formatting works best with Twitter on the right hand side of the Facebook link and not the other way around. Ideally either would work, but for now it's fine.

Check it out!

http://www.makepovertyhistory.ca/

ravipjoshi’s picture

StatusFileSize
new104.83 KB

Also the count doesn't work when node's are displayed in a view:

http://www.makepovertyhistory.ca/share/news

I will disable the display entirely for teasers on our site for now. I've attached a screenshot where you can see all the zeros showing up-- they should have values.

TheCrow’s picture

StatusFileSize
new1.09 KB

it's zero in views because it consider the current page (Views page) and not the real node...

quick solution:

change in row 526 (service_links.module):

 call_user_func($service['callback'], $service, $settings['subst']);

with:

 call_user_func($service['callback'], &$service, $settings['subst']);

and replace widget_service with the doc attached

ravipjoshi’s picture

That modification works, but most interestingly not with the URL shortening feature set to "always". However, given that Twitter uses it's own t.co service, I have set it to "only when requested" and it appears to work.

Also, the Facebook counter doesn't work on views still.

TheCrow-- Thank you so much for taking this on!

ravipjoshi’s picture

looking more closely, Facebook is reiterating the same number across each node (see http://makepovertyhistory.ca on the bottom left ticker). I presume that this is because it's using the page's url not the node. Cheers,

mattwmc’s picture

OK, how do I install/implement @#3?

Sorry, newbie here. :)

Well, I can do the patch by hand but it says to delete this line:

-  return array($service_id => $link);

That isn't present in the service_links.module.

Then it says to add this:

+  // Some link couldn't be available for node-link section (widget).
+  if (!empty($link)) {
+    return array($service_id => $link);
+  }
 }

Maybe, I'm just lost, lol. Where do I put the other files, then?

ravipjoshi’s picture

Hey @mattwmc,

I'd recommend using #6 (it's a better iteration of #3). Here's what you do to apply the patch and make the changes (this is assuming you already have service links installed). Also remember that these only work if you're using the most recent development snapshot (6.x-2.x-dev) of Service_links (I made the same mistake too).

1) Download the zip file from comment #6 (above), unzip it and make sure there are three files: .patch .info and .module
2) The info and module files add a "widget services" category with twitter and facebook widgets. Place them on your server in /sites/all/modules/service_links/services (this may vary depending on your setup).
3) These files depend on the main service link module to be modified via the patch, so put the .patch file in /sites/all/modules/service_links/ (* again, could be differ-- blah blah), and run it in your command line:

patch < /path/to/drupal/install/sites/all/modules/service_links/temporarily_patch.patch

It should work. Cheers,

mattwmc’s picture

Thanks ravipjoshi!

Yeah, I wasn't using the Dev.

Also, I needed to enable "widget services" in the module config area for Service Links.

How did you "altered the Twitter widget for Horizontal display?" That's the way I need it.

Figured it out. Open up widget_services.module and change vertical to horizontal (in two places), easy enough.

TheCrow’s picture

StatusFileSize
new3.24 KB

i made a work around in javascript for "facebook like"...

steps:

  1. put the js file under js folder;
  2. apply the patch ONLY if not applied #3 and #6 previously;
  3. overwrite widget_services.module with the new included;
  4. enable the "facebook lite" widget.

TODO:
interface for configure the options (actually i leaved into the file the needed reference for apply other attributes).

ravipjoshi’s picture

Status: Needs work » Needs review

@mattwmc re: horizontal

Some things have changed but I THINK you alter line 30 of the widget_services.module file:

'attributes' => array('class' => 'twitter-share-button', 'data-count' => 'vertical', 'data-url' => ''),
to:
'attributes' => array('class' => 'twitter-share-button', 'data-count' => 'horizontal', 'data-url' => ''),

it may be in or around line 30 depending on what patch you've used.

@TheCrow re: like widget

It's amazing! works like a charm. Theme needs 'margin-bottom: -7px;' to line up properly with the other icons. In general I'm having to do some tightening up of the horizontal margins to give the icons more consistent spacing.

I'd be tempted to change this to "needs review", but there really ought to be some tweaks (layout options for Twitter, Facebook "share" button still doesn't work with views).

Also, can I assume that this will get merged into the dev version (and later the next release?)

Thanks all! Thanks TheCrow!

dwhutton’s picture

Category: feature » bug

I am using the Tweet widget with the Shorten_URL service (which is set up to create short URLs on my own domain). However, my shortened URL is still submitted to the Twitter shorten URL service.

Is there a way to invoke Shorten_URL but not the Twitter shorten URL service?

dwhutton’s picture

Correction to my last post: the Tweet button works properly. Although the Twitter-shortened URL shows in the Tweet button window, the published tweet shows my short URL, as provided my Shorten_URL. All is well!

TheCrow’s picture

Category: bug » feature

@ravipjoshi
about CSS fixes i think is better leave the users change them in their own CSS, because these widgets could look differents in different themes... maybe i have to mention this into the documentation...

with Facebook share i can't do better because the problem seem to be in their javascript that overwrite my settings :-/

@dwhutton
glad that it work because i dont have much control over these widgets, their javascripts could interfere with the normal behaviour...

I'll add this in dev soon, but how i said i need before complete the CSS sprites support (at least the minimal functions).

TheCrow’s picture

Status: Needs review » Fixed

added in dev!

Status: Fixed » Closed (fixed)

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