Help with form to post

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
thebigmattb
Registered User
Posts: 47
Joined: Tue Jan 29, 2008 8:21 pm
Location: Sheffield, UK

Help with form to post

Post by thebigmattb » Tue Mar 01, 2016 2:14 pm

Hi All!

Fairly new to coding and trying to teach myself PHP! However I have got myself stuck :cry:

I am updating Fragnader's Form to post which I had on my forum for PHPBB 3.0.X but 3.1 stopping it working as the submit_post function changed.

I thought I had it and have managed to beat 90% of the bugs out of it.... however the last one I just can't seem to figure out.

"Fatal error: Call-time pass-by-reference has been removed in /home2/newyorks/public_html/poster.php on line 78"

Can anyone help me with this?

Code: Select all

<?php

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/message_parser.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);

//Yeah, I know this is not needed but I did it for simplicity
$username = $_POST["username"];
$guid = $_POST["guid"];
$age = $_POST["age"];
$tracker = $_POST["trackid"];
$microphone = $_POST["mic"];
$vent = $_POST["vent"];
$banned = $_POST["banned"];
$reason = $_POST["reason"];
$ref = $_POST["ref"];
$ip = $_SERVER["REMOTE_ADDR"];

$message = "AA Username: $username
PB Guid: http://www.hazardaaclan.com/history/accounthistory.php?guid=$guid
Age: $age
Tracker ID: http://aaotracker.com/usertracker.php?userid=$tracker
Mic? $microphone
Ventrilo? $vent
Banned? $banned
Reason for wanting to join? $reason
Refered by: $ref";

$time = time();

// note that multibyte support is enabled here
$rawsubject = "Americas Army Application for $username";
$subject	= utf8_normalize_nfc($rawsubject, '', true);
$message	= utf8_normalize_nfc($message, '', true);

// variables to hold the parameters for submit_post
$poll = $uid = $bitfield = $options = ''; 

generate_text_for_storage($subject, $uid, $bitfield, $options, false, false, false);
generate_text_for_storage($message, $uid, $bitfield, $options, true, true, true);

$data = array( 
	'forum_id'		=> 21,
	'topic_id'              => 0,   
	'icon_id'		=> false,
	'topic_type'		=> post_normal,

	'enable_bbcode'		=> true,
	'enable_smilies'	=> true,
	'enable_urls'		=> true,
	'enable_sig'		=> true,

	'message'           	=> $message,
    	'message_md5'    	=> md5($message),
				
	'bbcode_bitfield'	=> $bitfield,
	'bbcode_uid'		=> $uid,

	'post_edit_locked'	=> 0,
	'topic_title'		=> $subject,
	'notify_set'		=> false,
	'notify'		=> false,
	'post_time' 		=> 0,
	'forum_name'		=> '',
	'enable_indexing'	=> true,
	'force_approved_state'  => true,
	'force_visibility'      => true,
);

submit_post ( $mode,  $subject,  $username,  $topic_type,  &$poll,  &$data, [ $update_message = true]);

echo "Application Submitted, You may close this window.";

?>


User avatar
david63
Registered User
Posts: 16402
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Help with form to post

Post by david63 » Tue Mar 01, 2016 3:45 pm

Without line numbers on your code it is difficult to work out which line is causing the problem but I will make a guess at this one

Code: Select all

submit_post ( $mode,  $subject,  $username,  $topic_type,  &$poll,  &$data, [ $update_message = true]);
Try

Code: Select all

submit_post ( $mode,  $subject,  $username,  $topic_type,  $poll,  $data, [ $update_message = true]);
If this has worked in the past then it looks as if the version of PHP on your server has been updated.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
thebigmattb
Registered User
Posts: 47
Joined: Tue Jan 29, 2008 8:21 pm
Location: Sheffield, UK

Re: Help with form to post

Post by thebigmattb » Tue Mar 01, 2016 6:02 pm

Thanks David

That worked, let me move on and deal with next problem which is with the $_Post part as that has also changed. Looking into that now though via Area 51. (Searching for the answers myself before I annoy people here)

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21034
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: Help with form to post

Post by RMcGirr83 » Wed Mar 02, 2016 11:49 am

use the request_var class.
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

Post Reply

Return to “Extension Writers Discussion”

cron