Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-14-2011, 01:37 PM
killer_t killer_t is offline
 
Join Date: Nov 2010
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to put user profile field in Article Page

Hello at all. Sorry for my bad english!!

I want to get from db one userfield of article creator, and put them into the end of article in CMS.

I have try to put this code in vbcms_content_article_page :
PHP Code:
<vb:if condition="$post['fieldx']"><dt>Descrizione</dt> <dd>{vb:raw post.fieldx}</dd></vb:if> 
but i received a bad request from server.

I think missing some variable in the content.php file...

Can anyone help me please?

Thank's, Thomas.
Reply With Quote
  #2  
Old 09-16-2011, 07:53 AM
killer_t killer_t is offline
 
Join Date: Nov 2010
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No one can help me? Lynne even you?
Reply With Quote
  #3  
Old 09-16-2011, 10:27 AM
Dead Eddie's Avatar
Dead Eddie Dead Eddie is offline
 
Join Date: Apr 2004
Location: at Home...
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Use the plugin vbcms_article_populate_end:

PHP Code:
$view->fieldx vB::$vbulletin->userinfo['fieldx']; 
Then you'll be able to use {vb:raw fieldx} in your template
Reply With Quote
  #4  
Old 09-16-2011, 01:20 PM
killer_t killer_t is offline
 
Join Date: Nov 2010
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Don't work,
He takes the field of the user reading the article. Not the field of the article editor.
Reply With Quote
  #5  
Old 09-17-2011, 01:22 AM
Dead Eddie's Avatar
Dead Eddie Dead Eddie is offline
 
Join Date: Apr 2004
Location: at Home...
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Whoops. Guess 6:30 AM is too early for me to look at code.

You're right. The information isn't in scope. You'll have to first query the userfield table to grab it. Same hook.

The other option would be to add it via the model to the query hooks, but in order to do that, you'll have to edit the model. I'm not seeing a quick and obvious way of doing that without doing manual file edits.

If that's the case, though, it seems silly to have that hook in there...
Reply With Quote
  #6  
Old 09-17-2011, 10:17 AM
killer_t killer_t is offline
 
Join Date: Nov 2010
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Now I'll explain what I need fieldx.

Each article created by each author, will have 3 adsense modules. But how to divide the advertising of each author?
Entering your adsense code in fieldx, I withdraw this code so that it is put into scritp by
PHP Code:
{vb:raw fieldx
Reply With Quote
  #7  
Old 09-17-2011, 01:27 PM
Dead Eddie's Avatar
Dead Eddie Dead Eddie is offline
 
Join Date: Apr 2004
Location: at Home...
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hook vbcms_article_populate_end:

PHP Code:
if(self::VIEW_PAGE == $viewtype){
$field vB::$vbulletin->db->query_first('SELECT fieldx FROM ' TABLE_PREFIX ' userfield AS userfield WHERE userid = ' $view->authorid);

$view->fieldx $field['fieldx'];

Then you can use {vb:raw fieldx} in the template.
Reply With Quote
  #8  
Old 09-17-2011, 05:51 PM
killer_t killer_t is offline
 
Join Date: Nov 2010
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great, now works!! you have been legendary!
If you were here in Italy would offer you a beer!

Many thank's Eddie!!
Reply With Quote
  #9  
Old 09-22-2011, 10:07 AM
killer_t killer_t is offline
 
Join Date: Nov 2010
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I created a mod, and I thank you...

I have a question, if I wanted to know if the field exists, as I do?
I tried with this:

Code:
<vb:if condition="$field['field10']">
But it doesn't work :-D
Reply With Quote
  #10  
Old 09-22-2011, 04:21 PM
Dead Eddie's Avatar
Dead Eddie Dead Eddie is offline
 
Join Date: Apr 2004
Location: at Home...
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This line:

PHP Code:
$view->fieldx $field['fieldx']; 
only makes $fieldx available to the template. So, in theory, it should be:

PHP Code:
<vb:if condition="$fieldx"
If you want more than just that one field, you can change the line above to:

PHP Code:
$view->field $field
And then your syntax would work.
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 07:05 PM.


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.04842 seconds
  • Memory Usage 2,260KB
  • Queries Executed 11 (?)
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
  • (1)bbcode_code
  • (7)bbcode_php
  • (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
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete