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

Reply
 
Thread Tools Display Modes
  #11  
Old 06-26-2009, 09:35 PM
Spank Spank is offline
 
Join Date: Jan 2007
Location: Scotland
Posts: 809
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Use $bbuserinfo rather that $post. $post only works in the postbit I think.
Reply With Quote
  #12  
Old 06-26-2009, 09:39 PM
Mellymonster Mellymonster is offline
 
Join Date: Oct 2008
Posts: 308
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

so like this

Code:
<if condition="$bbuserinfo[field17]"> <img src="$stylevar[imgdir_misc]/$bbuserinfo[field17].gif" alt="$bbuserinfo[field17]" /></if>
In the forumdisplay?

Its not working
Reply With Quote
  #13  
Old 06-27-2009, 12:52 AM
Spank Spank is offline
 
Join Date: Jan 2007
Location: Scotland
Posts: 809
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try:
Code:
<if condition="$bbuserinfo['field17']"> <img src="$stylevar[imgdir_misc]/$bbuserinfo[field17].gif" alt="$bbuserinfo[field17]" /></if>
Reply With Quote
  #14  
Old 06-27-2009, 04:19 AM
Mellymonster Mellymonster is offline
 
Join Date: Oct 2008
Posts: 308
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I tried it and it doesn't work either
Reply With Quote
  #15  
Old 06-27-2009, 09:27 AM
Spank Spank is offline
 
Join Date: Jan 2007
Location: Scotland
Posts: 809
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok, where are you putting it, and what is happening?
Reply With Quote
  #16  
Old 06-27-2009, 01:04 PM
DragonBlade's Avatar
DragonBlade DragonBlade is offline
 
Join Date: May 2006
Posts: 189
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, there is a way. There's a bunch of ways. xP It just depends on which you want to use.

The EASIEST way would be to create a plugin that will fetch user info for each thread displayed by the forum. BE ADVISED, though, that this will create an additional query for each thread loaded with the forum display. XD Not somethin' you want, probably.

Next easiest would be to execute a custom query with a JOIN, something like SELECT thread.postuserid, userfield.field17 AS maritalstatus FROM thread, userfield WHERE thread.threadid IN (0,$ids) AND thread.postuserid=userfield.userid in the 'forumdisplay_query' hook. With the results assigned to an array $marital_status_array (as userid => maritalstatus), you could put <if condition="array_key_exists($thread[postuserid], $marital_status_array)">blahblahblah</if> in the threadbit template.


If you're willing to go through that kind of work, tell me, and I'll post some step-by-step instructions.
Reply With Quote
  #17  
Old 06-28-2009, 01:44 AM
Mellymonster Mellymonster is offline
 
Join Date: Oct 2008
Posts: 308
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm willing to go through with it, but can you make the instructions in layman terms :P it takes me a while to get things, but I'm willing to get it going.

--------------- Added [DATE]1246157167[/DATE] at [TIME]1246157167[/TIME] ---------------

Quote:
Originally Posted by Spank View Post
ok, where are you putting it, and what is happening?
I was putting it in Forumdisplay where it was first told for me to place it, and nothing happen at all, it didn't show nothing what so ever.
Reply With Quote
  #18  
Old 06-28-2009, 07:30 PM
DragonBlade's Avatar
DragonBlade DragonBlade is offline
 
Join Date: May 2006
Posts: 189
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

All right, now, Melly. I'll make this simple on ye, but I STILL want you to try to understand the inner workings behind it, m'kay? That way, if vBulletin changes things around, you might have an idea what to do.

First thing's first. We'll use ONLY plugins for this, and no template edits or file edits. That way, if something does go wrong, all you have to do it turn off the plugin, kay? Good.

We'll start by Creating a Product. Load up yer AdminCP, and scroll on down near the bottom. Expand Plugins & Products, and click on Product Manager. Scroll aaaallllllll the way to the bottom and click "Add/Import Product." For the Product ID, just enter "melmaritalthreads" or something. For the Title, put "Mel's Marital Status for Threads." For the version, we'll go with "0.01a". Description, "Some help that wonderful Sarteck using DragonBlade's account gave me!" Ignore the Product and Version Check URLs. Save it.

Yay, you have a Product! Now to make some Plugins for the Product.

Again, under Plugins & Products, click this time "Add New Plugin." For Product, select "Mel's Marital Status for Threads." (The only reason we added that Product, btw, was to organize the plugins. ) For the Hook location, select "forumdisplay_query".

TECHIE NOTE: This is the "location" in the script where the plugin will execute. If you open up your "forumdisplay.php" file, find the line:
PHP Code:
($hook vBulletinHook::fetch_hook('forumdisplay_query')) ? eval($hook) : false
That basically means that this hook will execute in that spot. This is important, because it means we can use the variables already in memory up to that point, and influence some variables that will come later. END TECHIE NOTE.

Now, for the title, enter "Marital Status Thread Query." Leave the execution order at default (5). Now for the important bit--the actual plugin code:
PHP Code:
// Query to check if/what threadowner's marital status is
$marital_status_threadids = array();
$marital_status_threads_query sprintf("SELECT thread.threadid, userfield.field17 AS maritalstatus FROM thread LEFT JOIN userfield ON(thread.postuserid=userfield.userid) WHERE thread.threadid IN (0,%s)"$ids);
$marital_status_threads_result $vbulletin->db->query_read($marital_status_threads_query);
while (
$marital_status_threads_row $vbulletin->db->fetch_array($marital_status_threads_result))
  {
$marital_statis_threadids[$marital_status_threads_row['threadid']] = $marital_status_threads_row['maritalstatus'];} 
What this does is it uses the $ids already gathered by vBulletin for the forumdisplay query, and puts the marital status of the users (assuming that's your field17) into an array with the thread ID as the key.

Leave "Plugin is Active" at no--you'll activate it in a moment. Save the plugin.



All right! Next plugin will be used to display field17 next to each user's name (I'm assuming that's where you want it, right?).

"Add New Plugin" again, select the Mel's Marital Status for Threads. Hook location is now 'threadbit_display'. (Also in the forumdisplay.php, a little further down, if you wanna glance at the PHP file.) Title this one "Marital Status Thread Display," because that's what this one will be doing--displaying the marital status. Leave the execution order at default, again (5).

The code here is relatively simple--we're just going to append the Marital Status onto the end of the postusername value for the thread. :3
PHP Code:
$thread['postusername'] .= $marital_status_threadids[$thread['threadid']]; 
TECHIE NOTE: the " .= " operator basically "concatenates" two strings, meaning it glues one onto the end of the other. END TECHIE NOTE.

Again, leave this off for now, and save it.



Almost done! Now all we need to do is go to the Plugin manager, locate the two plugins we just made, and put checkmarks in the boxes to activate them both. Now go look at your forums, and see if everything went smoothly. If there's some errors, it's liekly a typo in my code somewhere. XP Just deactivate the plugins and tell me what the error is.

If it works out, come back and tell me, too. :3

--------------- Added [DATE]1246227765[/DATE] at [TIME]1246227765[/TIME] ---------------

Quote:
Originally Posted by Mellymonster View Post
Is there a way to have post bit icons like a marital status icon, show up in the description in side the forum area?

I'm not talking about post icons.



That, I want when someone starts a thread, for that icon to appear automatically in the forum area without them having to do anything, is this possible?

Ho ho ho, also, if you didn't want it next to the name, but rather in the first column, change the variable in that second plugin to
PHP Code:
$thread['openclose_editable'
And if you wanted it to the LEFT of the username, try
PHP Code:
$thread['postusername'] = $marital_status_threadids[$thread['threadid']] . $thread['postusername']; 
Reply With Quote
  #19  
Old 06-29-2009, 06:22 AM
mikey12561 mikey12561 is offline
 
Join Date: Jun 2009
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey There just to introduce myself. I'm Mikey one of Mellies Techs for the site. I went ahead and did everything that you told her to do and we got an error.

here is actually a screenshot of that error. I deactivated the plugins for now.
Attached Images
File Type: jpg 2uhu8ut.jpg (278.2 KB, 0 views)
Reply With Quote
  #20  
Old 06-29-2009, 07:03 AM
Mellymonster Mellymonster is offline
 
Join Date: Oct 2008
Posts: 308
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I just wanted to verify that he is one of my techies...
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 10:11 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.10446 seconds
  • Memory Usage 2,296KB
  • 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
  • (2)bbcode_code
  • (5)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
  • (3)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (1)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
  • 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
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete