Fix for Drupal 'Social Share Counter' module - Facebook Counter Not Working

I have been using Drupal's Social Share counter module for some time already. It worked great until recently it stopped and all posts were showing 0 shares.

After a quick research on the modules issue page, I found the solution: Facebook share counter not working

Facebook has changed its API recently, so the URL http://graph.facebook.com/?id=URL, which is used by the module no longer works and the share counter is always 0.

There is also a patch provided to fix this issue:

diff --git a/sites/all/modules/contrib/social_share_counter/social_share_counter.inc b/sites/all/modules/contrib/social_share_counter/social_share_counter.inc
index cd85c09b4..48cf292da 100644
--- a/sites/all/modules/contrib/social_share_counter/social_share_counter.inc
+++ b/sites/all/modules/contrib/social_share_counter/social_share_counter.inc
@@ -1,5 +1,7 @@
 <?php
 
+define('FACEBOOK_API_URL', 'https://graph.facebook.com/?id=%&fields=og_object{engagement}&format=json');
+
 /**
  * @file
  * File contains functions for individual share count from all Social service.
@@ -11,10 +13,11 @@
  */
 function get_count_facebook($url) {
   $count = 0;
-  $response = _social_share_counter_parse("http://graph.facebook.com/?id=" . $url);
+  $url = str_replace('%', $url, FACEBOOK_API_URL);
+  $response = _social_share_counter_parse($url);
   $result = json_decode($response);
-  if (isset($result->share)) {
-    $count = formatNumberAbbreviation($result->share->share_count);
+  if (isset($result->og_object->engagement->count)) {
+    $count = formatNumberAbbreviation($result->og_object->engagement->count);
   }
 
   return $count;

After patching social share counter was back and counting. Hope it helps

 

Receive weekly trade ideas and portfolio adjustments directly to your inbox.

I share ongoing portfolio progress with a focus on generating income through covered calls on quality stocks. Each update includes positioning changes, trade rationale, and forward-looking adjustments based on current market conditions.

Latest articles

RWA Tokenization in Georgia: Key Takeaways from DGFI & Forbes Conference in Tbilisi

On April 24, 2026, DGFI, in collaboration with Forbes Georgia, hosted a conference on Real-World Asset (RWA) tokenization at the Radisson Blu Iveria Hotel in Tbilisi. The event brought together representatives from financial institutions, regulators, brokerage houses, and emerging fintech players to discuss the evolving landscape of tokenized…

Living in Georgia |

Building a Frame House in Latvia: Kitchen Installation, Ground Tilling & IKEA Trip

As usual, we planned our spring around the school break at BIST (British International School of Tbilisi). This year we again split the time — one week in Latvia working on the frame house in the west, and the other in Berlin for business meetings related to the translation company.Returning after winter always comes with surprises. This year didn…

Frame house - Capšu Zeme |