• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Lack of interest [Code suggestion] log model getModeratorLogEntries & getAdminLogEntries

R

ragtek

Guest
#1
pls include here fetchconditions too, instead of the hardcoded (IMO LIMITED where user_id=? ) condition...

The log is a great tool and could be used for more things (e.g. => output for mods in the frontend, but it's limited with the query and it's ugly to have c&p code only because of the condition:p

Code:
return $this->fetchAllKeyed($this->limitQueryResults(
                '
                    SELECT moderator_log.*, user.username
                    FROM xf_moderator_log AS moderator_log
                    INNER JOIN xf_user AS user ON (user.user_id = moderator_log.user_id)
                    WHERE moderator_log.discussion_content_type = "thread"
                    AND moderator_log.discussion_content_id = ' . $db->quote($threadId) .'
                    ORDER BY moderator_log.log_date DESC
                ', $limitOptions['limit'], $limitOptions['offset']
            ), 'moderator_log_id');
original:
PHP:
return $this->fetchAllKeyed($this->limitQueryResults(
            '
                SELECT moderator_log.*, user.username
                FROM xf_moderator_log AS moderator_log
                INNER JOIN xf_user AS user ON (user.user_id = moderator_log.user_id)
                WHERE ' . ($userId ? 'moderator_log.user_id = ' . $db->quote($userId) : '1=1') . '
                ORDER BY moderator_log.log_date DESC
            ', $limitOptions['limit'], $limitOptions['offset']
        ), 'moderator_log_id');
as you see, only the where part is different..