vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   adding userfield in post-bit legacy, under avatar (https://vborg.vbsupport.ru/showthread.php?t=224120)

svoeric 09-28-2009 03:20 PM

adding userfield in post-bit legacy, under avatar
 
ok, I'm done editing templates... it sucks everytime you do an upgrade.
So I'm doing all my newest mods with products & plug-ins.

I've done pretty well with all my mods, but I'm having an issue with one of the simplest ones!

I use post-bit_legacy format, and under the avatar, or in that general area, I list $post[field8]

I can't figure out how to get it to display using the hook. I'm always getting an error.

I tried just displaying the variable at the postbit_imicons hook.
I tried adding the code to a custom template, and then displaying the template on the postbit_imicons hook.

I must be making this wayyy harder than it is.
anyone got any help ?

Thanks

Lynne 09-28-2009 04:14 PM

Let's see what you wrote (and tell us the hook location of the plugin) and then tell us the exact error.

svoeric 09-28-2009 04:22 PM

oh, guess that would have been helpfull.. altho not much code there..

created template list_field8
with code...
$post['field8']

created plugin...
location postbit_imicons

with code...

$vbulletin->templatecache['list_field8']

Error is (3 times across top of page)

Parse error: syntax error, unexpected $end in /home/public_html/forum/includes/class_postbit.php(1221) : eval()'d code on line 2

Lynne 09-28-2009 05:55 PM

Please use the code tags when writing code in your post, it makes it easier to follow.

You say you created a plugin using the postbit_imicons hook location. Did you look to see where that was evaled in the code?

You have done nothing in your code to add anything to the postbit. Have you looked at any other modifications that add code to the postbit templates? I'd suggest taking a look at a couple and seeing how they did it. It will give you a better idea of how to get it done.

svoeric 09-28-2009 06:07 PM

I had a hard time finding anything that added to post-bit... that's why I posted for help :)

normally I would use code tags, but it's just 1 line each ...

Lynne 09-28-2009 06:50 PM

There is one regarding adding the gender to the postbit, one for adding country flags.... search for terms regarding those and you can find stuff, I'm sure.

But basically, you have a template hook right in that area - $template_hook[postbit_userinfo_left]. So, you really only need to write a plugin to use that hook (I usually use a postbit_display hook):

PHP Code:

$template_hook[postbit_userinfo_left] .= $post['field8']; 

or
PHP Code:

eval('$template_hook[postbit_userinfo_left] .= " ' fetch_template('your-template') . '";'); 

Go look for those other mods (you can even look in the add-ons section for just mods that add to the postbit/showthread page (I can't remember what the prefix is).

svoeric 09-29-2009 01:23 AM

Thanks Lynne, with the little push you gave me, I was able to write up this...
PHP Code:

if ($post['field8'] != "")
$template_hook[postbit_userinfo_left] .= $vbphrase['list_field8_label'] . $post['field8'] ;} 

using the postbit_display_complete hook.
I didn't see a real need for a template, so I left it out...

Lynne 09-29-2009 01:26 AM

Glad you got it working!


All times are GMT. The time now is 07:21 AM.

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.03172 seconds
  • Memory Usage 1,727KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete