Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 01-05-2015, 02:32 AM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Adding Thread Author to "Find latest posts" Search Results

Hello All,

I help administrate a math help site, and one of our staff has requested that when we go to a user's profile, and click "Find latest posts" that we see the author of each thread listed in the search results. This will be helpful in quickly determining if a nominee for math helper is consistently posting in threads started by other users.

I have attached an image, with the desired added field enclosed in red, to demonstrate what I am wanting to do.

I would be grateful if someone could point me to the PHP file where this information is built...I was thinking it would be search.PHP in the root directory, but looking at that file I don't see where this is done. It seems like this would be a fairly simple thing to add, if I just knew where to begin...
Attached Images
File Type: png searchresultbit.png (7.4 KB, 0 views)
Reply With Quote
  #2  
Old 01-05-2015, 07:53 AM
John Lester John Lester is offline
 
Join Date: Nov 2004
Posts: 543
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Perhaps it's because I'm quite tired, but you do realize that the "author" is the person listed after the "by" right?

I'm not sure what you're actually looking for.
Reply With Quote
  #3  
Old 01-05-2015, 08:00 AM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by John Lester View Post
Perhaps it's because I'm quite tired, but you do realize that the "author" is the person listed after the "by" right?

I'm not sure what you're actually looking for.
What I mean is the "Author" is the person who started the thread (the author of the first post in the thread, the thread starter), and "By" is the person who wrote the (possibly subsequent in the thread) post, the person whose posts are being retrieved in the search.
Reply With Quote
  #4  
Old 01-05-2015, 08:16 AM
John Lester John Lester is offline
 
Join Date: Nov 2004
Posts: 543
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ah yes, I see what you want to do now. I don't think I can help with this
Reply With Quote
  #5  
Old 01-05-2015, 06:09 PM
HM666's Avatar
HM666 HM666 is offline
 
Join Date: Jan 2014
Location: Little Rock, AR
Posts: 1,060
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Have you tried just adding some code to the template instead? There must be code somewhere for then thread starter to just add in that tidbit into the template. possibly something in this template code can help you add this info to your search template:

Code:
<div class="threadmeta">				
					<div class="author">
						<vb:if condition="$show['rmanage']">
							<span class="rmanage"><a href="{vb:raw $vboptions.vbforum_url}{vb:if "$vboptions['vbforum_url']", '/', ''}postings.php?{vb:raw session.sessionurl}do=editthread&amp;t={vb:raw thread.redirectthreadid}">{vb:rawphrase manage}</a></span>
						</vb:if>						
						<vb:if condition="!$show['detailedtime']">
							{vb:rawphrase started_by_x_y_z_a, {vb:link member, {vb:raw thread}, null, 'postuserid', 'postusername'}, {vb:raw thread.postusername}, {vb:raw thread.startdate}, {vb:raw thread.starttime}, {vb:stylevar dirmark}}
						<vb:else />
							{vb:rawphrase started_by_x_y_z, {vb:link member, {vb:raw thread}, null, 'postuserid', 'postusername'}, {vb:raw thread.postusername}, {vb:raw thread.startdate}, {vb:stylevar dirmark}}
						</vb:if>
						<vb:if condition="$show['unsubscribe']">
							 &nbsp; <a href="{vb:raw $vboptions.vbforum_url}{vb:if "$vboptions['vbforum_url']", '/', ''}newreply.php?{vb:raw session.sessionurl}do=newreply&amp;t={vb:raw thread.threadid}" rel="nofollow">{vb:rawphrase reply}</a>
							 | <a href="{vb:raw $vboptions.vbforum_url}{vb:if "$vboptions['vbforum_url']", '/', ''}subscription.php?{vb:raw session.sessionurl}do=removesubscription&amp;return=ucp&amp;t={vb:raw thread.threadid}" rel="nofollow">{vb:rawphrase unsubscribe}</a>
						</vb:if>
						<vb:if condition="$thread['pagenav']">
							<dl class="pagination" id="pagination_threadbit_{vb:raw thread.realthreadid}">
								<dt class="label">{vb:raw thread.totalpages} {vb:rawphrase pages} <span class="separator">&bull;</span></dt>
								<dd>
									{vb:raw thread.pagenav}
									<vb:if condition="$show['pagenavmore']"> <span class="separator">...</span> <span><a href="{vb:raw thread.lastpagelink}">{vb:raw thread.totalpages}</a></span></vb:if>
								</dd>
							</dl>
						</vb:if>
						<!-- iconinfo -->
						<div class="threaddetails td">
							<div class="threaddetailicons">
								<vb:if condition="$show['taglist']">
									<img src="{vb:stylevar imgdir_misc}/tag.png" alt="{vb:raw thread.taglist}" />
								</vb:if>
								<vb:if condition="$show['rexpires']">
									<img src="{vb:stylevar imgdir_misc}/expires.gif" alt="{vb:rawphrase expires_on_x_y, {vb:raw thread.expiredate}, {vb:raw thread.expiretime}}" />
								</vb:if>
								<vb:if condition="$show['moderated']">
									<img src="{vb:stylevar imgdir_misc}/moderated_small.gif" alt="{vb:rawphrase x_moderated_posts, {vb:raw thread.hiddencount}}" />
								</vb:if>
								<vb:if condition="$show['deletedthread']">
									<img src="{vb:stylevar imgdir_misc}/trashcan_small.gif" alt="{vb:rawphrase x_deleted_posts, {vb:raw thread.deletedcount}}" />
								</vb:if>
								<vb:if condition="$show['paperclip']">
									<a href="javascript://" onclick="attachments({vb:raw thread.threadid}); return false"> <img src="{vb:stylevar imgdir_misc}/paperclip.png" border="0" alt="{vb:rawphrase x_attachments, {vb:raw thread.attach}}" /></a>
								</vb:if>
								<vb:if condition="$show['subscribed']">
									<img src="{vb:stylevar imgdir_misc}/subscribed.png" alt="{vb:rawphrase you_are_subscribed_to_this_thread}" />
								</vb:if>
							</div>
						</div>
The author tag is where that info is in the threadbit.
Reply With Quote
  #6  
Old 01-05-2015, 07:47 PM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, my first thought was to modify the "search_resultlist" template, but what I found is that all of the search results information for that query is returned as HTML in {vb:raw searchbits}.

HTML Code:
			<vb:if condition="$show['results']">
				<ol id="searchbits" start="1" class="searchbits">
					{vb:raw searchbits}
				</ol>
			<vb:else />
So, I am assuming this HTML is compiled and generated by PHP code somewhere. I could perhaps write some javascript code to alter this HTML after the fact, but I think it would be more efficient to alter the PHP code generating the HTML instead.
Reply With Quote
  #7  
Old 01-06-2015, 05:01 PM
HM666's Avatar
HM666 HM666 is offline
 
Join Date: Jan 2014
Location: Little Rock, AR
Posts: 1,060
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try the "search_threadbit" template instead. It may be where you need to edit. Sometimes the vB Raw command is actually calling a template or a portion of a template.
Reply With Quote
Благодарность от:
MarkFL
  #8  
Old 01-06-2015, 05:12 PM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by HM666 View Post
Try the "search_threadbit" template instead. It may be where you need to edit. Sometimes the vB Raw command is actually calling a template or a portion of a template.
Thanks, I did look at that template too, but I believe it is responsible for displaying the thread listing when doing a simple word search or an advanced search.
Reply With Quote
  #9  
Old 01-06-2015, 06:13 PM
HM666's Avatar
HM666 HM666 is offline
 
Join Date: Jan 2014
Location: Little Rock, AR
Posts: 1,060
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ah! ok i see I missed the part about clicking the "Find Posts" in the users profile. Try this template then instead: "search_results_postbit" It is probably the place you need to look. you can put your code to add your author in this bit of code in the template. Just find this code:

Code:
<div class="userinfo_noavatar">
			<div class="contact">
				<div class="username_container">
					<h2>{vb:rawphrase thread}: <a href="{vb:link thread, {vb:raw post}, null, 'threadid', 'threadtitle'}" title="{vb:raw post.threadtitle}">{vb:raw post.threadtitle}</a></h2>
					<vb:if condition="$post['userid']">
						{vb:rawphrase by_x, {vb:link member, {vb:raw post}, null, 'userid', 'username'}, {vb:raw post.username}}
					<vb:else />
						{vb:rawphrase by_x_guest, {vb:raw post.username}}
					</vb:if>
				</div>
			</div>
and change it with your added author code:

Code:
<div class="userinfo_noavatar">
			<div class="contact">
				<div class="username_container">
					<h2>{vb:rawphrase thread}: <a href="{vb:link thread, {vb:raw post}, null, 'threadid', 'threadtitle'}" title="{vb:raw post.threadtitle}">{vb:raw post.threadtitle}</a></h2>
					<vb:if condition="$post['userid']">
						{vb:rawphrase by_x, {vb:link member, {vb:raw post}, null, 'userid', 'username'}, {vb:raw post.username}}
					<vb:else />
						{vb:rawphrase by_x_guest, {vb:raw post.username}}
					</vb:if>
                        <div>Author: YOUR AUTHOR CODE HERE</div>
                               
				</div>
			</div>
I tested it and it should add the info in the proper place. You can see by my screen shot attached.
Attached Images
File Type: jpg screenie.jpg (42.9 KB, 0 views)
Reply With Quote
2 благодарности(ей) от:
MarkFL, ozzy47
  #10  
Old 01-06-2015, 06:17 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, create a new plugin using hook location search_results_postbit and this code:
PHP Code:
$post['postusername'] = $thread->get_field('postusername');
$post['postuserid'] = $thread->get_field('postuserid'); 

then edit template search_results_postbit and add something like this (the red part was added:
Code:
<vb:if condition="$post['postuserid']">
	author <a href="{vb:link member, {vb:raw post}, null, 'userid', 'username'}">{vb:raw post.postusername}</a><br/>
<vb:else />
	{vb:rawphrase by_x_guest, {vb:raw post.postusername}}
</vb:if>
<vb:if condition="$post['userid']">
	{vb:rawphrase by_x, {vb:link member, {vb:raw post}, null, 'userid', 'username'}, {vb:raw post.username}}
<vb:else />
	{vb:rawphrase by_x_guest, {vb:raw post.username}}
</vb:if>
You're no doubt better at html than I am so I just hacked it in there figuring that you could fix it. ETA: ...or use what Len posted above.

Also if you want you could create phrases and use them like the "by" section does.

Edit: oh, I just re-read your first post. I probably should just have told you that you want to look at packages/vbforum/search/result/post.php and let you handle the rest.
Reply With Quote
2 благодарности(ей) от:
MarkFL, ozzy47
Reply

Thread Tools
Display Modes

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:11 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.04591 seconds
  • Memory Usage 2,302KB
  • Queries Executed 12 (?)
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
  • (4)bbcode_code
  • (1)bbcode_html
  • (1)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (5)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (2)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)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_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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete