We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Locked Topic
  • Pages:
  • 1
  • 2
[ C ] Linking Usernames in Posts Code
Topic Started: May 17 2013, 08:45 PM (876 Views)
MEwarner
Member
[ *  * ]
Is there a code that can link usernames in posts? I know it works w/ the staff & my username, but with the members it doesn't.
Offline Profile Goto Top
 
Replies:
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Admin CP Posted Image Themes Posted Image Board Template Posted Image Below the Board
Code:
 
<script type="text/javascript">
//<![CDATA[
$(function () {
$('table.posting #c_bbcode button:last').after(' <button type="button" id="username">Username</button>');

$('#username').click(function () {
var userPrompt = prompt('Please insert a username', '');
ZetaInsert('[username=' + userPrompt + ']');
});

$('td.c_post, #topic_review td, div.search_results').each(function () {
$(this).html($(this).html().replace(/\[username=(.+?)\]/gi, '<span class="username">$1</span>'));
});

function addLink(cUsername, pID) {
$('span.username').each(function () {
if ($(this).text() === cUsername) {
$(this).wrapInner('<a href="' + main_url + 'profile/' + pID + '/"></a>');
}
});
}

addLink('USERNAME', 'PROFILE_ID');
addLink('USERNAME', 'PROFILE_ID');
addLink('USERNAME', 'PROFILE_ID');
});
//]]>
</script>
Code:
 
addLink('USERNAME', 'PROFILE_ID');
That's all you have to change in the code and you can repeat it as many times as you like.
Offline Profile Goto Top
 
MEwarner
Member
[ *  * ]
Cory
May 18 2013, 11:22 AM
Admin CP Posted Image Themes Posted Image Board Template Posted Image Below the Board
Code:
 
<script type="text/javascript">
//<![CDATA[
$(function () {
$('table.posting #c_bbcode button:last').after(' <button type="button" id="username">Username</button>');

$('#username').click(function () {
var userPrompt = prompt('Please insert a username', '');
ZetaInsert('[username=' + userPrompt + ']');
});

$('td.c_post, #topic_review td, div.search_results').each(function () {
$(this).html($(this).html().replace(/\[username=(.+?)\]/gi, '<span class="username">$1</span>'));
});

function addLink(cUsername, pID) {
$('span.username').each(function () {
if ($(this).text() === cUsername) {
$(this).wrapInner('<a href="' + main_url + 'profile/' + pID + '/"></a>');
}
});
}

addLink('USERNAME', 'PROFILE_ID');
addLink('USERNAME', 'PROFILE_ID');
addLink('USERNAME', 'PROFILE_ID');
});
//]]>
</script>
Code:
 
addLink('USERNAME', 'PROFILE_ID');
That's all you have to change in the code and you can repeat it as many times as you like.
Thank you so much for all of your help.
Offline Profile Goto Top
 
Helena
Member Avatar
M is for Mod

Completed!

Your request has been completed. If you have any questions or concerns regarding the state of your request, please feel free to contact me via PM.
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Closed Requests · Next Topic »
Locked Topic
  • Pages:
  • 1
  • 2