Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-16-2009, 05:10 PM
H3C x Nevz H3C x Nevz is offline
 
Join Date: Mar 2009
Posts: 82
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Display Latest Thread Started by User in One Forum

I have a forum (ID 26 for explaining purposes), and I have already installed a blank extra tab in everyone's profile. What I would like to do is have the latest thread the user has posted in forumid26 to appear in that tab. (JUST the body content). How would I set up the variables for this?
Reply With Quote
  #2  
Old 05-16-2009, 05:32 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Query for it.... something like (you'll have to play with it):
PHP Code:
   $myid=$this->profile->userinfo['userid']; 
$getthreads $vbulletin->db->query_first(
                SELECT thread.threadid,thread.title,thread.dateline,thread.forumid,thread.firstpostid, post.pagetext
                FROM " 
TABLE_PREFIX ."thread 
                LEFT JOIN " 
TABLE_PREFIX ."post ON (post.postid=thread.firstpostid)
                WHERE postuserid = '
$myid' AND forumid=26 AND sticky=0 
                ORDER BY thread.dateline DESC 
                LIMIT 1 
        "
); 
That should get you what you need and then do what you want with the results. I have NOT tested that query AT ALL. Play with this on a test site, not a live site.
Reply With Quote
  #3  
Old 05-16-2009, 05:55 PM
H3C x Nevz H3C x Nevz is offline
 
Join Date: Mar 2009
Posts: 82
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I used that, and it gives me the following error:

Code:
Parse error: syntax error, unexpected T_STRING in D:\Inetpub\virtual\xmf53y55qg\WWWROOT\forum\member.php(462) : eval()'d code on line 31
Here's what I have for the plugin for adding an extra profile tab.

Code:
$blocklist = array_merge($blocklist, array(
	'mymodification' => array(
		'class' => 'MyModification',
		'title' => 'Portfolio',
		'hook_location' => 'profile_left_last'
	)
));

class vB_ProfileBlock_MyModification extends vB_ProfileBlock
{
	var $template_name = 'memberinfo_block_mymodification';

	function confirm_empty_wrap()
	{
		return false;
	}

	function confirm_display()
	{
		return ($this->block_data['mymodification'] != '');
	}

	function prepare_output($id = '', $options = array())
	{
		$this->block_data['mymodification'] = '$myid=$this->profile->userinfo['userid']; 
$getthreads = $vbulletin->db->query_first(" 
                SELECT thread.threadid,thread.title,thread.dateline,thread.forumid,thread.firstpostid, post.pagetext
                FROM " . TABLE_PREFIX ."thread 
                LEFT JOIN " . TABLE_PREFIX ."post ON (post.postid=thread.firstpostid)
                WHERE postuserid = '$myid' AND forumid=26 AND sticky=0 
                ORDER BY thread.dateline DESC 
                LIMIT 1 
        ");';
	}
}
Reply With Quote
  #4  
Old 05-16-2009, 06:04 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Um... no. You need to do the query and all before you ever try to put anything into $this->block_data. You need to grab the info and get the variables defined before you ever try to spit it out as data (which is what $this->block_data is). Put it in the function, but before the block_data gets spit out. You are going to have to write the block_data stuff all yourself. I'm just giving you the query to get the information you need.
Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 06:16 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03558 seconds
  • Memory Usage 2,195KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete