aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fblikebutton.admin.inc10
-rw-r--r--fblikebutton.info3
-rw-r--r--fblikebutton.module17
3 files changed, 18 insertions, 12 deletions
diff --git a/fblikebutton.admin.inc b/fblikebutton.admin.inc
index a11e682..fdc8d4c 100644
--- a/fblikebutton.admin.inc
+++ b/fblikebutton.admin.inc
@@ -17,13 +17,13 @@ function fblikebutton_admin_settings() {
'#options' => $fblikebutton_node_options,
'#default_value' => variable_get('fblikebutton_node_types', array('page')),
'#description' => t('Each of these content types will have the "like" button automatically added to them.'),
- );/**
+ );
$form['fblikebutton_show_faces'] = array(
'#type' => 'radios',
- '#title' => t('Display faces in the Like box'),
- '#options' => array('true' => t('Show faces'), 'false' => t('Do not show faces'))
- '#default_value' => variable_get('fblikebutton_show_faces', array('true')),
+ '#title' => t('Show faces in the Like box'),
+ '#default_value' => variable_get('fblikebutton_show_faces', 'true'),
+ '#options' => array('true' => t('Show faces'), 'false' => t('Do not show faces')),
'#description' => t('Should users see the faces of other people who have "liked" the same content?'),
- ); */
+ );
return system_settings_form($form);
}
diff --git a/fblikebutton.info b/fblikebutton.info
index ce598e4..ebd47d0 100644
--- a/fblikebutton.info
+++ b/fblikebutton.info
@@ -1 +1,4 @@
+; $Id$
name = Facebook Like Button
+description = Adds Facebook's "Like" button to each selected node type.
+core = 6.x
diff --git a/fblikebutton.module b/fblikebutton.module
index a6b2a95..646b02a 100644
--- a/fblikebutton.module
+++ b/fblikebutton.module
@@ -11,7 +11,7 @@
*/
function fblikebutton_menu() {
$items['admin/settings/fblikebutton'] = array(
- 'title' => 'FB Like settings',
+ 'title' => 'FB Like Button',
'description' => 'Control which content types the "like" button should appear on.',
'page callback' => 'drupal_get_form',
'page arguments' => array('fblikebutton_admin_settings'),
@@ -26,21 +26,24 @@ function fblikebutton_menu() {
* Implementation of hook_nodeapi().
* @todo
* Add more config options for like button (size, etc).
- * Should $likebutton be wrapped in t()?
*/
function fblikebutton_nodeapi(&$node, $op, $teaser, $page) {
global $user;
+ global $base_url;
+ $likebase = $base_url . '/';
+ $likepath = drupal_get_path_alias($_GET['q']);
+ $webpage_to_like = $likebase . $likepath;
switch ($op) {
case 'view':
// Set which node types users can "like".
$types_to_like = variable_get('fblikebutton_node_types', array('page'));
- // Replace with drupal_get_path_alias() or something?
- $likepath = $_SERVER['SCRIPT_URI'];
- $likepath = urlencode($likepath);
+ $show_faces = variable_get('fblikebutton_show_faces', 'true');
// Facebook is doing away with FBML, so we use the iframe plugin option instead.
$likebutton = '<iframe src="http://www.facebook.com/plugins/like.php?href=';
- $likebutton .= $likepath;
- $likebutton .= '&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;font&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>';
+ $likebutton .= urlencode($webpage_to_like);
+ $likebutton .= '&amp;layout=standard&amp;show_faces=';
+ $likebutton .= $show_faces;
+ $likebutton .= '&amp;width=450&amp;action=like&amp;font&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>';
// Keep the fblikebutton button out of search results, etc.
if (!$page) {
break;