vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Profile field in CMS (https://vborg.vbsupport.ru/showthread.php?t=315832)

AndrewSimm 12-04-2014 11:38 PM

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?

kh99 12-05-2014 08:51 AM

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.

AndrewSimm 12-05-2014 03:27 PM

yes I did create it and put the word "test" in it to see if I could get that word to render.

kh99 12-05-2014 04:07 PM

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.

AndrewSimm 12-06-2014 04:30 AM

Quote:

Originally Posted by kh99 (Post 2525877)
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']; 


Dead Eddie 12-06-2014 06:05 AM

<a href="https://vborg.vbsupport.ru/showthread.php?t=270256" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=270256</a>

AndrewSimm 12-06-2014 06:14 AM

Quote:

Originally Posted by Dead Eddie (Post 2525968)

that worked


All times are GMT. The time now is 12:57 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.02098 seconds
  • Memory Usage 1,750KB
  • 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
  • (5)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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