miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /  
 

Module Color Nick ver 1.0

 
Author Kimi
Partaker
#1 | Posted: 1 Feb 2015 16:33 
Step 1:
Open bb_functions.php and paste script below in end of file:

Function maunick($id, $mod = false) {
/* Function Color Nick by dungitcdt(.)com
* Right = 3: Admin
* Right = 2: Mod
* Right = 1: Member
* Right = 0: Banner
*/
if ($ban = db_simpleSelect(0, $GLOBALS['Tb'], 'banip', 'banip', '=', $id)) $banA=$ban[0];
if ($user = db_simpleSelect(0, $GLOBALS['Tu'], 'rights, username', 'user_id', '=', $id)) $right = $user[0];
If ($ban > 0) {
$out .= '<span style="color:black;">' . $user[1] . '</span>';
} Else {
if ($right > 0) {
if ($right == 1) { $font = '<span style="color:blue;">';}
if ($right == 2) { $font = '<span style="color:green;">';}
if ($right == 3) { $font = '<span style="color:red;">';}
$out .= $font . $user[1] . '</span>';
} else {
$out .= '<span style="color:blue;">' . $user[1] . '</span>';
}
}
return '<b>'.$out.'</b>';
}
Step 2: Add script below to phpmyadmin
ALTER TABLE `minibbtable_users` ADD `rights` INT( 1 ) NOT NULL DEFAULT '1';
UPDATE `minibbtable_users` SET `rights` = '3' WHERE `minibbtable_users`.`user_id` =1;
Okey. How to use?
Example:
$name = maunick($res[2]);
Wish you success! :))

Author Kimi
Partaker
#2 | Posted: 1 Feb 2015 16:37 
Demo:i.imgur(.)com/Mgc3p16.png

Author Paul
Lead Developer 
#3 | Posted: 1 Feb 2015 19:00 
Thanks for this. However, we prefer non-core destructive solutions for miniBB. They make upgrades more easier - then you would need just to overwrite core files, without restoring custom codes again and again. Bb_functions.php is a core files... Also, I did not get the idea why would you need to extend the database - making the nickname in various colors could be built on the fly. Also, making a standalone request for the banned status means you would need to create extra 20-30 requests to DB per loading just one thread. Not good.

Here's a non-destructive solution I've created earlier for making the admin nickname in another color in posts. It could be extended to have the same approach for all other users.

Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /
 Module Color Nick ver 1.0
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Get the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑