Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   OpenTracker (http://www.bvlist.com/forumdisplay.php?f=125)
-   -   Color username by group (http://www.bvlist.com/showthread.php?t=8212)

lafouine022 16th August 2012 07:58

Color username by group
 
SQL

PHP Code:

ALTER TABLE `tracker_groupsADD `group_colorvarchar(255utf8_unicode_ci

remplace your files /public_html/CMS/applications/admin/tpl/groups/edit.php

by my files
PHP Code:

<?php
try {
    if (!isset(
$_GET['id']))
        throw new 
Exception("Missing news id");

    if (!
intval($_GET['id']))
        throw new 
Exception("Invalid id");

    
$id $_GET['id'];


    if (isset(
$_POST['save'])) {
        try {

            if (
$_POST['secure_input'] != $_SESSION['secure_token'])
                throw new 
Exception("Wrong secure token");

            if (empty(
$_POST['name']) || empty($_POST['name']))
                throw new 
Exception("Missing data");

            
$db = new DB("groups");
            
$db->setColPrefix("group_");
            
$db->id $_POST['id'];
            
$db->name $_POST['name'];
            
$db->acl $_POST['acl'];
            
$db->color $_POST['color'];
            if (isset(
$_POST['upgradable'])) {
                if (
$_POST['upgradeto'] == 0)
                    throw new 
Exception("Missing upgrade to group data");
                
$db->upgradable 1;
                
$db->upgradeto $_POST['upgradeto'];
                
$db->downgradeto $_POST['downgradeto'];
                
$db->minupload $_POST['minupload'];
                
$db->minratio $_POST['minratio'];
            }
            
$db->update("group_id = '" $id "'");
            
header("location: ".page("admin""groups"));
        } Catch (
Exception $e) {
            echo 
error(_t($e->getMessage()));
        }
    }

    
$db = new DB("groups");
    
$db->setColPrefix("group_");
    
$db->select("group_id = '" $db->escape($id) . "'");
    if (!
$db->numRows())
        throw new 
Exception("Group not found");

    
$db->nextRecord();
    
?>

    <script type="text/javascript">
        $(document).ready(function(){
            $("#upgrade_check").change(function(){
                if($(this).is(":checked")){
                    $("#upgradable").show();
                }else{
                    $("#upgradable").hide();
                }
            });
        });
    </script>
    <h4>Create group</h4>
    <form method="post">
        <input type="hidden" name="secure_input" value="<?php echo $_SESSION['secure_token_last'?>">
        <table>
            <tr>
                <td width="100px"><?php echo _t("Group Id")?>:</td>
                <td><input name="id" type="text" value="<?php echo $db->id ?>" size="25"></td>
            </tr>
            <tr>
                <td width="100px"><?php echo _t("Group name")?>:</td>
                <td><input name="name" type="text" value="<?php echo $db->name ?>" size="25"></td>
            </tr>
            <tr>
                <td><?php echo _t("Group ACL")?>:</td>
                <td><input name="acl" type="text" value="<?php echo $db->acl ?>" size="25"></td>
            </tr>
            
            <tr>
                <td><?php echo _t("Group color")?>:</td>
                <td><input name="color" type="text" value="<?php echo $db->color ?>" size="25"></td>
            </tr>

            <tr>
                <td><?php echo _t("Upgradable")?>:</td>
                <td><input name="upgradable" id="upgrade_check" <?php echo ($db->upgradable == 1) ? "CHECKED" "" ?> type="checkbox"></td>
            </tr>
        </table>
        <table id="upgradable" style="display:<?php echo ($db->upgradable == 1) ? "block" "none" ?>;">
            <tr>
                <td width="100px"><?php echo _t("Upgrade to")?>:</td>
                <td><select name="upgradeto"><option value="0">(<?php echo _t("Choose")?>)</option><?php echo getGroups($db->upgradeto); ?></select></td>
            </tr>
            <tr>
                <td width="100px"><?php echo _t("Downgrade to")?>:</td>
                <td><select name="downgradeto"><option value="0">(<?php echo _t("Choose")?>)</option><?php echo getGroups($db->downgradeto); ?></select></td>
            </tr>
            <tr>
                <td><?php echo _t("Minimum Upload")?>:</td>
                <td><input name="minupload" type="text" value="<?php echo $db->minupload ?>" size="25"></td>
            </tr>
            <tr>
                <td><?php echo _t("Minimum Ratio")?>:</td>
                <td><input name="minratio" value="<?php echo $db->minratio ?>" type="text"></td>
            </tr>
        </table>
        <input type="submit" name="save" value="<?php echo _t("Save group")?>" />
    </form>

    <?php
} Catch (Exception $e) {
    echo 
error(_t($e->getMessage()));
}
?>

and GO for add your color html in all group

for help http://html-color-codes.info/

In
libray/Acl.php line 38

PHP Code:

$this->__set("group_name"$db->name); 

remplace by

PHP Code:

$this->__set("group_name"$db->name);
            
$this->__set("group_color"$db->color); 

after go in /public_html/templates/default/template.php line 64

PHP Code:

<a href="<?php echo page("profile"?>" title="Go to profile"><strong><?php echo $acl->name?></strong></a>

remplace by

PHP Code:

<a href="<?php echo page("profile"?>" title="Go to profile"><strong><font color="<?php echo $acl->group_color?>"><?php echo $acl->name?></font></strong></a>

So remplace all
name; ?> by name; ?> :)

joeroberts 16th August 2012 08:13

just to be html compliant shouldn't
PHP Code:

<?php echo $acl->name?> by <font color=<?php echo  $acl->group_color?>><?php echo $acl->name;  ?></font>

be
PHP Code:

<?php echo $acl->name?> by <font color="<?php echo  $acl->group_color?>"><?php echo $acl->name;  ?></font>

and
PHP Code:

<a href="<?php echo page("profile"?>" title="Go to profile"><strong><font color=<?php echo $acl->group_color?>><?php echo $acl->name?></font></strong></a>

be
PHP Code:

<a href="<?php echo page("profile"?>" title="Go to profile"><strong><font color="<?php echo $acl->group_color?>"><?php echo $acl->name?></font></strong></a>


lafouine022 16th August 2012 08:37

yep thanks joeroberts I edit the first post:ok:

eedu 16th October 2012 02:42

Error
 
Notice: Undefined index: group_color in /home/gupix/www/library/DB.php on line 549

/-------------------------------------/
548 public function f($name) {
549 return $this->record[$name];
550 }
/-------------------------------------/


Help-me. :sad:

ajax 16th October 2012 03:03

Quote:

Originally Posted by eedu (Post 36892)
Notice: Undefined index: group_color in /home/gupix/www/library/DB.php on line 549

/-------------------------------------/
548 public function f($name) {
549 return $this->record[$name];
550 }
/-------------------------------------/


Help-me. :sad:

Add the SQL.

eedu 16th October 2012 03:07

Quote:

Originally Posted by ajax (Post 36893)
Add the SQL.

Error solved! Thanks

limitzcash 4th September 2013 19:08

How can you add this to the Forum also? I have it working fine for the rest of the site, and it works very well! Thank You!

It just doesn't show the username color on the forums.


All times are GMT +2. The time now is 17:16.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.