diff --git a/contrib/fb_example.info b/contrib/fb_example.info
index d0d28d8..0ee70b8 100644
--- a/contrib/fb_example.info
+++ b/contrib/fb_example.info
@@ -1,7 +1,7 @@
 name = FB Example Customizations
 description = (fb_example.module) These hooks will make your site behave more like <a href=http://www.drupalforfacebook.org target=_blank>drupalforfacebook.org</a>.  Use this code as an example for your own customizations.
 package = Drupal for Facebook - contrib
-core = 6.x
+core = 7.x
 dependencies[] = fb
 dependencies[] = fb_form
 dependencies[] = fb_app
diff --git a/contrib/fb_example.install b/contrib/fb_example.install
index 15aed01..2df0e22 100644
--- a/contrib/fb_example.install
+++ b/contrib/fb_example.install
@@ -13,7 +13,12 @@
  */
 function fb_example_install() {
   // So we fall after og_vocab and og.
-  db_query("UPDATE {system} SET weight = 3 WHERE name='fb_example'");
+  db_update('system')
+  ->fields(array(
+    'weight' => 3,
+  ))
+  ->condition('name', 'fb_example')
+  ->execute();
 }
 
 /**
@@ -21,8 +26,12 @@ function fb_example_install() {
  *
  * Set weight so that fb_example comes after fb_user.
  */
-function fb_example_update_1() {
-  $ret = array();
-  $ret[] = update_sql("UPDATE {system} SET weight = 3 WHERE name='fb_example'");
+function fb_example_update_7001() {
+  db_update('system')
+  ->fields(array(
+    'weight' => 3,
+  ))
+  ->condition('name', 'fb_example')
+  ->execute();
   return $ret;
 }
diff --git a/contrib/fb_example.module b/contrib/fb_example.module
index 4cf7265..cf8c123 100644
--- a/contrib/fb_example.module
+++ b/contrib/fb_example.module
@@ -11,27 +11,6 @@
  */
 
 /**
- * Implements hook_link().
- *
- * Add an XFBML like button to all node pages.  The button will appear next to
- * other node links, such as "add new comment".
- */
-function fb_example_link($type, $object, $teaser = FALSE) {
-  if ($type == 'node' && !$teaser) {
-    $items = array();
-    // Switch to control this behavior.
-    if (variable_get('fb_example_link_add_like', TRUE)) {
-      $url = fb_scrub_urls(url('node/' . $object->nid, array('absolute' => TRUE)));
-      $items['dff_like'] = array(
-        'title' => "<fb:like send=\"true\" ref=\"node/$object->nid\" href={$url}></fb:like>",
-        'html' => TRUE,
-      );
-    }
-    return $items;
-  }
-}
-
-/**
  * Implements hook_form_alter().
  *
  * Adds a checkbox to node edit and comment forms.  This checkbox lets
@@ -42,7 +21,7 @@ function fb_example_form_alter(&$form, $form_state, $form_id) {
   // Add stream publish option.
   if (isset($GLOBALS['_fb']) && fb_facebook_user() && variable_get('fb_example_stream_form_alter', TRUE) &&
       module_exists('fb_stream')) {
-    if ($form['#id'] == 'node-form') {
+    if (!empty($form['#node_edit_form'])) {
       // Add checkbox to control feed publish.
       $form['fb_example']['stream_publish'] = array(
         '#type' => 'checkbox',
@@ -50,7 +29,7 @@ function fb_example_form_alter(&$form, $form_state, $form_id) {
         '#default_value' => variable_get('fb_example_stream_publish_default', FALSE),
       );
     }
-    elseif ($form['form_id']['#value'] == 'comment_form') {
+    elseif ($form['#id'] == 'comment-form') {
       // Add checkbox to control feed publish.
       $form['fb_example']['stream_publish'] = array(
         '#type' => 'checkbox',
@@ -62,37 +41,35 @@ function fb_example_form_alter(&$form, $form_state, $form_id) {
 }
 
 /**
- * Implements hook_nodeapi().
+ * Implements hook_node_insert().
  *
  * Publish to facebook Walls when users submit nodes.
  *
  * @see http://developers.facebook.com/docs/reference/rest/stream.publish
  * @see http://developers.facebook.com/docs/guides/attachments
  */
-function fb_example_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
-  if ($op == 'insert' || $op == 'update') {
-    if (module_exists('fb_stream') &&
-        isset($node->stream_publish) &&
-        $node->stream_publish) {
-      $attachment = array(
-        'name' => $node->title,
-        'href' => url('node/' . $node->nid, array('absolute' => TRUE)),
-        'description' => filter_xss($node->teaser, array()),
-      );
+function fb_example_node_insert($node) {
+  if (isset($node->stream_publish) && $node->stream_publish) {
+    $attachment = array(
+      'name' => $node->title,
+      'href' => url('node/' . $node->nid, array('absolute' => TRUE)),
+      'description' => filter_xss($node->teaser, array()),
+    );
 
-      /*
-        if ($picture = $GLOBALS['user']->picture) {
-        $url = url($picture, array('absolute' => TRUE));
-        $attachment['media'][] = array(
-        'type' => 'image',
-        'src' => $url,
-        'href' => $url,
-        );
-        }
-      */
-      if ($logo_path = theme_get_setting('logo_path')) {
-        $url = url($logo_path, array('absolute' => TRUE));
-        $attachment['media'][] = array(
+    /*
+     if ($picture = $GLOBALS['user']->picture) {
+     $url = url($picture, array('absolute' => TRUE));
+     $attachment['media'][] = array(
+     'type' => 'image',
+     'src' => $url,
+     'href' => $url,
+     );
+     }
+     */
+    if ($logo_path = theme_get_setting('logo_path')) {
+      $url = url($logo_path, array('absolute' => TRUE));
+      //dpm($logo_path, "logo_path is $logo_path and url is $url");
+      $attachment['media'][] = array(
           'type' => 'image',
           'src' => $url,
           'href' => $url,
@@ -100,79 +77,178 @@ function fb_example_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
       }
 
       /* Facebook has disabled the message.  Deprecated.
-      $user_message = t('Check out my latest post on !site...',
-                        array('!site' => variable_get('site_name', t('my Drupal for Facebook powered site'))));
+    $user_message = t('Check out my latest post on !site...',
+                      array('!site' => variable_get('site_name', t('my Drupal for Facebook powered site'))));
       */
-      $actions = array();
-      $actions[] = array(
-        'text' => t('Read More'),
-        'href' => url('node/' . $node->nid, array('absolute' => TRUE)),
-      );
-      fb_stream_publish_dialog(array(
-                                 'attachment' => $attachment,
-                                 'action_links' => $actions,
-                               ));
-    }
+    $actions = array();
+    $actions[] = array(
+      'text' => t('Read More'),
+      'href' => url('node/' . $node->nid, array('absolute' => TRUE)),
+    );
+    fb_stream_publish_dialog(array('message' => $user_message,
+                                   'attachment' => $attachment,
+                                   'action_links' => $actions,
+                             ));
   }
 
-  // Another way to add like button, as part of a node.
-  if ($op == 'view' && variable_get('fb_example_nodeapi_add_like', FALSE)) {
+}
+
+/**
+ * Implements hook_node_update().
+ *
+ * Publish to facebook Walls when users submit nodes.
+ *
+ * @see http://developers.facebook.com/docs/reference/rest/stream.publish
+ * @see http://developers.facebook.com/docs/guides/attachments
+ */
+function fb_example_node_update($node) {
+  if (!empty($node->stream_publish)) {
+    $teaser = node_view($node, 'teaser');
+    $attachment = array(
+      'name' => $node->title,
+      'href' => url('node/' . $node->nid, array('absolute' => TRUE)),
+      'description' => filter_xss($teaser['body'][0]['#markup'], array()),
+    );
+    /*
+     if ($picture = $GLOBALS['user']->picture) {
+     $url = url($picture, array('absolute' => TRUE));
+     $attachment['media'][] = array(
+     'type' => 'image',
+     'src' => $url,
+     'href' => $url,
+     );
+     }
+     */
+    if ($logo_path = theme_get_setting('logo_path')) {
+      $url = url($logo_path, array('absolute' => TRUE));
+      //dpm($logo_path, "logo_path is $logo_path and url is $url");
+      $attachment['media'][] = array(
+        'type' => 'image',
+        'src' => $url,
+        'href' => $url,
+       );
+     }
+
+
+    $user_message = t('Check out my latest post on !site...',
+                      array('!site' => variable_get('site_name', t('my Drupal for Facebook powered site'))));
+    $actions = array();
+    $actions[] = array(
+      'text' => t('Read More'),
+      'href' => url('node/' . $node->nid, array('absolute' => TRUE)),
+    );
+    fb_stream_publish_dialog(array('message' => $user_message,
+                                   'attachment' => $attachment,
+                                   'action_links' => $actions,
+                             ));
+   }
+}
+
+/**
+ * Implements hook_node_view().
+ */
+function fb_example_node_view($node, $view_mode = 'full') {
+  // This is an example of how you might add a 'like' button to the node links.
+  if (variable_get('fb_example_link_add_like', TRUE)) { // Switch to control this behavior.
     $url = fb_scrub_urls(url('node/' . $node->nid, array('absolute' => TRUE)));
-    $node->content['dff_like'] = array(
-      '#value' => "<fb:like href={$url}></fb:like>",
-      '#type' => 'markup',
-      '#prefix' => '<div class="dff_like_wrapper">',
-      '#suffix' => '</div>',
+    $node->content['links']['node']['#links']['fb_like'] = array(
+      'title' => "<fb:like layout='button_count' href={$url}></fb:like>",
+      'html' => TRUE,
     );
   }
+  // This is an example of how you might add a 'like' button into the content area.
+  if (variable_get('fb_example_nodeapi_add_like', TRUE)) {
+     $url = fb_scrub_urls(url('node/' . $node->nid, array('absolute' => TRUE)));
+    $node->content['fb_like'] = array(
+      '#markup' => "<fb:like href={$url}></fb:like>",
+      '#weight' => -10,
+      '#prefix' => '<div class="fb_like_wrapper">',
+       '#suffix' => '</div>',
+     );
+   }
+ }
+
+ /**
+ * Implements hook_comment_insert().
+  *
+  * Publish to facebook Walls when users submit comments.
+  */
+function fb_example_comment_insert($comment) {
+  if (!empty($comment->stream_publish)) {
+    //dpm($comment, "fb_example_comment, publishing to stream");
+    //$node = node_load($comment->nid);
 
+    // http://wiki.developers.facebook.com/index.php/Attachment_(Streams)
+    $attachment = array(
+      'name' => $comment->subject,
+      'href' => url('node/' . $comment->nid, array('absolute' => TRUE, 'fragment' => 'comment-' . $comment->cid)),
+      'description' => $comment->comment_body[$comment->language][0]['value'],
+      //'properties' => array(t('In reply to') => array('text' => $node->title, 'href' => url("node/" . $node->nid, array('absolute' => TRUE)))),
+    );
+
+    if ($logo_path = theme_get_setting('logo_path')) {
+      $url = url($logo_path, array('absolute' => TRUE));
+      //dpm($logo_path, "logo_path is $logo_path and url is $url");
+      $attachment['media'][] = array(
+        'type' => 'image',
+        'src' => $url,
+        'href' => $url,
+       );
+    }
 
+    $user_message = t('Check out my latest comment on !site...',
+                      array('!site' => variable_get('site_name', t('my Drupal for Facebook powered site'))));
+    $actions = array();
+    $actions[] = array('text' => t('Read More'),
+                       'href' => url('node/' . $comment->nid, array('absolute' => TRUE)),
+    );
+    fb_stream_publish_dialog(array('message' => $user_message,
+                                   'attachment' => $attachment,
+                                   'action_links' => $actions,
+                             ));
+  }
 }
 
 /**
- * Implements hook_comment().
+ * Implements hook_comment_update().
  *
  * Publish to facebook Walls when users submit comments.
  */
-function fb_example_comment(&$a1, $op) {
-  if ($op == 'insert' || $op == 'update') {
-    $comment_url = url('node/' . $a1['nid'], array('absolute' => TRUE, 'fragment' => 'comment-' . $a1['cid']));
+function fb_example_comment_update($comment) {
+  if ($comment->stream_publish) {
+    //dpm($a1, "fb_example_comment, publishing to stream");
+    $node = node_load($comment->nid);
 
-    if (module_exists('fb_stream') && $a1['stream_publish']) {
-      // $node = node_load($a1['nid']);
-
-      // http://wiki.developers.facebook.com/index.php/Attachment_(Streams)
-      $attachment = array(
-        'name' => $a1['subject'],
-        'href' => $comment_url,
-        'description' => $a1['comment'],
-        // 'properties' => array(t('In reply to') => array('text' => $node->title, 'href' => url("node/" . $node->nid, array('absolute' => TRUE)))),
-      );
+    // http://wiki.developers.facebook.com/index.php/Attachment_(Streams)
+    $attachment = array(
+      'name' => $comment->subject,
+      'href' => url('node/' . $comment->nid, array('absolute' => TRUE, 'fragment' => 'comment-' . $comment->cid)),
+      'description' => $comment->comment_body[$comment->language][0]['value'],
+      //'properties' => array(t('In reply to') => array('text' => $node->title, 'href' => url("node/" . $node->nid, array('absolute' => TRUE)))),
+    );
 
-      if ($logo_path = theme_get_setting('logo_path')) {
-        $url = url($logo_path, array('absolute' => TRUE, 'fb_canvas' => FALSE));
-        $attachment['media'][] = array(
-          'type' => 'image',
-          'src' => $url,
-          'href' => $url,
-        );
-      }
+    if ($logo_path = theme_get_setting('logo_path')) {
+      $url = url($logo_path, array('absolute' => TRUE));
+      //dpm($logo_path, "logo_path is $logo_path and url is $url");
+      $attachment['media'][] = array(
+        'type' => 'image',
+        'src' => $url,
+        'href' => $url,
+       );
+     }
 
-      $user_message = t('Check out my latest comment on !site...',
-                        array('!site' => variable_get('site_name', t('my Drupal for Facebook powered site'))));
-      $actions = array();
-      $actions[] = array(
-        'text' => t('Read More'),
-        'href' => url('node/' . $a1['nid'], array('absolute' => TRUE)),
-      );
-      fb_stream_publish_dialog(array(
-        'message' => $user_message,
-        'attachment' => $attachment,
-        'action_links' => $actions,
-      ));
-    }
-  }
-}
+    $user_message = t('Check out my latest comment on !site...',
+                      array('!site' => variable_get('site_name', t('my Drupal for Facebook powered site'))));
+    $actions = array();
+    $actions[] = array('text' => t('Read More'),
+                       'href' => url('node/' . $comment->nid, array('absolute' => TRUE)),
+    );
+    fb_stream_publish_dialog(array('message' => $user_message,
+                                   'attachment' => $attachment,
+                                   'action_links' => $actions,
+                             ));
+   }
+ }
 
 
 /**
@@ -251,8 +327,10 @@ function fb_example_fb($op, $data, &$return) {
           // The user has connected (as opposed to logged out).  Let's redirect
           // them to our 'welcome' page.  Replace 'welcome' with the path you
           // really want.
-          $url = url('welcome',
-                     array('absolute' => TRUE, 'fb_canvas' => fb_is_canvas()));
+          $url = url('welcome', array(
+                                      'absolute' => TRUE,
+                                      'fb_canvas' => fb_is_canvas(),
+                                      ));
           // We return javascript to be evaluated by fb.js.
           $return[] = "FB_JS.reload('$url');";
         }
