vBulletin Modifications

Can anyone help/mentor me with this simple hack please?

Welcome to vBHackers.com! - vBHackers Updates:

Go Back   vBulletin Modifications > General vBulletin Section > General vBulletin Support

Reply
 
LinkBack Thread Tools
Old 10-21-2006, 11:06 PM   #1
vB Newbie
Join Date: Jan 2006
Razasharp is on a distinguished road

Default Can anyone help/mentor me with this simple hack please?

I am trying to get users latest X posted threads from specific forums showing in the user profiles. I have limited PHP Mysql knowledge (but am learning) so was wondering if someone could help me with this please? I'd very much appreciate it

I basically want to display 3 seperate blocks (1 for each forum) showing the latest 5 threads that a user has posted in their profile page:

Quote:
See User's latest 5 threads posted in forum10

-Users latest thread 1 Title
date posted

-Users latest thread 2 Title
date posted

-Users latest thread 3 Title
date posted

-Users latest thread 4 Title
date posted

-Users latest thread 5 Title
date posted


See User's latest 5 threads posted in forum15

-Users latest thread 1 Title
date posted

-Users latest thread 2 Title
date posted

-Users latest thread 3 Title
date posted

-Users latest thread 4 Title
date posted

-Users latest thread 5 Title
date posted


See User's latest 5 threads posted in forum16

-Users latest thread 1 Title
date posted

-Users latest thread 2 Title
date posted

-Users latest thread 3 Title
date posted

-Users latest thread 4 Title
date posted

-Users latest thread 5 Title
date posted
I could probably do it with 3 querys but am sure it's possible with just one?

Any help is appreciated.

Thanks.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Old 10-22-2006, 04:55 AM   #2
vBulletin Guru
Nick R's Avatar
Join Date: May 2006
Real Name: Nick
Location: Cyberspace, UK
Nick R is on a distinguished road

Default

well, just make a query like you normally would to retrieve ALL the threads the user has posted. Then loop it around using "while" statement. No to make sure you stop at 5 threads make 3 variables:
You must first be a registered member to view any code.
Then you have to say which 3 forum id's you want:
You must first be a registered member to view any code.
Now the names:
You must first be a registered member to view any code.
Make sure those variables are the same. EG. If I have a forum named fred and another one called george. George's forum id is 2 and fred's is 1 so you should put:
You must first be a registered member to view any code.
Then you need something like:
You must first be a registered member to view any code.
You must first be a registered member to view any code.
You must first be a registered member to view any code.
at the end add:
You must first be a registered member to view any code.
Now you just have to construct 3 templates and put $latest_5_threadsouter somewhere in the template you want it. Oh and by the way a suggested hook location would be: member_complete.

Hope that helped

Regards,
Nick.

ps. this code is untested and I wrote it from memory. It also depends on what you do for the query.

Last edited by Nick R; 10-24-2006 at 05:42 AM.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-23-2006, 12:14 AM   #3
vB Newbie
Join Date: Jan 2006
Razasharp is on a distinguished road

Default

Thanks Nick!

Although I'm still a little stuck :alien:

How effecient is it to call 'all' the threads the user has posted? Would it be better to use 3 querys instead that has a limit to 5 per forum? :ermm:

Could you give me an example query too please? (Sorry to be a pain - but I found this on a similar hack and it has a lot more in there that I probably wouldn't have included so have lost confidence! )

You must first be a registered member to view any code.
It seems I have a lot to learn yet

Any help would be appreciated.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-23-2006, 04:27 AM   #4
vBulletin Guru
Nick R's Avatar
Join Date: May 2006
Real Name: Nick
Location: Cyberspace, UK
Nick R is on a distinguished road

Default

Just to answer your first bit I think it would probably be better to use 1 query for all the data rather than 3 queries for all the necessary data. I really don't know but I would stick with the one query. As for the query you just need something simple.
You must first be a registered member to view any code.
Then in the latest_5_threadsbit you just need to have something like:
You must first be a registered member to view any code.

Last edited by Nick R; 10-23-2006 at 08:34 AM.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-23-2006, 08:32 AM   #5
vb.org @dministrator
Join Date: Apr 2006
Paul M is on a distinguished road

Default

That query won't work, there is no table defined in it.

Try ;

You must first be a registered member to view any code.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-23-2006, 08:33 AM   #6
vBulletin Guru
Nick R's Avatar
Join Date: May 2006
Real Name: Nick
Location: Cyberspace, UK
Nick R is on a distinguished road

Default

oops xD, edited the post.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-24-2006, 01:06 AM   #7
vB Newbie
Join Date: Jan 2006
Razasharp is on a distinguished road

Default

Thanks Nick, and Paul

So basically.. I have this code as a plugin at member_complete:

You must first be a registered member to view any code.
Then I have three new templates called:

latest_5_threadsbit_0
latest_5_threadsbit_1
latest_5_threadsbit_3

With the code:

You must first be a registered member to view any code.
Then another template called latest_5_threadsouter with something as simple as:

You must first be a registered member to view any code.
And then in the member profile I simply put:

$latest_5_threadsouter

Where I want it to show....right?

...How far off am I? :nervous:




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-24-2006, 05:28 AM   #8
vBulletin Guru
Nick R's Avatar
Join Date: May 2006
Real Name: Nick
Location: Cyberspace, UK
Nick R is on a distinguished road

Default

well for the first bit the template remains the same but it is a different variable depending on the forum. The reason for this is because what you just pointed out. Each of the templates have the same code in so why not just use one
Quote:
eval('$latest_5_threadsbit_1 .= "' . fetch_template('latest_5_threadsbit') . '";');
so you should just have one template: latest_5_threadsbit.

I just relealised a bit of a glitch in my plugin code so give me a few mins to edit my post an rewrite it.
EDIT: Now you need to make 3 templates called latest_5_threadsinner_0, latest_5_threadsinner_1 and latest_5_threadsinner_2.
In latest_5_threadsinner_0 put:
You must first be a registered member to view any code.
In latest_5_threadsinner_1 put:
You must first be a registered member to view any code.
In latest_5_threadsinner_2 put:
You must first be a registered member to view any code.
Then recopy the code I have just edited in my first post.

And the template latest_5_threadsbit should have this code:
You must first be a registered member to view any code.

Last edited by Nick R; 10-24-2006 at 05:44 AM.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-25-2006, 08:48 PM   #9
vB Newbie
Join Date: Jan 2006
Razasharp is on a distinguished road

Default

Hi Nick.. I'm not sure where I'm going wrong :-/

I have the Plugin code as:

You must first be a registered member to view any code.
And new templates as:

latest_5_threadsinner_0

You must first be a registered member to view any code.



latest_5_threadsinner_1

You must first be a registered member to view any code.


latest_5_threadsinner_2

You must first be a registered member to view any code.

latest_5_threadsbit

You must first be a registered member to view any code.
latest_5_threadsouter

You must first be a registered member to view any code.
And then I place $latest_5_threadsouter where I want them to show in my member profile template... right? But it's not working Any ideas what I'm doing wrong?
Cheers.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-25-2006, 10:22 PM   #10
vB Newbie
Join Date: Jan 2006
Razasharp is on a distinguished road

Default

Update:

When you click on a last poster username when on the page forumhome - it seems to 'do something', but at the top of the page it says:

You must first be a registered member to view any code.
Which is the bit:

Quote:
$forumid[0] = 16;
$forumid[1] = 14;
$forumid[2] = 93;
It returns:

Quote:
f1 name here
doggy sailor
01:00 AM, 01-09-2006
weeeeeeeee (parson russell terrier)
01:00 AM, 31-08-2006
a little more...
01:00 AM, 24-08-2006
lethargic dog what could it be?
01:00 AM, 22-08-2006
poor dog (parson russell terrier)
01:00 AM, 17-08-2006
f2 name here
doggy sailor
01:00 AM, 01-01-1970
weeeeeeeee (parson russell terrier)
01:00 AM, 01-01-1970
a little more...
01:00 AM, 01-01-1970
lethargic dog what could it be?
01:00 AM, 01-01-1970
poor dog (parson russell terrier)
01:00 AM, 01-01-1970
f3 name here
doggy sailor
01:00 AM, 01-01-1970
weeeeeeeee (parson russell terrier)
01:00 AM, 01-01-1970
a little more...
01:00 AM, 01-01-1970
lethargic dog what could it be?
01:00 AM, 01-01-1970
poor dog (parson russell terrier)
01:00 AM, 01-01-1970
However the links for f1 name here, f2 name here etc are just: http://www.mydomain.co.uk/forumdisplay.php?f= (the forum ID missing)

And the latest 5 threads are repeated (and are from 'any' forum, not just the ones we want from the specific forum).

When you visit a member profile as normal (eg / m ember.php?u=704) none of the hack displays at all (not even the error message)...

Sorry to give you a headache Nick!




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
A simple hide hack? thablewprnt vBulletin Modification Requests 2 09-20-2006 01:18 PM
Simple hide hack eric22269 vBulletin Modification Requests 13 08-06-2006 08:38 AM
Install System Part 2 Ken Iovino Announcements 10 05-19-2005 10:40 AM


All times are GMT -3. The time now is 04:21 AM.


SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc. (Patent Pending)