function increment_article_views($hook) { global $news_arr; // get the current news ID $news_id = $news_arr[0]; // Load the counters $xfields = new XfieldsData(); // Increment the counter value $xfields->increment($news_id, VIEW_COUNT_XFIELD); // Save the counters $xfields->save(); }