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

Where 
Websites Are Built

The Fastest Sites in the World Run on RebelMouse

Let’s Chat

new!

RebelMouse Performance Monitoring

Real-Time Core Web Vitals

Get Started
DISCOVER MORE

Our Core Features

Our platform is a complete digital publishing toolbox that's built for modern-day content creators, and includes game-changing features such as our:

animate
Layout and Design toolLayout and Design tool on mobile
animate

Why RebelMouse?

Unprecedented Scale

RebelMouse sites reach more than 120M people a month, with an always-modern solution that combines cutting-edge technology with decades of media savvy. And due to our massive scale, 1 in 3 Americans have visited a website powered by RebelMouse.

120M+ Users
550M+ Pageviews
17+ Avg. Minutes per User
6+ Avg. Pages per User

Today's Top Websites Use RebelMouse

Thanks to the tremendous scale of our network, we are able to analyze a wealth of traffic data that informs our strategies and allows us to be a true strategic partner instead of just a vendor.

upworthyindy100Vault12No Film SchoolRawStoryResponsible StatecraftPrideRolling Stone QuebecPremierGuitarPenskeINN Educate Brand ConnectThe FulcrumGZEROOkayafricaBrit+CoPaper MagazinePowerToFlyNarcityCommonDreamsAllBusiness

What Clients Say

We’re here to help you weigh and understand every tech and strategic decision that affects your digital presence. Spend less time managing everything yourself, and more time focused on creating the quality content your users deserve.

Case Studies

A Team Built Like No Other

RebelMouse employs a unique, diverse, and decentralized team that consists of 70+ digital traffic experts across more than 25 different countries. We have no central office, and we cover every time zone to ensure that we’re able to deliver amazing results and enterprise-grade support around the clock.

Our team is well-versed in all things product, content, traffic, and revenue, and we strategically deploy ourselves to help with each element across all of our clients. We thrive on solving the complex.

Let's Chat