The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Coding problem
Hi Guys,
First real attempt at writing .... I have, in plugins, this working script : hooked into "postbit_display_complete" PHP Code:
The php creates a new thread in a nominated Forum. My problem is I can't work out how to 'send' details, such as, ThreadID into the .php and it's driving me nuts as no matter what I try I can't get anything useful to transfer which is an element of my inexperience. I've tried {vb:raw post.postid} and similar expressions and . $sessionurl . 'do=newthread&f=' . $forumid . none of which work. Question : Am I using an incorrect/inadvisable method with the plugin and, instead, should use a template to display icon and 'send' information to the .php? warmly Geoff |
#2
|
||||
|
||||
What you could do to pass the threadid to your external script is change the anchor tag as follows:
PHP Code:
PHP Code:
|
#3
|
|||
|
|||
Quote:
Thank you Mark - Perhaps my 'missing link'. --------------- Added [DATE]1454836359[/DATE] at [TIME]1454836359[/TIME] --------------- PHP Code:
|
#5
|
|||
|
|||
Quote:
--------------- Added [DATE]1454923043[/DATE] at [TIME]1454923043[/TIME] --------------- PHP Code:
|
#6
|
|||
|
|||
That happens because you're not escaping the variable correctly.
The following is the right way: PHP Code:
|
Благодарность от: | ||
jagtpf |
#7
|
|||
|
|||
Quote:
--------------- Added [DATE]1454947523[/DATE] at [TIME]1454947523[/TIME] --------------- To get a working work-around I settled on the following . HTML Code:
{vb:raw template_hook.postbit_controls} <vb:if condition="(in_array($thread['forumid'], array(189,105,104,114,115,109,110,111,113,112,207,106,116,108,216,225,226,231,247))) AND ($post[postcount] == '1'))"> <a href="testingthread.php?{vb:raw session.sessionurl}do=&p={vb:raw post.postid}" rel="nofollow" title="Nominate This Poem for Members Choice Award"><img src="images/buttons/memchoice.png" style="width: 26px; height: 26px; border: 0px;" alt="Nominate This Poem for Members Choice Award. Thank you." /> </a> </vb:if> --------------- Added [DATE]1454947988[/DATE] at [TIME]1454947988[/TIME] --------------- The accompanying .php file works as expected except it doesn't always trap the "cannot self-nominate" section - but I'll sort it out . I've also got the layout to address in the newpost, but otherwise the following is working. I fully appreciate it's probably very 'raw' with stuff that shouldn't be in there and stuff that ought to be added - If anyone can find any glaring issues - please advise. I've bundled together ideas from numerous places and the end result may not be 'tidy' in the eyes of experience - sadly lacking in myself! Things to change at a later stage when I've had a breather would be a 'better' call-out on the "Cannot Self-Nominate" and a "Thank-you for Nominating" at the end of the routine .... warmly Geoff PHP Code:
|
#8
|
|||
|
|||
I've followed example suggested in report.php in order to test that the nominee ID is not the same as the thread poster ID - in other words, for my purpose, you can't self nominate.
The coding I have only works on occasion - which is annoying...... Can anyone offer a 'better' way to grab and check the two user IDs as appropriate. EDIT : After another look at my code, I think it is working, but I hadn't told it what to do if the condition was TRUE - hence it continued through the rest of the code! Although it's not echoing the error message. |
#9
|
|||
|
|||
I cleaned it up for you. Removed unnecessary definitions of variables and a couple of other things. Note that I didn't test it so I'm not sure if it will actually work like this.
PHP Code:
|
#10
|
|||
|
|||
Thank you Dave - much appreciate the work you must have done on this .... Looks a hell lot better than my version.
I still need to double check the conditional which I've just discovered wasn't functioning properly on my original - I guess the routine just carried on regardless .... 'Just' looking to see if there's a 'better' way to advise on 'error' and add a 'thank you' at the end. Probably a javascript addition. --------------- Added [DATE]1455038807[/DATE] at [TIME]1455038807[/TIME] --------------- mmm It's not creating/sending the thread - just returning the final statement "No post id in URL". |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|