Ignore:
Timestamp:
Sep 27, 2009, 6:17:56 PM (15 years ago)
Author:
Eric
Message:

[NBC_UserAdvManager] Fix for bug 1174

The unvalidated user's registration date is now displayed in red if validation have expired or in green if not expired.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/NBC_UserAdvManager/trunk/include/functions_UserAdvManager.inc.php

    r3896 r3920  
    695695        return $users;
    696696}
     697
     698/* Function called from UserAdvManager.php - to determine who is expired or not and giving a different display color */
     699function expiration($id)
     700{
     701        global $conf, $page;
     702         
     703        /* Get ConfirmMail configuration */
     704        $conf_nbc_UserAdvManager_ConfirmMail = isset($conf['nbc_UserAdvManager_ConfirmMail']) ? explode(";" , $conf['nbc_UserAdvManager_ConfirmMail']) : array();
     705         
     706        /* Get UserAdvManager configuration */
     707        $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
     708       
     709        $query = "
     710        SELECT registration_date
     711    FROM ".USER_INFOS_TABLE."
     712    WHERE user_id = '".$id."'
     713    ;";
     714        list($registration_date) = mysql_fetch_row(pwg_query($query));
     715
     716/*              Time limit process              */
     717/* ****************** begin ******************* */ 
     718        if (!empty($registration_date))
     719  {
     720                // dates formating and compare
     721                $today = date("d-m-Y"); // Get today's date
     722                list($day, $month, $year) = explode('-', $today); // explode date of today                                               
     723                $daytimestamp = mktime(0, 0, 0, $month, $day, $year);// Generate UNIX timestamp
     724               
     725          list($regdate, $regtime) = explode(' ', $registration_date); // Explode date and time from registration date
     726                list($regyear, $regmonth, $regday) = explode('-', $regdate); // Explode date from registration date
     727                $regtimestamp = mktime(0, 0, 0, $regmonth, $regday, $regyear);// Generate UNIX timestamp
     728                       
     729                $deltasecs = $daytimestamp - $regtimestamp;// Compare the 2 UNIX timestamps     
     730                $deltadays = floor($deltasecs / 86400);// Convert result from seconds to days
     731
     732                // Condition with the value set for time limit
     733                if ($deltadays <= $conf_nbc_UserAdvManager_ConfirmMail[1]) // If Nb of days is less than the limit set
     734                {
     735                        return false;
     736                }
     737                else
     738                {
     739                        return True;
     740                }
     741        }
     742}
    697743?>
Note: See TracChangeset for help on using the changeset viewer.