I am creating a custom mod for my site, at the moment i have done this and only get a white page displayed, but at least the result appears. I am not sure what example to follow so that the rest of the showthread template appears too?
Plugin: Product: vBulletin Hook Location: showthread_post_start Title: galleryimagedisplay Execution Order: 5 PHP Code: Code:
$result = $db->query_first("SELECT * FROM dbtech_gallery_images WHERE roll_id = '$threadid'"); Code:
{vb:raw id} {vb:raw title} |
off hand it's vb:raw in the templates, not vbraw: and there is no $ either.
Code:
Test Text: {vb:raw id} {vb:raw title} |
I'm trying to use several of my user custom fields on a page in profile.php. I've got the template working and the page is displaying ok but I can't get the custom fields to display. I've tried a ton of stuff and just can't get it to work - would GREATLY appreciate any help you could provide. Here's what I'm doing now. This is the plug in code going into profile.php:
if ($_REQUEST['do'] == 'showsubscription') { echo 'test'; $customfields = array(); fetch_profilefields(0); $page_templater = vB_Template::create('showsubscription'); $page_templater->register('customfields', $customfields); } in the template itself I'm putting in: {vb:raw customfields.value11} where I want to use the field. I've also tried customfields.field11 various permutation of userinfo, userfield, etc. I was able to do this in vb3 no problem but having a tough time getting it to work in vB4. |
Do you have the working 3.x code?
|
Yes, in VB3 it was very easy - all I had to do was put $bbuserinfo[field11] on the template. The plugin portion of it was:
// ############################ start show subscription info ########################## if ($_REQUEST['do'] == 'showsubscription') { construct_usercp_nav('showsubscription'); $navbits[''] = 'Subscription Status'; $templatename = 'showsubscription'; $url =& $vbulletin->url; } |
I'm sorry, either I don't understand what you are trying to do or are missing something big.
|
I have a number of custom user fields created and I want for the values of those fields to appear on a profile page. In this case it's a subscription status page that lets the user know when their subscription expires and how many issues they have left remaining on their subscription. In VB3 the profile.php page had $bbuserinfo loaded with those fields and they could be called simply by putting $bbuserinfo[field11] in the template - it would put the value there.
showsubscription was the name of the custom template that I created and it would appear along with all of the profile page navigation around it. I have the showsubscription template appearing in vb4 now but I can't get the values of the custom fields to appear on the page. I'm pretty sure it will involve the {vb raw} function and registering a variable for it to be able to appear in the template but just can't figure it out. profile.php must already be loading the custom user fields somewhere because it's used elsewhere on the page. |
I have this little random banner code I've always used through the plugin system, but I can't seem to get it to work on vb4. Can anyone help?
normally, I call for it below the navbar with this... Code:
<br> Code:
$path = '/forum/images/adbanners/'; |
Quote:
Try using hook parse_templates and at the end of your plugin code add: Code:
vB_Template::preRegister('navbar', array('randombanner' => $randombanner)); Then in the navbar template, use this: Code:
<br> |
Thanks, Kevin. I really appreciate you taking the time to reply.
It seems I have everything right but it's not showing up. I'm not sure what else to do but this is the last thing I need before I can go live with my upgrades. VB is no help because it's custom code. I'm not sure what else to tell you that would be helpful? Would you be willing to hop over to my test forum and have a look? If so send me a pm and I'll give you login info. |
It could be because I had the code wrong - I fixed it in my post above. :o
|
Yay! that was it. I can't thank you enough. :D
|
Quote:
|
It has nothing at all to do with the topic of this article, but:
Last line: $randombanner = '<a href="'.$href.'" target="_blank"><img border="0" src="'.$src.'" /></a>'; |
Quote:
|
The thing I am not understanding at this point is. If I am trying to preregister a variable for use with a stock template, in this case header. Where am I putting my code?
Is there a stock location to add this to or am I having to jump from adding a simple variable used on sites since vb 3.x into learning the basics of plugin writing? GLOBALS.permissions.pmquota isn't working for me in a new situation so I am trying to learn how to register permissions with the header template. I believe the code is going to look like this? Code:
$permissions = $vbulletin->userinfo['permissions']; Also is the above enough or do I need to add more like: Code:
$permissions['pmquota'] = vb_number_format($vbulletin->userinfo['permissions']['pmquota']); |
I answered in your other thread, but I'll answer more generally here: for the header, navbar, and footer templates I would recommend the hook parse_templates, since that's always executed just before those templates are rendered.
But the variable you want to use has to be available at that hook, and the timing of the call to the parse_templates hook can change. In the case of $permissions, that is set just after the global_start hook is called, so if some plugin using the global_start hook renders a template, parse_templates will be called but $permissions won't have been set yet so preRegistering it to a template won't work. (That's also why GLOBALS.permissions.pmquota stopped working - using preRegister() instead won't make any difference). But as I mentioned in the other thread, $permission is just a copy of $vbulletin->userinfo['permissions'], so if you use {vb:raw bbuserinfo.permissions.pmquota} in the template, that may work without any preRegistering. |
is this possible
PHP Code:
|
As you wrote it, it is not going to work, you can't just put an "or" in the middle of any code.
I'm not really sure what your goal is or I'd give you an idea where to go... Maybe.. PHP Code:
Assuming list1 always exists array[0] gets its value Then If list2 exists the next element in array (array[1] in this case) gets the value of list2 |
Hi, i am trying to learn how to adjust the plugins for v3 to v4.
Can anybody guide me and tell me what it's wrong? Code working in 3.6.6. Code:
<?php Code:
<?php |
What error are you getting?
|
Quote:
My question is: if you register a variable that doesn't have to be register, the php makes an error? I did this in the plugin: Code:
$templater = vB_Template::create('hangman'); Sorry for my english, and thanks for your help. Also, the plugin, if you want to see it something more of the code is here: https://vborg.vbsupport.ru/showthrea...hlight=hangman |
Can you post your hangman template code?
|
Quote:
The original template hangman: Code:
$stylevar[htmldoctype] Code:
{vb:stylevar htmldoctype} |
The template looks OK.... I don't see a link to the page so we can see exactly what is happening. Something can "not work" in so many different ways, so it would be good to see exactly what is going on with this one.
|
1 Attachment(s)
Quote:
This is another plugin where i have, apparently, the same problem: The code is in the attached txt. Thank you for your help again. I reall apreciate always your help Lynne. |
Registering a variable that doesn't need to be registered or is empty will NOT cause an error.
Are you just getting a blank white page when you try to view it? In that case look for your php error log (your host may be able to tell you how to view it) and see what errors are coming up after trying to view the blank page. |
Quote:
Also i have another question of the use in the templates. For example, in the code that i put, in the old one appears like this: Code:
<vb:if condition="$stocktable != null"> --------------- Added [DATE]1356642316[/DATE] at [TIME]1356642316[/TIME] --------------- I solve the problem of the hangman. It seems like the PHP_SELF doesn't work in v4. Thanks to Lynne for the help. But i am working in the other one. My previous question to BirdOprey5 is about it. Lynne suspect that perhaps the problem is about javascript/ajax. ?Is different to v3 to v4? This is the code, if somebody knows that it is right or wrong: Code:
//----------------------------------------------------------------------------- |
Code:
<vb:if condition="$stocktable != null"> I'm sorry I don't know anything about AJAX differences between VB3 and VB4. |
Quote:
https://vborg.vbsupport.ru/showthrea...=242454&page=7 That variable "stocktable" must be registered in a plugin, but if i do it the forum dissapears. |
Links and Download Modification is stoped supported because the author is died
I have problem in vb 4.2.0 can't register the variables 1- plugins Name: Links and Downloads Manager - Add LDM to main vBulletin menu Hooks: Prosses_templates_complete code: PHP Code:
2- /includes/local_links_defns.php PHP Code:
PHP Code:
the problem Now , the variable is not registered like {vb:raw ldm_links_script} >> doesn't get the file name > thats make all links on the script ""when use the template" is invalid like this http://localhost/vb/.php // Links and Download Main links http://localhost/vb/.php?action=mod http://localhost/vb/.php?action=admin Please don't delete this post, the programer for this script will not help anymore, I searched alot to fix this problem but I can't fix it BTW: this problem only available in vb4.2.0 , and not present in 4.1.x , don't know what is the reason |
Hopefully someone can help here... I am beginning the daunting task of upgrading from vb3.8 to vb4. My forumhome uses a variable "$forumbitcounter" which is calculated in a plugin which contains the following code:
Code:
$forumbitcounter++; |
Quote:
PHP Code:
|
Quote:
Also the variable is actually used in the forumhome_forumbit_level1_post template so would it need to be registered there or would registering it in the containing template be okay? |
That code goes in the plugin right after your code that defines the variable. And if the variable is in the forumhome_forumbit_level1_post template template, then it needs to be:
PHP Code:
|
Thanks Lynne got it to work... I tried to like your post but got a message saying I have to like someone else's before liking any more of yours lol.
--------------- Added [DATE]1365617230[/DATE] at [TIME]1365617230[/TIME] --------------- One other quick issue...I think this is due to the array (which I didn't have to use in vb3), the first value appears to be null, but needs to start with 1. How do I tell it to start with a value of 1? |
I'm not sure I understand... what are you using in the template for the variable? It should just be $variable or {vb:raw variable}
|
I found where is the problem, thanks :)
|
Quote:
The problem seems to be on the first forumbitcount the value isn't 1 (I guess it is zero or is empty). Then the second forumbitcount is equal to 1 but should be 2. |
The variable needs to get preregistered for use in the template *after* is it defined, just like I had posted it above:
PHP Code:
|
All times are GMT. The time now is 12:22 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 | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|