Users

How to Add a Link to User Names

How to Add a Link to User Names

Use code to link users to their profiles

RebelMouse makes it easy for content creators to build dynamic and engaging communities. Each user can have their own username, permissions, and profile. A user's profile can also be linked to via their username anytime it appears on your site.

There are two ways to add this link:

1. Add the Username as a Link to an <a> Tag

HTML:

<a href="#" id="my_username">PROFILE</a>

JavaScript:

<script type="text/lazy-javascript" priority="10">
var user_data_for_use;
setTimeout(function(){
{{require}}(['settings'], function (settings) {
user_data_for_use=settings;
document.getElementById("my_username").setAttribute("href","/u/"+settings.user_site.name);
});},1000);
</script>

Upon page load, the code above will change the value of the href attribute to href="/u/username_of_user" for any element that uses id="my_username.".

2. Insert the Username as Text Inside a <span> Tag

HTML:

<span id="my_username"></span>

JavaScript:

<script type="text/lazy-javascript" priority="10">
var user_data_for_use;
setTimeout(function(){
{{require}}(['settings'], function (settings) {
user_data_for_use=settings;
document.getElementById("my_username").innerHTML=settings.user_site.name
});},1000);
</script>

Upon page load, the code above will insert the username inside a <span> tag as text by referencing id="my_username."

If you have any questions about this feature, please email support@rebelmouse.com.

What Is RebelMouse?
Request a Proposal
subscription model for publishers
Rebel Insights

In 2023, Publishers Take Back Control With Subscription Success

Users are ready to pay for content that delivers

The Rise of the Mature User

It's been a long and winding path, but in 2023 the subscription model continues its upward trajectory as a top revenue strategy for publishers of all sizes. The tug of war between platforms and publishers reached its peak in the last few years of the previous decade, leaving users desperate for a modern user experience that's clear of any clutter from the duopoly that is Google and Facebook. This is why intelligent paywall models are a top choice for users looking to consume content right from the source. When done correctly, the strategy can work for any type of media. The New York Times, a frequent showpiece example of the power of paywalls, is constantly reporting record-busting subscription numbers, with 7.6 million digital subscriptions in 2021.

And it all makes perfect sense. The subscription model eliminates the middleman — such as the platforms — so readers get the experience and content they want, and publishers get the cash they need.

Keep reading...Show less
The Most Secure CMS of 2023
Featured

The Most Secure CMS of 2023

Why RebelMouse Is the Most Secure CMS on the Web

Delivering a secure, high-performing environment with extreme reliability is essential to all of our clients at RebelMouse. We only use industry-leading, reliable approaches to host our infrastructure. This ensures maximum stability and security for all of our clients’ data. Here are just some of the reasons we’re able to maintain a hard-bodied product that’s flexible, too.

Keep reading...Show less
Interested in a Free Website Health Check?Check Your
Website's Health
Get Your Free Analysis Now