[OzzModz] User Name Color

xF2 Add-on [OzzModz] User Name Color 2.0.1 Patch Level 1

No permission to download

ENXF NET

Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
Joined
Nov 13, 2018
Messages
20,173
Points
823

Reputation:

ENXF NET submitted a new resource:

[OzzModz] User Name Color - Allows your users to set a user name color for themselves

Do your users want a way to express themselves a little more on your forum? User Name Color lets users set a custom color for their username or select from a pre-set style you add.

Need to ensure users aren’t making themselves invisible? Set disallowed colors to ensure that no matter what a user picks, their name will still be visible!

User Features
  • Set custom colors or select a predefined style for their username
Administrator Features
  • Create...

Read more about this resource...
 

ENXF NET

Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
Joined
Nov 13, 2018
Messages
20,173
Points
823

Reputation:

Toasty

New member
Registered
Joined
Apr 12, 2021
Messages
4
Points
13

Reputation:

The only problem I have is when a user that is not part of staff but has the exact same permissions as a staff member they can change their username style but it does not show on the forum.

Anyone else having this issue? If so, how can I fix it 😮‍💨
 

Toasty

New member
Registered
Joined
Apr 12, 2021
Messages
4
Points
13

Reputation:

FIX NUMBER ONE, "USERNAME STYLING":

I found the issue, in usergroups I HAD to give every group a color (I chose white) which that fixed the issue with regular non staff users not having styles applied. Next I fixed the console error below..

ERROR THATS BEING DISPLAYED IN THE SERVER CONSOLE:
  • ErrorException: Template error: [E_WARNING] Undefined variable $vB
  • src/addons/XP/VB/XF/Template/Templater.php:60


FIX NUMBER TWO, HERE IS THE FIX FOR THE ERROR ABOVE:
TEMPLATE LOCATION: src/addons/XP/VB/XF/Template

PHP:
<?php


namespace XP\VB\XF\Template;


/**
 * COLUMNS
 * @property bool xp_vb_is_verified
 */


class Templater extends XFCP_Templater
{
    public function fnUsernameLink($templater, &$escape, $user, $rich = false, $attributes = [])
    {
        $username = parent::fnUsernameLink($templater, $escape, $user, $rich, $attributes);
        $visitor = \XF::visitor();


        // Initialize $vB with an empty value
        $vB = '';


        if (!$user)
        {
            return $username;
        }


        if (!is_object($user))
        {
            if (!isset($user['user_id']))
            {
                return $username;
            }


            $user = \XF::em()->instantiateEntity('XF:User', $user);
        }


        if ($user instanceof \XF\Entity\User)
        {
            $hasVB   = 0;
            $vbType = \XF::options()->xpVbType;
          
              if ($visitor->hasPermission('view', 'XP_VB_Badge'))
            {             
              if ($vbType == 'default'){
                  $vB = '<i data-xf-init="tooltip" data-original-title="' . \XF::phrase('xp_vb_tooltip') . '" class="fa--xf far fa-check-circle fa-lg fa-fw xpvb" aria-hidden="true"></i>';
              } else if($vbType == 'icon'){
                  $vB = '<i data-xf-init="tooltip" data-original-title="' . \XF::phrase('xp_vb_tooltip') . '" class="fa--xf far '.\XF::options()->xpCustomVbIcon.' fa-lg fa-fw xpvb" aria-hidden="true"></i>';
              } else if($vbType == 'image'){
                  $vB = '<img data-xf-init="tooltip" data-original-title="' . \XF::phrase('xp_vb_tooltip') . '" src="' . \XF::options()->xpCustomVbImage . '" style="width: 20px; margin-bottom: -5px;" class="xpvb" aria-hidden="true" />';
              }
            }


            if ($user['xp_vb_is_verified']){
                $hasVB = true;
            }


            if ($hasVB)
            {
                if (\XF::options()->xpVB_location  == 'left')
                {
                    $username = $vB . $username;
                }
                else
                {
                    $username = $username . $vB;
                }


            }
        }


        return $username;
    }
}











_________________________________________________________________________________________________________________________________________________

THE ONLY THING WE ADDED TO THAT TEMPLATE IS:

Code:
// Initialize $vB with an empty value
$vB = '';


if ($visitor->hasPermission('view', 'XP_VB_Badge'))
{             
    // ... rest of the code ...
}
 
Top