![]() |
vB4 plugin problem - Not showing in profile
Hi everyone,
My forum uses the opt-out forums modification which enables users to select certain (sub) forums from showing up on their "New posts" searches. We're upgrading to vB4 during the weekend, but the mod has not been converted for vB4 yet. I have attempted converting it myself, in order to ensure my users can continue using the functionality offered by it, but seem to be running into some trouble with getting it to show up. I am hoping someone here might be able to help me figure out where I am going wrong. Let's have a look at the plugin code first. It's been set to the hook profile_editoptions_start: Code:
function fetch_optout_forumids_array($parentid = -1, $depthmark = '') Code:
<div class="blockrow"> Thanks in advance :) Peter |
You will need to register (preregister) the variable for use in that template. Cellarius wrote a really good article that you may be interested in - [vB4] Rendering templates and registering variables - a short guide
|
Hi Lynne, and thanks for responding.
The article has been very helpful before, so I definitly used it while converting the rest of my forum. I think I did try the preregister before. I changed the code just now and tested, but I still cannot see the list I am expecting. Using debug mode, I can see that the option template is being loaded, and that it is actually processed a few times (which would make sense, seeing it loops through the whole list of forums and is supposed to add a line for every forum), but nothing is being rendered. This seriously has had me stumped for a while now, hence trying to see if anyone would be able to offer some help here. Sometimes one overlooks somethign incredibly simple, and a few other eyes easily will spot the error. Alternatively, are there any good tutorials on writing plugins for vB4 anywhere? |
And what code are you using to preregister it and where?
|
Quote:
The block of code dealing with the template now looks like this: Code:
$templater = vB_Template::create('mytemplate'); The only other change I made was to replace $vbulletin->userinfo with $bbuserinfo. Other than that, the code is the same as above. |
According to your code, you preregistered to use a variable called "option", but that variable isn't in your template at all.
|
Quote:
That does not seem to correspond to the article by Cellarius, or this article. I take these to mean that the first variable is the name of the template to preregister the variable for. In my case, that is option (I think. I want it in the Settings (Formerly known as User CP) / General Settings). However, I did notice that I left in a dollarsign in front of the optoutforumbits line prior to the preRegister. Fixing that, however, did nothing to improve the situation :( |
Whoops, I read that wrong. But, this is the format I use to preregister variables (my cheatsheet blurb below):
PHP Code:
According to what you wrote above (without extra $): Code:
$templatevalues['optoutforumbits'] = $templater->render(); |
Thanks, Lynne. I tried substituting my variable and included the templatevalues, but to no result.
I will rewrite the code in the plugin to the way you posted, and see if that does anything. Thanks again. |
Looking at your code, in the foreach loop you may want to change:
PHP Code:
PHP Code:
|
Quote:
Changed and tested, but still a surprising lack of the control in my options. I just do not get it. To the best of my knowledge, this should be doing the trick. All articles I read here and all the advice I had seems to suggest this ought to work, but it does not. Very odd, indeed. I might try and start from scratch with a new plugin and work my way up from there. |
Why don't you post the exact code you are using right now so we can try it out on our own test sites and see what is up.
|
Hi Lynne,
Sure. Here's the code from the plugin: Code:
function fetch_optout_forumids_array($parentid = -1, $depthmark = '') Code:
<div class="blockrow"> |
I'm surprised you were able to save your template when you had {session.sessionurl} instead of {vb:raw session.sessionurl}. It gave me an error until I corrected it.
This is supposed to show up on my Settings > General Settings page, right? I have it there, but it is not the "options" template, it is the "modifyoptions" template that it goes into and needs to be preregistered in. And, you didn't supply me with the contents of "mytemplate", so I can't see any output anyway. But, there is something there, it's just incomplete because you didn't provide me with the other needed info. |
Hi Lynne,
Thank you. That seems to have done the trick. I now see something happening at least. It's not yet what I expected or needed, but it's way better than not seeing anything at all. I am assuming it did not work because even though the option template was being evaluated, that was not the right template. Thanks agian for your help. I'll see what I still need to do to get the rest working, but this is definitly an encouragement :) Peter |
All times are GMT. The time now is 09:29 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|