<t> and </t> tags appearing in title when I use submit_post function

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
20aubac
Registered User
Posts: 4
Joined: Tue Aug 22, 2017 2:51 pm
Location: Paris, France

<t> and </t> tags appearing in title when I use submit_post function

Post by 20aubac »

Hello :),
I recently upgraded my forum from 3.0.14 to 3.2.1 version and everything seems fine apart from that one thing : when I post using the submit_post function there is now these <t> and </t> tags around my titles.

For example :
<link deleted>

The code I'm using is the one from the wiki :

Code: Select all

function post_phpbb($message,$sujet,$forum_id,$topic_id = 0,$mode = 'post') {
	
	global $phpbb_root_path, $phpEx, $user, $db, $config, $cache, $template, $domaine;
	require_once($phpbb_root_path . "includes/functions_posting." . $phpEx); 	
	
	//$topic_type  :	One of the phpBB3 topic type constants. POST_NORMAL, POST_STICKY, POST_ANNOUNCE, POST_GLOBAL 
	$topic_type = POST_NORMAL;
	//$username : Username of the poster. Only valid for guest posters.
	$username = '';
	
	 // note that multibyte support is enabled here 
	$sujet = utf8_normalize_nfc(utf8_recode($sujet, 'utf-8'));
	$message  = utf8_normalize_nfc(utf8_recode($message, 'utf-8'));
	
	// variables to hold the parameters for submit_post
	$poll = $uid = $bitfield = $options = ''; 

	generate_text_for_storage($sujet, $uid, $bitfield, $options, false, false, false);
	generate_text_for_storage($message, $uid, $bitfield, $options, true, true, true);
	
	$data = array( 
		// General Posting Settings
		'forum_id' => $forum_id,    // The forum ID in which the post will be placed. (int)
		'topic_id' => $topic_id,    // Post a new topic or in an existing one? Set to 0 to create a new one, if not, specify your topic ID here instead.
		'icon_id' => false,    // The Icon ID in which the post will be displayed with on the viewforum, set to false for icon_id. (int)
				
		// Defining Post Options
		'enable_bbcode' => true,    // Enable BBcode in this post. (bool)
		'enable_smilies' => true,    // Enabe smilies in this post. (bool)
		'enable_urls' => true,    // Enable self-parsing URL links in this post. (bool)
		'enable_sig' => true,    // Enable the signature of the poster to be displayed in the post. (bool)

		// Message Body
		'message' => $message,        // Your text you wish to have submitted. It should pass through generate_text_for_storage() before this. (string)
		'message_md5' => md5($message),// The md5 hash of your message

		// Values from generate_text_for_storage()
		'bbcode_bitfield' => $bitfield,    // Value created from the generate_text_for_storage() function.
		'bbcode_uid' => $uid,        // Value created from the generate_text_for_storage() function.

		// Other Options
		'post_edit_locked' => 0,        // Disallow post editing? 1 = Yes, 0 = No
		'topic_title' => $sujet,    // Subject/Title of the topic. (string)

		// Email Notification Settings
		'notify_set' => false,        // (bool)
		'notify' => false,        // (bool)
		'post_time' => 0,        // Set a specific time, use 0 to let submit_post() take care of getting the proper time (int)
		'forum_name' => '',        // For identifying the name of the forum in a notification email. (string)

		// Indexing
		"enable_indexing" => true,        // Allow indexing the post? (bool)

		// 3.0.6
		"force_approved_state" => true, // Allow the post to be submitted without going into unapproved queue

		// 3.1-dev, overwrites force_approve_state
		"force_visibility" => true, // Allow the post to be submitted without going into unapproved queue, or make it be deleted
	);
	
submit_post ($mode,  $sujet,  $username,  $topic_type,  $poll,  $data);
I tried to find why on Google, in phpbb code but couldn't find why... If anyone has a idea it would be very appreciated :)

Many thanks !
Last edited by 20aubac on Fri Aug 25, 2017 2:24 pm, edited 1 time in total.
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: <t> and </t> tags appearing in title when I use submit_post function

Post by david63 »

Do you have the problem if you switch to the prosilver style?
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
20aubac
Registered User
Posts: 4
Joined: Tue Aug 22, 2017 2:51 pm
Location: Paris, France

Re: <t> and </t> tags appearing in title when I use submit_post function

Post by 20aubac »

Hello,
thanks for your answer. I switched to the prosilver style but it has the same effect...
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: <t> and </t> tags appearing in title when I use submit_post function

Post by david63 »

Where/how/why are you using the submit_post function?

The only place that I can see where those tags are used is in the new text formatting routines - the best person to answer that would be Joshy
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
20aubac
Registered User
Posts: 4
Joined: Tue Aug 22, 2017 2:51 pm
Location: Paris, France

Re: <t> and </t> tags appearing in title when I use submit_post function

Post by 20aubac »

Hello,
thanks for your answer.
I''m using the submit_post function to generate topics people can answer to. I'm using it in my own script and I'm using the code I pasted above.

I removed this line : generate_text_for_storage($sujet, $uid, $bitfield, $options, false, false, false); and I no longer have these weird tags.

I guess I'll keep it that way as I'm not sure this line was useful :?.
User avatar
Ger
Registered User
Posts: 2117
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100

Re: <t> and </t> tags appearing in title when I use submit_post function

Post by Ger »

The generate_text_for_storage() parses the submitted text, e.g. it processes bbcode, smilies, etc. Since phpBB 3.2 the new text_formatter is used, which adds XML tags like the <t> you see in your resulting topic_title.

However: for a topic title there isn't any BBcode or smiley but just plain text. So you don't need to run it trough generate_text_for_storage(). You should use that function only on "rich" text like post content, PM's, signatures, etc.
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:

-Don't PM me for support-
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: <t> and </t> tags appearing in title when I use submit_post function

Post by david63 »

If you are using generate_text_for_storage() to store your data then you need to use generate_text_for_display() when you want to display that data. That function should strip off those tags.
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
20aubac
Registered User
Posts: 4
Joined: Tue Aug 22, 2017 2:51 pm
Location: Paris, France

Re: <t> and </t> tags appearing in title when I use submit_post function

Post by 20aubac »

Ok, that is very clear now - many thanks to both of you for your help ! :)

Return to “phpBB Custom Coding”