Kunena 6.3.3 released

The Kunena team has announce the arrival of Kunena 6.3.3 [K 6.3.3] in stable which is now available for download as a native Joomla extension for J! 4.4.x/5.0.x/5.1.x. This version addresses most of the issues that were discovered in K 6.2 / K 6.3 and issues discovered during the last development stages of K 6.3
Note: Please go to the Kunena Dashboard after an upgrade so that the Kunena database tables are also updated.

Question Post Thanks Event Trigger

More
6 months 1 week ago #1 by megat
Hi

I need a custom function where every time a user receive a Thank for their post, they will automatically get 1 point inserted to their custom point table here

Please review this code for the latest Joomla 5 and Kunena 6.2.3 version, do i need the event trigger or something to make this feature enabled?
Code:
<?php // Your Joomla configuration file define('_JEXEC', 1); define('JPATH_BASE', __DIR__); // Adjust this path based on your Joomla installation require_once JPATH_BASE . '/includes/defines.php'; require_once JPATH_BASE . '/includes/framework.php'; // Initialize the Joomla application $mainframe = JFactory::getApplication('site'); $mainframe->initialise(); // Assuming #__shop_users_points is your table name $db = JFactory::getDbo(); // Assuming 'kunena_thanks' is the table where thanks are recorded // Replace 'kunena_messages', 'thanks_field', and 'user_field' with your actual Kunena table and field names $query = $db->getQuery(true); $query->select('userid')       ->from('#__kunena_messages')       ->where('thanks_field = 1'); $db->setQuery($query); $usersToReward = $db->loadColumn(); // Insert 1 point for each user receiving thanks foreach ($usersToReward as $userID) {     $insertQuery = $db->getQuery(true);     $insertQuery->insert('#__shop_users_points')                 ->columns(array('user_id', 'points_column'))                 ->values((int)$userID . ', 1');     $db->setQuery($insertQuery);     $db->execute(); } ?>

p/s how can i preview the message before it get posted? its very useful feature

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

More
6 months 5 days ago - 6 months 5 days ago #2 by xillibit
Replied by xillibit on topic Post Thanks Event Trigger
Hello,

You don't need a specific event for it. You can make a plugin, take example from it : github.com/Kunena/Kunena-Forum/blob/K6.2...aUserPoints.php#L192

The sample code that you have added to your post is designed for Joomla! 3.x, not for Joomla! 5.x

I don't provide support by PM, because this can be useful for someone else.
Last edit: 6 months 5 days ago by xillibit.

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

Time to create page: 0.404 seconds