Adding New Fields in posting_editor.html

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
pabhu
Registered User
Posts: 10
Joined: Sat Feb 23, 2019 10:49 am

Adding New Fields in posting_editor.html

Post by pabhu »

I have added a custom post date field in posting_editor.html but i couldn't fetch its user entered value in posting.php

posting_editor.html

Code: Select all

	
	<dl style="clear: left;">
		<dt><label for="subject">{L_SUBJECT}{L_COLON}</label></dt>
		<dd>
			<!-- EVENT posting_editor_subject_prepend -->
			<input type="text" name="subject" id="subject" size="45" maxlength="<!-- IF S_NEW_MESSAGE -->120<!-- ELSE -->124<!-- ENDIF -->" tabindex="2" value="{SUBJECT}{DRAFT_SUBJECT}" class="inputbox autowidth" />
			<!-- EVENT posting_editor_subject_append -->
		</dd>
				<dt><label for="custom_post_date">{L_CUSTOM_POST_DATE}{L_COLON}</label></dt>
		<dd>
			<!-- EVENT posting_editor_custom_post_date_prepend -->
			<input type="date" name="custom_post_date" id="custom_post_date" tabindex="2" value="{CUSTOM_POST_DATE}{DRAFT_CUSTOM_POST_DATE}" class="inputbox autowidth" />
			<!-- EVENT posting_editor_custom_post_date_append -->
		</dd>
	</dl>
Posting.php

Code: Select all

	$subject = $request->variable('subject', '', true);
	$subject = (!$subject && $mode != 'post') ? $post_data['topic_title'] : $subject;
	$message = $request->variable('message', '', true);
	$custom_date = $request->variable('custom_post_date', '0', true);
	
	//$newtime = create_datetime()->setDate($custom_date)->setTime(00, 00);
	//$newtime = strtotime( $custom_date );
		//$update_time = $newtime->getTimestamp();
	//$custom_post_date = (!$custom_date) ? $current_time : $newtime; //me
I have added language for the field in common.php apart from this i havn't touched any files..
not even the event functions.
can someone help me to achieve this
Thanks!
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: Adding New Fields in posting_editor.html

Post by david63 »

That will be a lot easier to do as an extension rather than "custom" coding. For one thing adding code this way will mean that you will have to reapply that code after every update/upgrade whereas with an extension you will not need to do anything.

There is an extension that adds a subject line (cannot remember its name at the moment) that you could use as a guide as it is doing something similar but with a different field.
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
pabhu
Registered User
Posts: 10
Joined: Sat Feb 23, 2019 10:49 am

Re: Adding New Fields in posting_editor.html

Post by pabhu »

david63 wrote: Thu Mar 21, 2019 10:21 am That will be a lot easier to do as an extension rather than "custom" coding. For one thing adding code this way will mean that you will have to reapply that code after every update/upgrade whereas with an extension you will not need to do anything.

There is an extension that adds a subject line (cannot remember its name at the moment) that you could use as a guide as it is doing something similar but with a different field.
got it.. https://www.phpbb.com/customise/db/exte ... scription/
Thanks David
I ll see what i can do with this.
Post Reply

Return to “phpBB Custom Coding”