/** * Event: core.viewtopic_modify_post_row. * * Adds varibles needed for the likes extension to be displayed on each post. */ public function add_likes_to_post($event) { // Add language files to postrow display loop. $this->user->add_lang_ext('nuleaf/likes', 'likes'); $post_row = $event['post_row']; // Modify post row data to include variables needed for the likes to be displayed on post. $post_id = $post_row['POST_ID']; $post_row['LIKES_COUNT'] = $this->likes_manager->get_likes_count($post_id); $post_row['LIKED'] = $this->likes_manager->is_liked($post_id); $post_row['U_LIKES'] = $this->helper->route('nuleaf_likes_controller', array('post_id' => $post_id)); $event['post_row'] = $post_row; // Include necessary functions and css. if ($this->config['likes_on']) { $this->template->assign_vars(array('LIKES_INCLUDEJS' => true, 'LIKES_INCLUDECSS' => true, 'LIKES_ON' => true)); } }