Search code examples
phpforumphpbb

Populating posting.php message field from form submission on phpBB3 forum


I'm trying to add a form button that will take a variable string and insert it into $_POST['message'], such that when someone presses my 'post this on forum' button it takes them to the new topic page with my variable string already in the message textarea.

I've been messing with submit_post and have a form that submits a new post correctly when it's completed, however I don't want it to submit straight away; all I want is for it to load posting.php with my string already in the message field. Does anyone have any ideas?


Solution

  • I found an alteration you can make to posting.php to let it accept get parameters http://www.phpbb.com/community/viewtopic.php?f=46&t=2119831

    Here it is for the sake of completion:

    Find the following in posting.php:

        if ($submit || $preview || $refresh) 
    

    Add the following on a line before it:

    if( !$submit&& !$preview&& !$refresh&& !$save&& !$load&& !$delete&& !$cancel&& ( $mode== 'post'|| $mode== 'reply'|| $mode== 'quote' ) ) {
    $post_data['post_subject']= utf8_normalize_nfc( request_var( 'subject', '', TRUE ) );
    $message_parser->message= utf8_normalize_nfc( request_var( 'message', '', TRUE ) );
    

    Voila! Test it with http://yourdomain/forum/posting.php?mode=post&f=2&subject=hello&message=world