MyBB Community Forums

Full Version: Auto form submit
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I basically need a plugin that submits a form every time a post is made (basically it's telling my chatbox that a post was made). Is this possible, and if so how could I go about doing it? Right now I don't understand much about mybb, but I am willing to learn if you will walk through this with me.
It depends on how your chatbox checks if a new post was made.
I have to submit a form to their website, which then pushes back to my chatbox.
<iframe width=0 height=0 src='chatboxsubmit.php?poster=mybb-> *user of last post*&link=mybb-> *link to last post*&title=mybb-> *title of thread last posted in *;' onload='JAVASCRIPT:this.theForm.submit();'></iframe>  
chatboxsumbit.php would contain the code that autosubmits a form, but I would have to know how to pull the last post made. I would also need to know where to place the iframe in order to force it to update the chatbox only on a new post.

Psuedocode example:
//file: chatboxsubmit.php
<form id='theForm' action='someotherwebstie.html' method='POST' >

         <input type='hidden' id='nme' value="Forum Bot" />
<?php

        $message = $_GET['poster'] . " posted in the thread [url='" . $_GET['link'] . "']" . $_GET['title'] . "[/url].";
        

?>

      <input type='hidden' name='pst' value="<?php echo($message); ?>" />

</form>

Basically when a post event occurs I need to have that iframe injected into the current page so taht it will update the chat box.
Bump, I need some help :/
PHP can't auto submit forms, PHP is back-end and not front-end thus you'd most likely require javascript. Unless you want to create an HTTP request and send it via PHP.
I think a plugin that uses the hooks newthread_do_newthread_end & newreply_do_newreply_end to fetch the post info, then use curl to submit the form info to the remote server.
(2011-09-02, 11:41 AM)dvb Wrote: [ -> ]I think a plugin that uses the hooks newthread_do_newthread_end & newreply_do_newreply_end to fetch the post info, then use curl to submit the form info to the remote server.

How would one go about starting to do such?
1. http://www.google.com/search?q=mybb+plugin+tutorial
2. using php & curl to submit a form

Please ask specific questions if you want specific answers Smile
(2011-09-03, 06:43 PM)dvb Wrote: [ -> ]1. http://www.google.com/search?q=mybb+plugin+tutorial
2. using php & curl to submit a form

Please ask specific questions if you want specific answers Smile

I asked for a tutorial on how to program the problem that I wrote :o, I don't see how I can be more specific when asking such a big question?
Do you know php?
Do you know how to write a plugin for mybb?
Do you know how to use curl?
Do you understand the steps required to accomplish what you're trying to do?
Pages: 1 2