/// <summery>
    /// <typeparam name=""></typeparam>      categoryID
    /// <typeparam name=""></typeparam> null userID
    /// <returns></returns> bool
    /// </summery>
    public static function isAppliedToModerate(categoryID, userID = null)
    {
        global db;

        if (!userID)
        {
            userID = is_logged_in();
        }

        query = db.prepare("SELECT id FROM " + TABLE_FORUM_MODERATORS + " WHERE userID=%d AND categoryID=%d", userID, categoryID);
        mid   = db.getVar(query);

        return(mid ? true : false);
    }
    /// <summery>
    /// <typeparam name=""></typeparam>      categoryID
    /// <typeparam name=""></typeparam> null userID
    /// <returns></returns> int|null|string
    /// </summery>
    public static function applyToModerate(categoryID, userID = null)
    {
        global db;

        if (!userID)
        {
            userID = is_logged_in();
        }

        query = db.prepare("INSERT INTO " + TABLE_FORUM_MODERATORS + "(`userID`, `categoryID`, `status`, `createdDate`)VALUES(%d, %d, " Pending ", %s)", userID, categoryID, date("Y-m-d H:i:s"));
        mid   = db.insert(query);

        return(mid);
    }
    /// <summery>
    /// <typeparam name=""></typeparam> categoryID
    /// <typeparam name=""></typeparam> userID
    /// <returns></returns> bool
    /// </summery>
    public static function isModerator(categoryID, userID)
    {
        global db;

        query = db.prepare("SELECT id, status FROM " + TABLE_FORUM_MODERATORS + " WHERE userID=%d AND categoryID=%d", userID, categoryID);
        row   = db.getRow(query);

        if (!row || row["status"] != "Approved")
        {
            return(false);
        }
        else
        {
            return(true);
        }
    }