Resource icon

Unmaintained Default Username Tooltip 1.0

No permission to download
Compatible XF 1.x versions
  1. 1.2
  2. 1.3
Visible branding
No
EDIT: Changed some of the resource code a bit. Find the replacement code in message_user_info you used and replace it with the current replacement code or revert your template and go through the resource again. If you're reading this for the first time, disregard this message.

Hello everyone! You know how sometimes it's just so hard to keep up with users when they go through so many name changes? Well, I'm here to help you solve that problem.

First we'll create the custom user field we'll be using in this modification.

Open up the AdminCP and go to Users > Custom User Fields.

Now you'll want to click on Create New Field. For field ID enter "default_username" without the quotes. If you choose to use an alternate ID you'll need to remember what you chose for later. Now fill in the title 'Default Username' or whatever you choose to name the field. Next make sure to select 'preferences' from the radial options below.

Go ahead and click on the 'Options for Text Fields' tab. Make sure you're doing a Single-line text box. You'll want to set a text limit so that users can't create massive tooltips by using copy/paste for 'likeaboss'. Twenty character limit should suffice. You can always change this later if need be.

Now go over to the 'General Options' tab. You want to make sure the following are selected: Field is required, Show during registration, User editable, Editable only once. The last three are not required for this modification. We want to use editable only once so that users can't keep changing it, that would defeat the purpose.

Now once you're done, save the custom field.

Now open the message_user_info template and find:

Code:
        <h3 class="userText">
            <xen:username user="$user" itemprop="name" rich="true" />
            <xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user, 1, 1}</xen:contentcheck></em></xen:if>
            <!-- slot: message_user_info_text -->
        </h3>

Replace the above with:

Code:
            <xen:if hascontent="true">
                <span style="display:none;"><xen:contentcheck>{$user.customFields.default_username}</xen:contentcheck></span>
            <h3 class="userText">
                        <xen:username user="$user" class="Tooltip" title="{$user.customFields.default_username}" itemprop="name" rich="true" />
                        <xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user, 1, 1}</xen:contentcheck></em></xen:if>
                        <!-- slot: message_user_info_text -->
                </h3>
                <xen:else />
                <h3 class="userText">
                        <xen:username user="$user" itemprop="name" rich="true" />
                        <xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user, 1, 1}</xen:contentcheck></em></xen:if>
                        <!-- slot: message_user_info_text -->
                </h3>
                </xen:if>

Here's the part where the field_ID comes in handy. You'll want to copy your field_ID, whatever you set it as, and replace "default_username" from the code above, there are two areas where you'll need to replace the ID in the code above. Once you're finished, save the template. Go and enter your default name into the text box in preferences and then find a post by you on the forum. Hover over your username and a tooltip displaying your default username will appear.

Have fun^^ And if you have an idea that might improve upon my modification, feel free to share it. This add-on is opensource.

*****

Default Username Option

This is a follow up for Default Username Tooltip.

This is an option to overwrite usernames with the Default Username field. First we're going to create another custom field.

This time we're going to give the field the ID "default_username_option" without the quotes. The title will be Default Username Option. Display location 'Preferences'. Field type 'Radio Buttons'. Now in the Options for Choice Fields tab we'll give two options 'Default Username' and 'Regular Username'. For 'Default Username' enter a value of 'Yes'. For 'Regular Username' enter a value of 'No'. Under the General Options tab, select the following options, 'Show during registration', 'User editable'. Make sure not to select 'Editable only once' so users can change this when they want.

Now, in the message_user_info template, find:

Code:
            <xen:if hascontent="true">
                <span style="display:none;"><xen:contentcheck>{$user.customFields.default_username}</xen:contentcheck></span>
            <h3 class="userText">
                        <xen:username user="$user" class="Tooltip" title="{$user.customFields.default_username}" itemprop="name" rich="true" />
                        <xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user, 1, 1}</xen:contentcheck></em></xen:if>
                        <!-- slot: message_user_info_text -->
                </h3>
                <xen:else />
                <h3 class="userText">
                        <xen:username user="$user" itemprop="name" rich="true" />
                        <xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user, 1, 1}</xen:contentcheck></em></xen:if>
                        <!-- slot: message_user_info_text -->
                </h3>
                </xen:if>

Replace with:

Code:
        <xen:if is="{$user.customFields.default_username_option} == 'Yes'">
        <h3 class="userText">
            <a href="{xen:link members, $user}" class="username">{xen:helper richUserName, $user, {$user.customFields.default_username}}</a>
            <xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user, 1, 1}</xen:contentcheck></em></xen:if>
            <!-- slot: message_user_info_text -->
        </h3>
        <xen:else />
            <xen:if hascontent="true">
                <span style="display:none;"><xen:contentcheck>{$user.customFields.default_username}</xen:contentcheck></span>
            <h3 class="userText">
                        <xen:username user="$user" class="Tooltip" title="{$user.customFields.default_username}" itemprop="name" rich="true" />
                        <xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user, 1, 1}</xen:contentcheck></em></xen:if>
                        <!-- slot: message_user_info_text -->
                </h3>
                <xen:else />
                <h3 class="userText">
                        <xen:username user="$user" itemprop="name" rich="true" />
                        <xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user, 1, 1}</xen:contentcheck></em></xen:if>
                        <!-- slot: message_user_info_text -->
                </h3>
                </xen:if>
        </xen:if>
Author
Nights
Downloads
18
Views
616
First release
Last update

Ratings

0.00 star(s) 0 ratings

More resources from Nights

Top Bottom