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
[ C ] Clickable link to Blog - Code request
Topic Started: May 18 2013, 10:17 PM (717 Views)
RichardInTN
Member Avatar
I believe in I.D.I.C.
[ *  *  * ]
Board Address: Great Escape
Board Software: ZetaBoards
Description: I am hunting for code that will create a clickable link in the mini profile that appears below their Avatar in each post, the link will direct to member's blogs. I already have the custom profile field ("Blog") ready.

I know the code exists, because I had it until I recently tried to update my Board Template but lost internet connection half way through a slow upload. When I got back, I loaded my Board Template, and half of my "Above the Board" was gone, and everything below that was blank.

I've found most of what I had added but cannot find that one missing thing. I've searched here for a while and can't find it, so, any assistance would be greatly appreciated.

Thanks,
Richard
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Admin CP Posted Image Themes Posted Image Board Template Posted Image Below the Board
Code:
 
<script type="text/javascript">
//<![CDATA[
$('dl.user_profile dt:contains(Blog)').each(function () {
var uID = $(this).parents('tr').prev('tr[id*="post-"]').find('td.c_username a').attr('href').split('/profile/')[1].split('/')[0];
var text = $(this).next('dd').text();
$(this).next('dd').html('<a href="' + main_url + 'blog/main/' + uID + '/">' + text + '</a>');
});
//]]>
</script>
Offline Profile Goto Top
 
ghoshriju33
Member Avatar
I ❤ jQuery
[ *  *  * ]
Cory's code wont work while viewing the user's profile

use this instead:
ACP > Board Template > Below The Board
Code:
 
<script type="text/javascript">
//<![CDATA[
$("dl.user_profile dd:contains(Blog)").each(function () {
var userID = $(this).text();
$(this).html('<a href="' + main_url + 'blog/main/' + userID.split(' - ')[1] + '">Click here</a>');
});
//]]>
</script>


Installation:
Goto profile fields. Choose 1 line text and create a new one. Input the following:
Title: Blog
On Registration: No
Admin Only Edit: No
Show field in topics: Yes
Maximum input length 20

For the code to work, the user must enter his user id in the profile field.
It should be like this:
"Blog - 333333"
The user should only change the numbers
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
The field itself is kind of repetitive in the profile, but:
Code:
 
<script type="text/javascript">
//<![CDATA[
$('dl.user_profile dt:contains(Blog)').each(function () {
var uID;

if (location.href.indexOf('/profile/') !== -1) {
uID = window.location.href.split('/profile/')[1].split('/')[0];
} else if (location.href.indexOf('/topic/') !== -1) {
uID = $(this).parents('tr').prev('tr[id*="post-"]').find('td.c_username a').attr('href').split('/profile/')[1].split('/')[0];
} else if (location.href.indexOf('/msg/') !== -1) {
uID = $(this).parents('tr').find('td.c_username a').attr('href').split('/profile/')[1].split('/')[0];
}

var text = $(this).next('dd').text();
$(this).next('dd').html('<a href="' + main_url + 'blog/main/' + uID + '/">' + text + '</a>');
});
//]]>
</script>
Offline Profile Goto Top
 
RichardInTN
Member Avatar
I believe in I.D.I.C.
[ *  *  * ]
The link I am looking for isn't IN the profile. It's in the mini-profile attached to the right of every post a member makes to a thread.

Here's an example of where I am talking about:
Posted Image

ETA: If it matters, the old code that I had did everything automatically if they entered a name for their blog (it didn't even have to have anything to do with the blog {they could input "My Blog" into the field for all it mattered, and multiple people could individually use that same entry... and each one would correctly link to that Member's blog}... the link was automatic) into the profile field on the "Edit Profile" page.
Edited by RichardInTN, May 19 2013, 04:40 AM.
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
All codes above affect that area.
Offline Profile Goto Top
 
RichardInTN
Member Avatar
I believe in I.D.I.C.
[ *  *  * ]
Works perfectly Cory. Thanks!

Venomed, I appreciate your efforts as well!
Offline Profile Goto Top
 
Eccentric Feline
Member Avatar
梦想
[ *  *  *  *  *  *  *  * ]
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