Page 1 of 1

How to set the value for bbcode_bitfield for message parser

Posted: Sun Mar 01, 2020 2:20 am
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 :)

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

Posted: Sun Mar 01, 2020 3:44 am
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

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

Posted: Sun Mar 01, 2020 3:48 am
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

post text value 
and then bolds are like this

Code: Select all

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.

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

Posted: Sun Mar 01, 2020 4:36 am
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.

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

Posted: Sun Mar 01, 2020 5:19 am
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
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=][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


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=";u=2"><s>[url=;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/>
                                                                              <B><s>[b]</s>Operating System<e>[/b]</e></B>: os<br/>
                                                                              <B><s>[b]</s>Motherboard:<e>[/b]</e></B> mb<br/>
                                                                              <B><s>[b]</s>CPU:<e>[/b]</e></B> cpu<br/>
                                                                              <B><s>[b]</s>Type of Cooling:<e>[/b]</e></B> cooking<br/>
                                                                              <B><s>[b]</s>RAM (memory):<e>[/b]</e></B> ram<br/>
                                                                              <B><s>[b]</s>Graphics Card:<e>[/b]</e></B> gra<br/>
                                                                              <B><s>[b]</s>Power Supply:<e>[/b]</e></B> jpow<br/>
                                                                              <B><s>[b]</s>Solid State Drive (SSD):<e>[/b]</e></B> ssd<br/>
                                                                              <B><s>[b]</s>Hard Drive (HDD):<e>[/b]</e></B> hhd<br/>
                                                                              <B><s>[b]</s>External Storage:<e>[/b]</e></B> ext<br/>
                                                                              <B><s>[b]</s>Monitor 1:<e>[/b]</e></B> m1<br/>
                                                                              <B><s>[b]</s>Monitor 2:<e>[/b]</e></B> m2<br/>
                                                                              <B><s>[b]</s>Monitor 3:<e>[/b]</e></B> m3<br/>
                                                                              <B><s>[b]</s>Mouse:<e>[/b]</e></B> mou<br/>
                                                                              <B><s>[b]</s>Keyboard:<e>[/b]</e></B> kb <br/>
And here is the controller file

(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..
(6.2 KiB) Downloaded 7 times

if you need anything else please let me know... ill try your suggestion :)

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

Posted: Sun Mar 01, 2020 5:52 am
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

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

Posted: Sun Mar 01, 2020 5:57 am
by durangod
OK thanks for the links :) ill have a look see..

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

Posted: Sun Mar 01, 2020 1:03 pm
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

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
			 $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 :)