How to set the value for bbcode_bitfield for message parser

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
durangod
Registered User
Posts: 709
Joined: Tue Nov 03, 2009 1:26 pm
Name: Dave

How to set the value for bbcode_bitfield for message parser

Post by durangod »

Hi, i been at it all day trying to get an old custom ext working again for a site i have.

I pretty much have it all updated but i cant seem to figure out how to set the value for the post table field named bbcode_bitfield, it cant be empty per the field settings so it has to have a value. It does not have a default value in the table either.

I have the message parser initialized like so

Code: Select all

$message_parser = new \parse_message();
When i look at the message parser object i see i have a value for bbcode_uid but bbcode_bitfield is empty.

I thought it might be in the $_POST value but its not there either.

Is there a special value that goes in that field or will any value work?

Thanks :)
User avatar
david63
Registered User
Posts: 18452
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: How to set the value for bbcode_bitfield for message parser

Post by david63 »

I may be wrong here but I believe that the bitfield is not used anymore so you can enter any value that you want
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
durangod
Registered User
Posts: 709
Joined: Tue Nov 03, 2009 1:26 pm
Name: Dave

Re: How to set the value for bbcode_bitfield for message parser

Post by durangod »

Well i guess i dont need it afterall. Im not sure what happened but after i finished the post array and posted it the requirement went away and no more error that it cant be empty. Sort of strange... but its working..

The only issue i have now is that the post is not parsing the html.. So when i post

Code: Select all

[b] something [/b] 
dynamically its not parsing the bold bbcode or any other html for that matter.

Now when i edit the post and save it, they yes now it works, but how to get it to parse the bbcode and html in a dynamic post. mmmmmm i dont know...

In other words i need to write the post text to the post table so that it parses the html and bbcode. What i have done is i have edited one post i did so that it is saved as it should be to parse it. Then i created another dynamic post and ill compare how the saved table values and see what the difference is... :) i hope that works.... i know that the script adds some wrappers to the post text but not sure what all it does yet.

I wish there was a function i could call just to do it for me but i have not found it yet.

I thought thats what the parser did, but i guess not... Well so far in comparing the two values, looks like the script wraps the whole text value in an

Code: Select all

<r>  
post text value 
</r>
and then bolds are like this

Code: Select all

<B><s>[b]</s>Comments:<e>[/b]</e></B>
and i wont even begin to try to explain user name url lol it has all kinds of stuff in it.. well might be the same <s>, <e> that kinds of stuff.

Well if i cant find a function to do this ill have to just set it up manually in my php file to put the tag codes in where they go.
User avatar
3Di
Former Team Member
Posts: 16039
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: How to set the value for bbcode_bitfield for message parser

Post by 3Di »

I don't know your code but usually when you store in the DB the text with the new parser you should do something like

'post_text' => $message_parser->parse(htmlspecialchars_decode($post_text, ENT_QUOTES)),

That's what I use for comments in a video blog ext atm, then the s9e's Utils Render object to display the stored text.

Anyway, without the whole code to explore I can't be of any further help.
To request support for our extensions you can also contact me here: phpBB Studio

Please PM me only to request paid works. Thx. Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
🚀 Looking for a specific feature or alternative option? We will rock you! 🚀
User avatar
durangod
Registered User
Posts: 709
Joined: Tue Nov 03, 2009 1:26 pm
Name: Dave

Re: How to set the value for bbcode_bitfield for message parser

Post by durangod »

By the way thanks david63 i was just thinking about ya earlier today as i have some of your ext to install tomorrow... thanks for the hard work :)

Thanks 3Di yeah was able to locate some of the text renderers in the vendor library but have not found how to use them yet so thanks for the tip..

Here is what i have and what i am doing. Years ago like in 2016 i got permission from RMcGirr83 to modify his application form extension and use it for a "post your RIG" extension. Basically it allows users to post the computer specs they have. I have updated quite a bit of it to get it working again. Im not sure what you need but here is the controller file and the lang file. I have also included a picture of the form they fill out and the table field data as i store it and how the system stores it, for which im trying to duplicate.

By the way if anyone would like to take this and just make it a valid extension im sure RMcGirr83 wont mind, ask him anyway ya know... but its just about ready for submission im sure so if he says yes then by all means ill be glad to send you what i have and you just got for it.. Its a small little extension not much to it at all.

first here is the form they fill out
rig_form.jpg
Here is how it is posted when i submit the form. Sorry for the junk code i just put junk text in the inputs.

Code: Select all

User [url=https://example.com/forum/memberlist.php?mode=viewprofile&u=2][color=#AA0000]admindave[/color][/url], has posted information using the Show Your RIG form.


[b]Operating System[/b]: adada

[b]Motherboard:[/b] fsfsdfd

[b]CPU:[/b] sdfsdf

[b]Type of Cooling:[/b] sdfsdf

[b]RAM (memory):[/b] sdfsdf

[b]Graphics Card:[/b] sdfsd

[b]Power Supply:[/b] sdfsdf

[b]Solid State Drive (SSD):[/b] sdfsdf

[b]Hard Drive (HDD):[/b] sdfsdf

[b]External Storage:[/b] sdfsdf

[b]Monitor 1:[/b] sdfsf

[b]Monitor 2:[/b] sdfsdf

[b]Monitor 3:[/b] sdfsd

[b]Mouse:[/b] sdfsd

[b]Keyboard:[/b] sdfsd

[b]Comments:[/b]

So once i edit that post the system corrects it.
Now here is the data as the system saves it which allows for the bbcode and html parsing..
This is directly from the table field - my domain removed

This is what i am trying to duplicate.

Code: Select all

after edit 

<r>User <URL url="https://example.com/forum/memberlist.php?mode=viewprofile&amp;u=2"><s>[url=https://example.com/forum/memberlist.php?mode=viewprofile&amp;u=2]</s><COLOR color="#AA0000"><s>[color=#AA0000]</s>admindave<e>[/color]</e></COLOR><e>[/url]</e></URL>, has posted information using the Show Your RIG form.<br/>
<br/>
<br/>
                                                                              <B><s>[b]</s>Operating System<e>[/b]</e></B>: os<br/>
<br/>
                                                                              <B><s>[b]</s>Motherboard:<e>[/b]</e></B> mb<br/>
<br/>
                                                                              <B><s>[b]</s>CPU:<e>[/b]</e></B> cpu<br/>
<br/>
                                                                              <B><s>[b]</s>Type of Cooling:<e>[/b]</e></B> cooking<br/>
<br/>
                                                                              <B><s>[b]</s>RAM (memory):<e>[/b]</e></B> ram<br/>
<br/>
                                                                              <B><s>[b]</s>Graphics Card:<e>[/b]</e></B> gra<br/>
<br/>
                                                                              <B><s>[b]</s>Power Supply:<e>[/b]</e></B> jpow<br/>
<br/>
                                                                              <B><s>[b]</s>Solid State Drive (SSD):<e>[/b]</e></B> ssd<br/>
<br/>
                                                                              <B><s>[b]</s>Hard Drive (HDD):<e>[/b]</e></B> hhd<br/>
<br/>
                                                                              <B><s>[b]</s>External Storage:<e>[/b]</e></B> ext<br/>
<br/>
                                                                              <B><s>[b]</s>Monitor 1:<e>[/b]</e></B> m1<br/>
<br/>
                                                                              <B><s>[b]</s>Monitor 2:<e>[/b]</e></B> m2<br/>
<br/>
                                                                              <B><s>[b]</s>Monitor 3:<e>[/b]</e></B> m3<br/>
<br/>
                                                                              <B><s>[b]</s>Mouse:<e>[/b]</e></B> mou<br/>
<br/>
                                                                              <B><s>[b]</s>Keyboard:<e>[/b]</e></B> kb <br/>
<br/>
                                                                              <B><s>[b]</s>Comments:<e>[/b]</e></B></r>
And here is the controller file

main_controller.php
(11.43 KiB) Downloaded 5 times
then here is the lang file - i guess i could just put the system codes in the lang file right... ? I mean wrap my text with r and stuff..
showyourrigform.php
(6.2 KiB) Downloaded 6 times

if you need anything else please let me know... ill try your suggestion :)
User avatar
3Di
Former Team Member
Posts: 16039
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: How to set the value for bbcode_bitfield for message parser

Post by 3Di »

I suggest you to use a topic template extension: viewtopic.php?t=2468891

Or a reply template one: viewtopic.php?f=456&t=2468936
To request support for our extensions you can also contact me here: phpBB Studio

Please PM me only to request paid works. Thx. Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
🚀 Looking for a specific feature or alternative option? We will rock you! 🚀
User avatar
durangod
Registered User
Posts: 709
Joined: Tue Nov 03, 2009 1:26 pm
Name: Dave

Re: How to set the value for bbcode_bitfield for message parser

Post by durangod »

OK thanks for the links :) ill have a look see..
User avatar
durangod
Registered User
Posts: 709
Joined: Tue Nov 03, 2009 1:26 pm
Name: Dave

Re: How to set the value for bbcode_bitfield for message parser

Post by durangod »

whoohooo i got it....

I just had to play with the parse attributes in the message parser function...


i had this function

Code: Select all

generate_text_for_storage()
in my original file but it stopped working so i stopped using it rather than check the function to see what it was doing, my bad i know, lazy lazy... :(

But i could not use it anyway because i needed to tweak the output a bit more so i just did it without the function.

My lang file is still the same so no changes there from my previous post. I just did the code like this and its working.

new code

Code: Select all

$message_parser = new \parse_message($apply_post);
			 
			 //parser attributes 
			 
			 /* allow_bbcode
			    allow_urls 
			    allow_smilies 
			    allow_img_bbcode
			    allow_flash_bbcode 
			    allow_quote_bbcode 
			    allow_url_bbcode 			   
			    $mode
			    */
			 $message_parser->parse(true, true, false, false, false, false, true, 'post');
			 $textready = $message_parser->message;
			 $message_md5 = md5($message_parser->message);
and whamo bamo ! perfect :)

I did play around with adding some html and htmlspecialchars to the message before the function but it just saved the raw data in the post and didnt parse it. So i went back to the bbcodes and with the new coding above it looks great...

for those of you that are interested in some of these functions they are in the includes/functions_content.php file .

Thanks all :)
Post Reply

Return to “Extension Writers Discussion”

cron