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 12-04-2014, 11:38 PM
AndrewSimm AndrewSimm is offline
 
Join Date: Sep 2006
Location: Atlanta, GA
Posts: 222
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Profile field in CMS

So far I created a plugin for vbulletin CMS product and parse templates hook

PHP Code:
$cistwitter $userinfo["field{$vbulletin->options['cistwitterprofilefield']}"];

$templater vB_Template::create('vbcms_twitter');
    
$templater->register('cistwitter'$cistwitter);
    
$templatevalues['cistwitterarray'] = $templater->render();
vB_Template::preRegister('vbcms_content_article_page'$templatevalues); 
Ultimately I would just like $cistwitter to show in the vbcms_content_article_page template but I am not sure how to just do that so I put that in this vbcms_twitter template via {vb:raw cistwitter} and tried to insert that template into vbcms_content_article_page via {vb:raw cistwitterarray}

What did I miss?
Reply With Quote
  #2  
Old 12-05-2014, 08:51 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Did you create a template in the Style Manager named vbcms_twitter, or does it exist? If not then when you render it, it will be blank.
Reply With Quote
  #3  
Old 12-05-2014, 03:27 PM
AndrewSimm AndrewSimm is offline
 
Join Date: Sep 2006
Location: Atlanta, GA
Posts: 222
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes I did create it and put the word "test" in it to see if I could get that word to render.
Reply With Quote
  #4  
Old 12-05-2014, 04:07 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, sorry, if I had read your first post carefully I would have seen that. Anyway, I created a plugin using hook parse_templates and this code:
PHP Code:
$templater vB_Template::create('vbcms_twitter'); 
    
$templater->register('cistwitter'$cistwitter); 
    
$templatevalues['cistwitterarray'] = $templater->render(); 
vB_Template::preRegister('vbcms_content_article_page'$templatevalues); 
Then I created a template named vbcms_twitter that had only the word 'test' in it. Then I edited the vbcms_content_article_page template and just under the css line at the top I added {vb:raw cistwitterarray}. Now when I view an article I get "test" at the top, so that seems to work.

When you want to use the user's actual twitter profile field, the $userinfo won't work. You could use $vbulletin->userinfo, but that would show each user their own profile field, and I have a feeling that's not what you want. If you want the article author's twitter field, I'm not sure how to do that offhand.
Reply With Quote
2 благодарности(ей) от:
AndrewSimm, Lynne
  #5  
Old 12-06-2014, 04:30 AM
AndrewSimm AndrewSimm is offline
 
Join Date: Sep 2006
Location: Atlanta, GA
Posts: 222
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
OK, sorry, if I had read your first post carefully I would have seen that. Anyway, I created a plugin using hook parse_templates and this code:
PHP Code:
$templater vB_Template::create('vbcms_twitter'); 
    
$templater->register('cistwitter'$cistwitter); 
    
$templatevalues['cistwitterarray'] = $templater->render(); 
vB_Template::preRegister('vbcms_content_article_page'$templatevalues); 
Then I created a template named vbcms_twitter that had only the word 'test' in it. Then I edited the vbcms_content_article_page template and just under the css line at the top I added {vb:raw cistwitterarray}. Now when I view an article I get "test" at the top, so that seems to work.

When you want to use the user's actual twitter profile field, the $userinfo won't work. You could use $vbulletin->userinfo, but that would show each user their own profile field, and I have a feeling that's not what you want. If you want the article author's twitter field, I'm not sure how to do that offhand.
That does work. It looks like my issue is $userinfo is not available on the CMS, so..

PHP Code:
$cistwitter $userinfo["field{$vbulletin->options['cistwitterprofilefield']}"]; 
does not work because of userinfo. How can I make this available?

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

when I try the below I get my profile field6 instead of the person who posted the article

PHP Code:
$cistwitter $vbulletin->userinfo['field6']; 
Reply With Quote
  #6  
Old 12-06-2014, 06:05 AM
Dead Eddie's Avatar
Dead Eddie Dead Eddie is offline
 
Join Date: Apr 2004
Location: at Home...
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<a href="https://vborg.vbsupport.ru/showthread.php?t=270256" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=270256</a>
Reply With Quote
2 благодарности(ей) от:
AndrewSimm, kh99
  #7  
Old 12-06-2014, 06:14 AM
AndrewSimm AndrewSimm is offline
 
Join Date: Sep 2006
Location: Atlanta, GA
Posts: 222
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dead Eddie View Post
that worked
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 12:38 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.03747 seconds
  • Memory Usage 2,248KB
  • 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
  • (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
  • (7)post_thanks_box
  • (4)post_thanks_box_bit
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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
  • 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_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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete