Exemple #1
0
    /**
     * ReduceEmails
     * Reduces the maximum amount of emails the current user can send.
     *
     * @param Int $reduce_emails_by The number of emails to reduce by.
     *
     * @return Boolean True if the reduction was completed successfully, otherwise false.
     */
    function ReduceEmails($reduce_emails_by=0) {
        if ($this->userid <= 0) {
            return false;
        }

        $userid = intval($this->userid);
        $reduce_emails_by = intval($reduce_emails_by);

        if ($reduce_emails_by == 0) {
            return true;
        }

        if ($this->hasUnlimitedTotalCredit()) {
            return true;
        }

        $this->GetDb();

        $currentUser = IEM::userGetCurrent();

        if ($currentUser->userid == $this->userid) {
            IEM::userFlushCache();
        }

        return true;
    }