Foren / Cotonti / Support / Grup color Core hack how can do ?

Kilandor
#39859 9. September 2014, 16:57

The current best solution that exists with no need for any core hacks would be to simply in any spot/area that shows or uses cot_build_user. Hook into that area, and overwrite the default tag by running it again and using the 3rd paramater to add a class.

Here is just an example file of how you could add a class to the username of forum posts which would result in a class of group# # being their main group. You would need to hook into every area that displays tags and fix them though.

<?PHP
/**
 * Example Plugin
 *
 * @package example
 * @version 1.0.0
 * @author Jason Booth (Kilandor)
 * @copyright Copyright (c) 2014 Jason Booth (Kilandor)
 * @license BSD
 */
/* ====================
[BEGIN_COT_EXT]
Hooks=forums.posts.loop
[END_COT_EXT]
==================== */

if (!defined('COT_CODE') { die('Wrong URL.'); }

$t->assign(array(
	'FORUMS_POSTS_ROW_POSTERNAME' => cot_build_user($row['fp_posterid'], htmlspecialchars($row['fp_postername']), array('class' => 'group'.$row['user_maingrp'])),
	));

 

On another note, this is a long desired feature. I have just pushed a new commit to allow for custom function to be used.

Added the ability to override cot_build_user with cot_build_user_custom

This will allow a plugin to create a custom system to do anything group colors, images, any style changes you want. Or for simple changes you can simply enable custom function file in your config and add a new function cot_build_user_custom and then do whatever you want. This is of course what a plugin would/could do.