Found a bug in the code for counting the points for the pictures (albums).
The problem is in class_xperience.php
Your code that has the problem:
PHP Code:
//Albumpictures
$albumfield="visible";
if ($this->field_exists('album', 'picturecount')) $albumfield="picturecount";
if ($DoDebug==1) echo "<br/>Albumpictures";
if ($vbulletin->options['xperience_points_pc'] > 0)
{
$vmessagesq =$vbulletin->db->query_read("SELECT
$albumfield
FROM " . TABLE_PREFIX . "album
WHERE userid=".$user['userid']);
if ($vbulletin->db->num_rows($vmessagesq) > 0)
{
$vmessages = $vbulletin->db->fetch_array($vmessagesq);
$xperience['count_user_albumpictures'] = $vmessages['visible']*$vbulletin->options['xperience_points_pc'];
}
}
My corrected version:
PHP Code:
//Albumpictures - Corrected code by Ideal Web Tech
$xperience['count_user_albumpictures'] = 0;
$albumfield="visible";
if ($this->field_exists('album', 'picturecount')) $albumfield="picturecount";
if ($DoDebug==1) echo "<br/>Albumpictures";
if ($vbulletin->options['xperience_points_pc'] > 0)
{
$vmessagesq =$vbulletin->db->query_read("SELECT
$albumfield
FROM " . TABLE_PREFIX . "album
WHERE userid=".$user['userid']);
while ($vmessages = $vbulletin->db->fetch_array($vmessagesq))
{
$xperience['count_user_albumpictures'] += $vmessages['visible']*$vbulletin->options['xperience_points_pc'];
}
}
Your original code has a problem where it only tracks the last album of the users that was processed. This updated code will correctly process all albums a user has.
I am also looking into making this more efficient as well as making the stats update in real time to avoid the load that comes from updating and to avoid the delay from updating it.