1.8.x

Username Style

Submitted by Akay, , Thread ID: 3214

Thread Closed

RE: Username Style

Akay
We are!
Level:
0
Reputation:
28
Posts:
946
Likes:
109
Credits:
2.05K
OP
25-04-2015, 10:41 PM
#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

Nasyr
Forum Janitor
Administrators
Level:
54
Reputation:
284
Posts:
8.05K
Likes:
959
Credits:
80
25-04-2015, 10:42 PM
#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

AndresXZ09
Closed Account
Level:
0
Reputation:
30
Posts:
1.22K
Likes:
139
Credits:
1.51K
25-04-2015, 11:49 PM
#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

Oxygen
<div class="postbit-usertitle">
Prime
Level:
0
Reputation:
35
Posts:
608
Likes:
63
Credits:
1.47K
26-04-2015, 12:02 AM
#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

Akay
We are!
Level:
0
Reputation:
28
Posts:
946
Likes:
109
Credits:
2.05K
OP
26-04-2015, 09:26 AM
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

thinkp4d
Closed Account
Level:
0
Reputation:
0
Posts:
21
Likes:
0
Credits:
0
01-05-2015, 04:14 PM
This post was last modified: 01-05-2015, 04:24 PM by thinkp4d
#16
Thanks for share! You';re great!

RE: Username Style

Tropical
Fulltime Member
Level:
0
Reputation:
35
Posts:
1.04K
Likes:
54
Credits:
117
17-05-2015, 08:40 PM
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

AndresXZ09
Closed Account
Level:
0
Reputation:
30
Posts:
1.22K
Likes:
139
Credits:
1.51K
17-05-2015, 09:20 PM
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

Tropical
Fulltime Member
Level:
0
Reputation:
35
Posts:
1.04K
Likes:
54
Credits:
117
17-05-2015, 09:32 PM
#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

AndresXZ09
Closed Account
Level:
0
Reputation:
30
Posts:
1.22K
Likes:
139
Credits:
1.51K
17-05-2015, 09:33 PM
#20
Nice, good luck with that Smile

Users browsing this thread: 1 Guest(s)