Hi. Thanks for the awesome module, exactly what I wanted. However, since I'm also using the Tweet Meme, I was wondering if there's a way to be able to place it below that? And more specifically if you could add that to the module itself, since I'm not that great at theming.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

SandStorm’s picture

You can use Content Templates (Contemplate) to place the button wherever you like.

http://drupal.org/project/contemplate

willsteinmetz’s picture

Status: Active » Closed (fixed)

If you're not willing to use CSS in a theme, your best bet is probably the link in SandStorm's comment above

apanag’s picture

Is it possible to give user a choice, to select between node content and hook_links?

willsteinmetz’s picture

Component: Miscellaneous » User interface
Status: Closed (fixed) » Active

I will keep the positioning in mind for the next version of this. Facebook recently redesigned their "Like/Fan" system so I'm waiting to see if they also muck up the Share system as well or pull it in under "Like" before I do too much.

For now your best bets are using CSS or jQuery in a theme or the module that SandStorm suggested above.

Sorry for the short response both times, things have been hectic this way the past few weeks.

CinemaSaville’s picture

I appreciate it. Thank you.

dcomfort’s picture

It would be great if you could make this available as a block. Do you have any plans to do so?

nyleve101’s picture

Hi,

what is the required code to print the button in a node template please?

willsteinmetz’s picture

This module was created to avoid having to work with code. At some point an update will be made to give the module a weight for where to display it.

If you want to put code directly into a template, you're best off using the Facebook Share base code. The code can be found here: http://www.facebook.com/facebook-widgets/share.php

DrupalKing’s picture

I was able to place the FB share anywhere I wanted in my node.tpl.php by using this code....

print $node->content['facebookshare']['#value']

nyleve101’s picture

Thank you so much Hochmania that's exactly what i was looking for!!

I hope you're well and taking care of yourself!

Evelyn

copeasetic’s picture

The above code does not seem to work for some reason. The php snippet breaks.. Not sure why. It looks like correct syntax to me.

RobLoach’s picture

Title: Specific Placement of Button » Specific Placement of Button -- Weight
Status: Active » Needs review
FileSize
1.85 KB

This allows you to move the placement around via the weight.

rv0’s picture

the php snippet is missing the ;
when you add it it works fine.

patch didnt work for me though

joachim desarmenien’s picture

I was about to hack line 76 of the module
'#weight' => -10,

This snippet works very nice for me, but it duplicates the facebookshare button, so i have two of them ...

Josephnewyork’s picture

I had a problem too with needing weight, but came up with an even better solution. Adding it to the node's links!
Here's what I did in my template.php file:

function <MY_THEME>_preprocess_node(&$variables) {
  $changed = FALSE;
  $node = $variables['node'];
  $links = $node->links;
  if (!in_array($node->type, variable_get('facebookshare_types', array()), TRUE)) {
  } else if ($node->build_mode != NODE_BUILD_NORMAL) {
  } else if (!user_access('access facebookshare')) {
  } else if($variables['teaser']) {
    $url = url('node/' . $node->nid, array('absolute' => TRUE));
    $links['facebookshare'] = array(
      'title' => theme('facebookshare', $url),
      'html' => 1,
    );
    $changed = TRUE;
  }
  if($changed) $variables['links'] = theme_links($links, array('class' => 'links'));
}

Worked great. Just change $variables['teaser'] to !$variables['teaser'] to perform on full nodes, or remove it all together to show on both.

physiotek’s picture

hI! adding it to the node's link would be perfect for me... but i have an error with the previous code.
Erreur HTTP 500 (Internal Server Error) : An unexpected condition was encountered while the server was attempting to fulfill the request.
of course i changed for my theme name...
i have the latest drupal 6 version with the latest facebook share version too.
and the problem if i use

<?php
 print $node->content['facebookshare']['#value'] 
?>

is like someone mentionned that there is 2 instances.

yaworsk’s picture

Hi All,
here are patches that allow you to place the button in the node links and also give the button a weight. I have two patches because one is for the admin.inc file and the other is for the .module file.

This is my first patch so let me know if it doesn't work (I also wasn't sure if you could combine patches for two different files into one single patch...)

Thanks,
pete

willsteinmetz’s picture

Version: 6.x-1.0 » 6.x-1.1
Status: Needs review » Closed (fixed)

Weight option was added in version 6.x-1.1

krisrobinson’s picture

Has anyone tried the patches in #17?

revol’s picture

Component: User interface » Code
FileSize
3.8 KB

Hello, here's a patch over 6.x-1.1 which adds the option to move the button on the 'links' section of a node. I used #17 yaworsk patch plus some fine tunings.
Hope this helps.

mvc’s picture

Title: Specific Placement of Button -- Weight » Specific placement of button in links area
Status: Closed (fixed) » Needs review

I didn't test the links section patch, but I used it as a basis for an equivalent patch for the 7.x branch: #1635292: Option to place button in node links

Meanwhile, it looks like this 6.x patch is still awaiting review. I've re-opened the issue and clarified the title to help with that.