The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Issues with $_POST within a product/plugin
Hi-
I am attempting to add an element to the inline moderation options (vB 4.1.3). The approach is to use a product that is imported/added via the customary procedure in the admincp. I've read Lynne's recommended link regarding how to do this in vB4 (as opposed to vB3) and seem to have that worked out. However I am not seeing the expected values in the $_POST['tlist'] and $_POST['plist'] array members when the action is taken. This code is roughly modeled after (and uses some of the exact code from) the inlinemod.php script. A good example is the Move Threads option in the inline moderation list. And when examining that, I noticed a difference between "movethread" and "domovethreads" WRT how the thread IDs are accessed. Thus from ~line 170: PHP Code:
As I mentioned, the code in this product follows that same type of model, including the differentiation between movethread and domovethreads. (which I don't understand completely but followed it anyway) So here are the (seemingly) pertinent snippets from this product that I am attempting to add: HTML Code:
<templates> <template name="forumdisplay_changetest" templatetype="template" date="1567832678" username="user" version="1.0"><![CDATA[ <form action="inlinemod.php" method="post" name="vbform"> <input type="hidden" name="s" value="{vb:raw session.sessionhash}" /> <input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" /> <vb:if condition="$_POST['do']=='changetest'"> <input type="hidden" name="threadids" value="{vb:raw threadids}" /> <input type="hidden" name="do" value="dochangetest" /> </vb:if> ... After the template definition is finished, then the plugin defintions follow. I adopted standard practice here, doing the the caching, etc. as described in the HOW-TO article. Also, I am using the vB_Template stuff to actually create the option in the inlinemod list of radio buttons. This works: I can select my option, press proceed and I am taken to inlinemod.php just as I should be. So that seems to be ok, it's what happens when I'm there that isn't. I'll save including those plugin snippets for the sake of brevity. The plugin code that seems necessary to include however is the one that is attached to the inlinemod_start hook, thus: Code:
<plugin active="1" executionorder="5"> <title>Change Test</title> <hookname>inlinemod_start</hookname> <phpcode><![CDATA[ if ($_POST['do']=="changetest" || $_POST['do']=="dochangetest") { echo "inlinemod_start (TOC): post=<br />"; var_dump($_POST); echo "<br />"; var_dump($vbulletin->GPC); echo "<br />"; PHP Code:
So ok. I must be missing something obvious here, as this concept isn't all that difficult. I've done a search on vb.org and I've dug through the code in an attempt to find where the list of selected threads (via forumdisplay.php) is captured and stored in $_POST plus entered some additional diagnostic code in inlinemod.php (no modifications, only printing) but I haven't figured out where I am going wrong yet. The plan is to keep banging away, but I thought I'd check here and see if anyone can see where I went left when I should have went right. Apologies in advance if this is a noob error, this is my first stab at adding a product. Thanks, Jerry ps-I just had a feeling that someone looking at this might want to see the template for the radio button, so I decided to go back and include it anyway, despite what I said above about brevity. Anyway, here it is: HTML Code:
<template name="forumdisplay_changetest_link" templatetype="template" date="1567832678" username="user" version="1.0"><![CDATA[ <li><label><input type="radio" name="do" value="changetest" /> {vb:raw vbphrase.changetest_link}</label></li> UPDATE Ok I think I know the difference between movethread and domovethreads now... --------------- Added [DATE]1307333104[/DATE] at [TIME]1307333104[/TIME] --------------- UPDATE Ok I got past the thread IDs issue and am now getting the correct ID that was selected on the forumdisplay page. However my template doesn't render, even though I am using vB_Template. So now to work on that. I'll post the answer when I get everything working. Thanks. --------------- Added [DATE]1307366465[/DATE] at [TIME]1307366465[/TIME] --------------- Got the template to render last night. However it needs work, HTML-wise that is. Once I finish that off, then I'll have only to flush out a few details and my first plugin will be complete. |
#2
|
|||
|
|||
Ok got this working properly and installed. The issue ended up being associated with how the inlinemod option selections are passed to the inlinemod.php script. Line 105 was the key (vB 4.1.3).
Thanks |
#3
|
||||
|
||||
Glad you got this figured out.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|