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 ] Certain topics to appear on creator's profile
Topic Started: Oct 26 2011, 12:41 PM (895 Views)
JJEmpire-ZNR
Member Avatar
Do I desire to learn the motives behind this insanity?
[ *  *  * ]
Board Address: Private (The forum I'm working on is currently closed and I'd like to keep it private for now. However, it is very new)
Board Software: Zetaboards
Description: I want a coding where topics in a specific sub-forum can be found on the profile of the member who originally created those topics. For example, let's say there's a sub-forum where you post stories. With this coding, all the stories a member posts in that sub-forum can then be found on his profile.
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
I have the code created, but it has bugs. I'm awaiting some fixes from a support site.
Offline Profile Goto Top
 
JJEmpire-ZNR
Member Avatar
Do I desire to learn the motives behind this insanity?
[ *  *  * ]
Ah, I see. How long ago did you ask for the fixes?
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Check here: http://www.sitepoint.com/forums/showthread.php?793075-jQuery-Help-Variables-Outside-of-Function&highlight=
Offline Profile Goto Top
 
Quozzo
Member Avatar
By the blood of Sanguinius!
[ *  *  *  *  * ]
Its duplicating the results because its looping through each topic starter and then looping through them to find the match for the profile name, and as your name is in there twice it finds it four times.
Code:
 
var forum_id = '1521804';

if (location.href.indexOf('/profile/') !== -1) {
$.get(main_url 'forum/' forum_id '', function (data) {

var nav_text = $('#nav span:last', data).text();

/* loops through each forum starter name /*
$('td.c_cat-starter a', data).each(function () {
var profile_id = $(this).attr('href').split('profile/')[1].split('/')[0];

/* It can select ANY topic starter with your profile ID (of which there are 2) and so selects both. coupled
with the above loop it now has your name twice as its also looping through the topic starter names (twice
is you profile ID appears twice) giving a grand total of four topics. */
$('td.c_cat-starter:has(a[href*="' profile_id '"])', data).prev('td.c_cat-title').find('a').each (function() {
var topic_id = $(this).attr('href').split('topic/')[1].split('/')[0];
var topic_name = $(this).text();

if (location.href.indexOf('/profile/' profile_id '') !== -1) {
/* You also used an ID to be appended in the loop and ID should only have one occurance as JS stops when it finds one, which is why they are akll on the same line. */
$('table.profile:eq(2) tbody tr:has(th)').before('<tr><td class="c_desc">My ' nav_text ' Topics</td><td id="my_topics"></td></tr>');
$('#my_topics').append('<a href="' main_url 'topic/' topic_id '/">' topic_name '</a>');
}
});
});
});
}
Edited by Quozzo, Oct 27 2011, 06:39 AM.
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Mind making the proper fixes for JJEmpire? I would like mess up the code even more. I'm not sure why you removed all of the addition operators, that just made the code bug out.
Offline Profile Goto Top
 
Quozzo
Member Avatar
By the blood of Sanguinius!
[ *  *  *  *  * ]
tbh i wasn't going to create this mod as it can only get the members topics in the sub-forum one page at a time which will be a huge strain on the server, or on the first page which would be inaccurate. I could do the latter though if you want JJEmpire?
Offline Profile Goto Top
 
JJEmpire-ZNR
Member Avatar
Do I desire to learn the motives behind this insanity?
[ *  *  * ]
Quozzo
Nov 3 2011, 01:50 PM
tbh i wasn't going to create this mod as it can only get the members topics in the sub-forum one page at a time which will be a huge strain on the server, or on the first page which would be inaccurate. I could do the latter though if you want JJEmpire?
Hmm...is there any chance the method of getting the topics from a certain area be replaced by providing the URLs of topics to add in the actual coding itself? As in, you add the URL for the topic to the coding, and the ID for the member profile the topic's supposed to appear on. Is there any chance that's possible?
Offline Profile Goto Top
 
Quozzo
Member Avatar
By the blood of Sanguinius!
[ *  *  *  *  * ]
JJEmpire
Nov 5 2011, 07:47 PM
Is there any chance that's possible?
Im guessing so:
Code:
 
<script type="text/javascript">
var userTopics = [
//["user ID","topic ID"],
["3139623","123456"]
]
if(/profile\/(\d+)/.test(location.href)){
var uid = RegExp.$1
for(var i=0,k=userTopics.length,roll="";i<k;i++){
if(uid == userTopics[i][0])
roll += "<a href='"+main_url+"topic/"+userTopics[i][1]+"/'>User Topic</a>";
};
if(roll)
$('.profile:last tbody').prepend("<tr><td class='c_desc'>User Topics</td><td>"+roll+"</td>");
};
</script>

The only problem is all the topic names will be the same, unless you want another field to change that too?
Edited by Quozzo, Nov 5 2011, 09:03 PM.
Offline Profile Goto Top
 
JJEmpire-ZNR
Member Avatar
Do I desire to learn the motives behind this insanity?
[ *  *  * ]
Quozzo
Nov 5 2011, 09:01 PM
The only problem is all the topic names will be the same, unless you want another field to change that too?
Yes, please. :)
Offline Profile Goto Top
 
Quozzo
Member Avatar
By the blood of Sanguinius!
[ *  *  *  *  * ]
Code:
 
<script type="text/javascript">
var userTopics = [
//["user ID","topic ID","Topic Name"],
["3139623","123456","Clicky"]
]
if(/profile\/(\d+)/.test(location.href)){
var uid = RegExp.$1
for(var i=0,k=userTopics.length,roll="";i<k;i++){
if(uid == userTopics[i][0])
roll += "<a href='"+main_url+"topic/"+userTopics[i][1]+"/'>"+userTopics[i][2]+"</a>";
};
if(roll)
$('.profile:last tbody').prepend("<tr><td class='c_desc'>User Topics</td><td>"+roll+"</td>");
};
</script>
Offline Profile Goto Top
 
JJEmpire-ZNR
Member Avatar
Do I desire to learn the motives behind this insanity?
[ *  *  * ]
Sorry for the long respond, but after testing it out, it seems it piles the topics together.

Screenshot: http://i240.photobucket.com/albums/ff73/JJEmpire/c65c9409.png

Both "JJEmpire's Art Topic" and "The Roleplay" are two different topics. Also, is there any chance the topics can be put into separate sections, which would be decided from the coding itself? I'm talking about something similar to the "Contact Information" and "Profile Information" sections.
Offline Profile Goto Top
 
Brendan
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