1.8.x

Username Style

Submitted by Akay, , Thread ID: 3214

Thread Closed

RE: Username Style

OP
#11
25-04-2015, 10:41 PM
Nasyr Wrote:
That's a pretty sexy plugin to share. I'm jelly.

I know right. Come at me bro. Tongue

RE: Username Style

#12
25-04-2015, 10:41 PM
Kewl Wrote:
25-04-2015, 10:41 PM
Nasyr Wrote:
That's a pretty sexy plugin to share. I'm jelly.

I know right. Come at me bro. Tongue

I'm about to on Skype for this haha.
Please read the award requirements here before applying for them.
Rules and Regulations | Support Section | How to use Hide Tags
Don't message me to join a group, simply request to join one here.

RE: Username Style

#13
Hm, my inc/functions.php looks like this

Code:
/**
* Formats a username based on their display group
*
* @param string The username
* @param int The usergroup for the user (if not specified, will be fetched)
* @param int The display group for the user (if not specified, will be fetched)
* @return string The formatted username
*/

function format_name($username, $usergroup, $displaygroup="")
{
    global $groupscache, $cache, $db;

    if(!is_array($groupscache))
    {
        $groupscache = $cache->read("usergroups");
    }

    if($displaygroup != 0)
    {
        $usergroup = $displaygroup;
    }

    $ugroup = $groupscache[$usergroup];
    $format = $ugroup['namestyle'];
    $userin = substr_count($format, "{username}");

    if($userin == 0)
    {
        $format = "{username}";
    }

    $format = stripslashes($format);
    
    if($db->table_exists("nickstyles_nicks"))
    {
        global $db;
        $query = $db->simple_select('users', 'nickstyle', "username='{$username}' AND usergroup='{$usergroup}'");
        $user = $db->fetch_array($query);
        if(!empty($user['nickstyle']))
        {
            $query = $db->simple_select('nickstyles_nicks', 'style', 'nid='.$user['nickstyle']);
            $style = $db->fetch_array($query);
            $format = $style['style'];
            $format = stripslashes($format);
            return str_replace("{username}", $username, $format);
        }
        else
        {
            return str_replace("{username}", $username, $format);
        }
    }

    return str_replace("{username}", $username, $format);
}

Because I'm using another plugin, should I uninstall it?

RE: Username Style

#14
Is this the plugin that adds more and more queries to your board for every custom name style?
[Image: UeTXrZ5.png]

RE: Username Style

OP
This post was last modified: 26-04-2015, 09:27 AM by Akay
#15
26-04-2015, 12:02 AM
Oxygen Wrote:
Is this the plugin that adds more and more queries to your board for every custom name style?

Idk? find out by yourself. But no, I guess not. :yus:

25-04-2015, 11:49 PM
AndresXZ09 Wrote:
Hm, my inc/functions.php looks like this

Code:
/**
* Formats a username based on their display group
*
* @param string The username
* @param int The usergroup for the user (if not specified, will be fetched)
* @param int The display group for the user (if not specified, will be fetched)
* @return string The formatted username
*/

function format_name($username, $usergroup, $displaygroup="")
{
    global $groupscache, $cache, $db;

    if(!is_array($groupscache))
    {
        $groupscache = $cache->read("usergroups");
    }

    if($displaygroup != 0)
    {
        $usergroup = $displaygroup;
    }

    $ugroup = $groupscache[$usergroup];
    $format = $ugroup['namestyle'];
    $userin = substr_count($format, "{username}");

    if($userin == 0)
    {
        $format = "{username}";
    }

    $format = stripslashes($format);
    
    if($db->table_exists("nickstyles_nicks"))
    {
        global $db;
        $query = $db->simple_select('users', 'nickstyle', "username='{$username}' AND usergroup='{$usergroup}'");
        $user = $db->fetch_array($query);
        if(!empty($user['nickstyle']))
        {
            $query = $db->simple_select('nickstyles_nicks', 'style', 'nid='.$user['nickstyle']);
            $style = $db->fetch_array($query);
            $format = $style['style'];
            $format = stripslashes($format);
            return str_replace("{username}", $username, $format);
        }
        else
        {
            return str_replace("{username}", $username, $format);
        }
    }

    return str_replace("{username}", $username, $format);
}

Because I'm using another plugin, should I uninstall it?

Just replace it with the code that comes in the 'code edits.txt' file.

RE: Username Style

This post was last modified: 01-05-2015, 04:24 PM by thinkp4d
#16
Thanks for share! You';re great!

RE: Username Style

This post was last modified: 17-05-2015, 08:49 PM by Tropical
#17
I added this and it is installed along with made the "functions.php" changes :yus:

How would you add this to the UserCP in this area of options:

[Image: luY0Ark.png]


Aoki [Mentioning you.. huehue] :noh:




Oh wait, I figured it out :noh:
I had to read the "readme" lmao :yus:

RE: Username Style

This post was last modified: 17-05-2015, 09:21 PM by AndresXZ09
#18
I wonder too how to add a new page to the UCP :noh:

Edit: @Tropical just go to the templates of the usercp and find nav_misc or something open it and add the link to the page, it comes with instructions

RE: Username Style

#19
17-05-2015, 09:20 PM
AndresXZ09 Wrote:
I wonder too how to add a new page to the UCP :noh:

Edit: @Tropical just go to the templates of the usercp and find nav_misc or something open it and add the link to the page, it comes with instructions


Yep,
I figured this out exactly after I posted that :noh:

I'm making a gaming discussion forum :yus:

RE: Username Style

#20
Nice, good luck with that Smile

Users browsing this thread: 6 Guest(s)