Kunena 7.0.5 & Kunena 6.4.11 – Security Updates Released

The Kunena team has announce the arrival of Kunena 7.0.5 [K 7.0.5] in stable which is now available for download as a native Joomla extension for J! 5.4.x/6.0.x. This version addresses most of the issues that were discovered in K 6.2 / K 6.3 / K 6.4 and issues discovered during the last development stages of K 7.0.

The Kunena team is also pleased to announce the eleventh version of Kunena 6.4, a native Joomla extension for Joomla! 5.0, 5.1, 5.2, 5.3, 5.4 and 6.0.

Before posting in this category, please read sticky topics and, as general background, My Joomla site template makes a mess of Kunena .

If you have questions about third-party templates, please use the User-written Templates category or contact the author directly. This category should only be used for questions about templates developed and supported by the Kunena project.

Question Highlight moderator messages

More
15 years 3 months ago #82552 by uastasi
Hello everybody,
I'd like to highlight every message posted by moderator with a css class different from the default one.
I've seen that ./funcs/views.php renders a <table class="kmsg"> for every message posted. Is there a way to check if who writes is a moderator and then applying a custom class?

Thank you in advance

Please Log in or Create an account to join the conversation.

More
15 years 3 months ago - 15 years 3 months ago #82802 by uastasi
I've slightly modified view.php to obtain a raw implementation of the feature.
I've added these lines in display() function:
Code:
// Highlight moderator messages if ($this->highlight($this->id, $this->userid )){ $this->class = 'class="kmsg-moderator"'; } else { $this->class = 'class="kmsg"'; }

Then I've added a function called highlight() in the same class:
Code:
/** * Highlight a message if its author is a moderator. * * @param mixed $messageId The message. * @param mixed $userId The message author. * @return boolean $isModerator 0 = False, 1 = True */ function highlight($messageId, $userId ){ $isModerator = false; //Check that the author is not anonymous if ($userId != 0){ $query = "SELECT a.userid, moderator FROM #__kunena_users a, #__kunena_messages b WHERE a.userid = b.userid and b.id = {$messageId}"; $this->db->setQuery($query); $row = $this->db->loadObject(); if ($row->moderator == 0) $isModerator = false; else if ($row->moderator == 1) $isModerator = true; } return $isModerator; }

At the end I've added a custom class called kmsg-moderator into the css file.

Feedback and improvements are welcome.
Last edit: 15 years 3 months ago by uastasi.

Please Log in or Create an account to join the conversation.

Time to create page: 0.270 seconds