[3.3][BETA] Post Form Templates

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Ideas Centre
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
User avatar
Toxyy
Registered User
Posts: 964
Joined: Mon Oct 24, 2016 3:22 pm
Location: Namek

[3.3][BETA] Post Form Templates

Post by Toxyy »

Extension Name: Post Form Templates
Author: toxyy
Special Thanks To: ToddSmith and Edwin (sponsoring and testing)
Extension Description: Make, manage, and use forms in posts within phpBB 3.3
Extension Version: 0.0.2
    Requirements:
    • **phpBB 3.3.10-RC1
    • PHP 7+
    ** - I have not tested with earlier versions, technically the latest event I use was added in 3.1.9, so it might work on even earlier versions. Try it out! Just keep in mind the core fix below, which will only be pushed in 3.3. Because of the bug I had to change this from [3.2][3.3] to just [3.3].
    There is a bug in phpBB core that prevents this extension from working properly. The ticket is defined below.
    to fix this yourself, open /forumroot/phpbb/request/type_cast_helper.php

    Find
    !preg_match('/^./u', $result)

    Replace with
    !preg_match('//u', $result)
    Issues as of phpBB 3.3.10:
    • (core bug) fix multibyte preg_match in type_cast_helper.php, manual fix defined above (ticket 17188)
    There is a "fix" for this extension itself to only allow English characters for no required core changes, but I have reports that even apostrophes get converted to question marks. If anyone wants this "fix", they can ask and I'll respond. As of now I would just change the core code as defined above. I believe the current code shouldn't require the "fix" and should work as is with normal English characters.

    Extension Download: https://github.com/toxyy/postformtempla ... -0.0.2.zip
    Github repository: https://github.com/toxyy/postformtemplates
    Languages: en
    Templates: all
    Features:
    • Categories, templates, entries, and subentries
    • Max depth of three, so Category -> Category -> Form Template is supported
    • Just about every way you can think to copy settings or entries is there
    • Multiple entry types (text entry, radio, checkbox, dropdown, and notes)
    • Subentries as well to give your forms more flavor
    • Newlines before or after entry tag/matches, so you can better format how the code is added to a post
    • Full custom permission system for users and groups
    • Header images, image cycle settings, and image management system
    • Lots more!
    Installation/notes:
    • Create `toxyy/postformtemplates` in the `ext` directory.
    • Download and unpack the repository into `ext/toxyy/postformtemplates`
    • Enable `Post Form Templates` in the ACP at `Customise -> Manage extensions`.
    Most bugs have been found and eliminated. The only bug that may exist, is that due to some way of copying templates and/or entries, the left/right IDs for entries may get corrupted. Checking Todd's database, I saw some entries have the same left/right IDs for one template. I was unable to recreate this bug myself no matter what I did, and was perhaps fixed by me fixing some other things. Still, be aware of that, but as far as I can tell, I can't recreate it at all. Besides that, it's been tested well and should be bug free.

    The examples and descriptions by each setting should be pretty straightforward but I will offer support to clarify anything within this topic.

    The main thing is that Entry Matches MUST have {TEXT} in them to be replaced with user entries for text replace, checkbox, radio, and dropdown. If no {TEXT} is there, then only what is in the entry match will be replaced, making them effectively useless.

    Help line text is just text that appears when you hover over a question, it changes the cursor to correspond and your note will appear.

    Also, any text in a postbox will be reset when selecting a template due to how I made the dropdown. This also applies to subjects when making a new topic. Will not fix this.

    Template descriptions only show up in the ACP, I was going to make them appear on the frontend but never got around to it and don't feel the need now.

    Delimiters for checkboxes are a , followed by a newline. I did not make this customizable at this time.

    ** In order for templates to be displayed, you need to add template permissions. On installation, there are no permissions initially set up. These are in the extensions tab as shown in the 6th and 7th picture. Setting view/use to true for registered users should be enough for the whole form to be able to use them.

    Screenshots:
    This is just a minor preview. I could add many more pictures but this is already a bit much. It's a very big extension!

    In a post:
    Image

    What it looks like when you add, and then preview:
    Image

    Form settings in the ACP:
    Image

    Entry settings in the ACP:
    Image

    Main image management page in ACP (I just used smiles as a quick example, use whatever images you want!)
    Image

    Main permissions page (as you're used to):
    Image

    Setting permissions page (also as you're used to):
    Image
    Last edited by Toxyy on Mon Oct 09, 2023 7:03 pm, edited 11 times in total.
    I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

    Some of my extensions:
    [3.3][BETA] Post Form Templates || [3.3][BETA] Anonymous Posts || [3.2][3.3][BETA] ACP Merge Child Forums || [3.2][BETA] Sticky Ad || [3.2][DEV] User Delete Topics || [3.3][DEV] Moderate While Searching || [3.3][RC] Short Number Twig Extension
    User avatar
    Toxyy
    Registered User
    Posts: 964
    Joined: Mon Oct 24, 2016 3:22 pm
    Location: Namek

    Re: [3.2][3.3][BETA] Post Form Templates

    Post by Toxyy »

    Reserved
    I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

    Some of my extensions:
    [3.3][BETA] Post Form Templates || [3.3][BETA] Anonymous Posts || [3.2][3.3][BETA] ACP Merge Child Forums || [3.2][BETA] Sticky Ad || [3.2][DEV] User Delete Topics || [3.3][DEV] Moderate While Searching || [3.3][RC] Short Number Twig Extension
    User avatar
    stone23
    Registered User
    Posts: 177
    Joined: Sat Nov 02, 2019 4:44 pm
    Location: France

    Re: [3.3][BETA] Post Form Templates

    Post by stone23 »

    Hello.
    I noticed an untranslated language key in the file: toxyy/postformtemplates/language/en/permissions_templates.php
    The language key is: ACL_A_PFT_IMAGES ;)

    EDIT : And I can't display a form anywhere in the forum...
    encreuse.net
    Forum version : 3.3.11
    php version : 8.2.10

    Excuse my English, I'm French...
    User avatar
    stone23
    Registered User
    Posts: 177
    Joined: Sat Nov 02, 2019 4:44 pm
    Location: France

    Re: [3.3][BETA] Post Form Templates

    Post by stone23 »

    Hello,
    For the moment, I am not installing this extension on a production forum, apparently there are few language key problems and no forms are displayed.
    Didn't you plan an extension that was too complex?
    We should simplify between the model categories and only create form models to simplify and lighten the database...
    encreuse.net
    Forum version : 3.3.11
    php version : 8.2.10

    Excuse my English, I'm French...
    User avatar
    Toxyy
    Registered User
    Posts: 964
    Joined: Mon Oct 24, 2016 3:22 pm
    Location: Namek

    Re: [3.3][BETA] Post Form Templates

    Post by Toxyy »

    stone23 wrote: Mon Sep 04, 2023 8:34 pm Hello,
    For the moment, I am not installing this extension on a production forum, apparently there are few language key problems and no forms are displayed.
    Didn't you plan an extension that was too complex?
    We should simplify between the model categories and only create form models to simplify and lighten the database...
    In order for forms to be displayed, you need to set template permissions. By default there are no permissions set so thee forms wont initially appear after installation. Go into the extension tab and go to template permissions, and you can set which groups have what permissions (view or use). Setting the permissions for registered users should be enough. These permissions and where they are located are shown in the 6th and 7th pictures of the OP.

    Also when making template entries, make sure "Display on posting page" is checked, otherwise it won't be visible.

    One category is mandatory, once that is selected the form list will pop up. It's as complex as my client needed it to be. It's about as complex as forums and categories are in base phpbb, besides a lot of different ways to copy various settings, aside from permissions not being initially set after install.

    It wouldn't "lighten" the database doing it another way, aside from removing one row, which is an insignificant amount of data.

    The language key problems only effect administrative group permissions and a couple log entries for copying entries, those will be fixed, thanks for pointing out the missing key. That's all deep in the ACP though and won't affect anything on the main form, only if you're going deep in your logs or changing administrative group permissions for a secondary admin group that you want to not allow to change various extension settings - I just added those just in case, I hadn't ever needed to go to that page ever myself.

    EDIT: Updated extension to v0.0.2 to account for missing log entries. Included is the one you pointed out, along with a number of others for deleting. Also edited some other log entries. Some unused ones have also been added, in case of a future update, since they are defined in the code already. There shouldn't be anything missing from the language files now.
    I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

    Some of my extensions:
    [3.3][BETA] Post Form Templates || [3.3][BETA] Anonymous Posts || [3.2][3.3][BETA] ACP Merge Child Forums || [3.2][BETA] Sticky Ad || [3.2][DEV] User Delete Topics || [3.3][DEV] Moderate While Searching || [3.3][RC] Short Number Twig Extension
    STK
    Registered User
    Posts: 21
    Joined: Mon Aug 26, 2019 2:45 pm

    Re: [3.3][BETA] Post Form Templates

    Post by STK »

    Hi!

    Very interesting extension!
    How will it behave, when a post, where a form was used, is edited? Will the form show up again with choices already made?

    Is there a way to make the posting textarea uneditable when a form is added to the post?

    Thanks!
    STK
    User avatar
    stone23
    Registered User
    Posts: 177
    Joined: Sat Nov 02, 2019 4:44 pm
    Location: France

    Re: [3.3][BETA] Post Form Templates

    Post by stone23 »

    Toxyy wrote: Mon Sep 04, 2023 11:04 pm EDIT: Updated extension to v0.0.2 to account for missing log entries. Included is the one you pointed out, along with a number of others for deleting. Also edited some other log entries. Some unused ones have also been added, in case of a future update, since they are defined in the code already. There shouldn't be anything missing from the language files now.
    Hello,
    Thank you for all your details.
    This extension is really interesting and I will take a close interest in its development. :thumbsup:
    encreuse.net
    Forum version : 3.3.11
    php version : 8.2.10

    Excuse my English, I'm French...
    User avatar
    Toxyy
    Registered User
    Posts: 964
    Joined: Mon Oct 24, 2016 3:22 pm
    Location: Namek

    Re: [3.3][BETA] Post Form Templates

    Post by Toxyy »

    STK wrote: Tue Sep 05, 2023 9:24 am How will it behave, when a post, where a form was used, is edited? Will the form show up again with choices already made?

    Is there a way to make the posting textarea uneditable when a form is added to the post?
    No, if you edit an already submitted post, it will not populate the form itself. It is theoretically possible for me to make it able to do that, but it would require a LOT of extra work that I didn't bother to do. If you edit a post, then it will be like editing any other post, the form will not be populated from its contents.

    You can actually hide the posting textarea if you want. Under the extensions general settings, there are two settings: "Add post template button" and "Hide postfields". The Post Template button adds a submit button next to the "Add to post" button, which allows the form to be directly submitted as a post. "Hide postfields" hides the entire post area (including the submit/preview/etc buttons), and should only be used if you've also added the "Add post template" button as well. Currently I made these global settings. Postfields will only be hidden if templates are displayed within that forum. Here's what the settings look like, and what the posting page looks like as a result.

    General settings:
    Image

    Posting page (only affects posting pages with templates displayed):
    Image
    stone23 wrote: Tue Sep 05, 2023 11:43 am Thank you for all your details.
    This extension is really interesting and I will take a close interest in its development. :thumbsup:
    Thanks! Sorry for the unclear instructions in the OP. The only thing really needed for getting it to work out of the box was to add template permissions, hope that's clearer now.
    I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

    Some of my extensions:
    [3.3][BETA] Post Form Templates || [3.3][BETA] Anonymous Posts || [3.2][3.3][BETA] ACP Merge Child Forums || [3.2][BETA] Sticky Ad || [3.2][DEV] User Delete Topics || [3.3][DEV] Moderate While Searching || [3.3][RC] Short Number Twig Extension
    User avatar
    stone23
    Registered User
    Posts: 177
    Joined: Sat Nov 02, 2019 4:44 pm
    Location: France

    Re: [3.3][BETA] Post Form Templates

    Post by stone23 »

    I think I understand how the extension works.
    However, would it be possible to include in a language these values in this file parameters: toxyy/postformtemplates/migrations/v_0_0_1.php

    Code: Select all

    	public function initial_table_data()
    	{
    		$sql = 'INSERT INTO ' . $this->table_prefix . 'pft_templates' . " (template_name, template_desc, left_id, right_id, parent_id, template_type, template_images, template_desc_uid, template_parents) VALUES ('Your first main template category', '', 1, 6, 0, 0, '', '', '')";
    		$this->db->sql_query($sql);
    		$sql = 'INSERT INTO ' . $this->table_prefix . 'pft_templates' . " (template_name, template_desc, left_id, right_id, parent_id, template_type, template_images, template_desc_uid, template_parents) VALUES ('Your first template category', '', 2, 5, 1, 0, '', '', '')";
    		$this->db->sql_query($sql);
    		$sql = 'INSERT INTO ' . $this->table_prefix . 'pft_templates' . " (template_name, template_desc, left_id, right_id, parent_id, template_type, template_images, template_desc_uid, template_parents) VALUES ('Your first template', 'Your first post form template', 3, 4, 2, 1, '', '', '')";
    		$this->db->sql_query($sql);
    		$sql = 'INSERT INTO ' . $this->table_prefix . 'pft_template_entries' . " (entry_tag, entry_match, entry_type_match, left_id, right_id, template_id, parent_id, entry_rows, display_on_posting) VALUES ('<r><I><s>[i]</s>What is your favorite forum software?<e>[/i]</e></I></r>', '[b]{TEXT}[/b]', 'a:1:{i:0;s:0:\"\";}', 1, 2, 3, 0, 2, 1)";
    		$this->db->sql_query($sql);
    	}
    encreuse.net
    Forum version : 3.3.11
    php version : 8.2.10

    Excuse my English, I'm French...
    User avatar
    stone23
    Registered User
    Posts: 177
    Joined: Sat Nov 02, 2019 4:44 pm
    Location: France

    Re: [3.3][BETA] Post Form Templates

    Post by stone23 »

    Hello,
    I also noticed a small conflict with the extension: Quick Title Edition which prevents the display of topic attributes in forum permissions...
    ScreenShot098.jpg
    You do not have the required permissions to view the files attached to this post.
    encreuse.net
    Forum version : 3.3.11
    php version : 8.2.10

    Excuse my English, I'm French...
    User avatar
    Toxyy
    Registered User
    Posts: 964
    Joined: Mon Oct 24, 2016 3:22 pm
    Location: Namek

    Re: [3.3][BETA] Post Form Templates

    Post by Toxyy »

    stone23 wrote: Sat Sep 09, 2023 7:27 pm Hello,
    I also noticed a small conflict with the extension: Quick Title Edition which prevents the display of topic attributes in forum permissions...
    EDIT: thanks to rxu, found and fixed it. A controller dependency in my main listener had the acl.permissions dependency itself, so it was causing some kind of circular badness. Removed the dependency from the main listener and made it to a container call where it's needed instead, that fixed it for the acp issues. Will push that in the next update.
    I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

    Some of my extensions:
    [3.3][BETA] Post Form Templates || [3.3][BETA] Anonymous Posts || [3.2][3.3][BETA] ACP Merge Child Forums || [3.2][BETA] Sticky Ad || [3.2][DEV] User Delete Topics || [3.3][DEV] Moderate While Searching || [3.3][RC] Short Number Twig Extension
    User avatar
    stone23
    Registered User
    Posts: 177
    Joined: Sat Nov 02, 2019 4:44 pm
    Location: France

    Re: [3.3][BETA] Post Form Templates

    Post by stone23 »

    Thank you so much.
    So the fix will be in the next version?
    When do you plan to release it?
    encreuse.net
    Forum version : 3.3.11
    php version : 8.2.10

    Excuse my English, I'm French...
    User avatar
    warmweer
    Jr. Extension Validator
    Posts: 11660
    Joined: Fri Jul 04, 2003 6:34 am
    Location: Van Allen Bel ... gium

    Re: [3.3][BETA] Post Form Templates

    Post by warmweer »

    stone23 wrote: Fri Sep 15, 2023 5:26 pm ...
    When do you plan to release it?
    Most probably in the future. :mrgreen: (but you can follow the development on github).

    Just realise that it's still in beta stage and you shouldn't really use it on a live board as yet.
    Spelling is freeware, which means you can use it for free.
    On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


    Time flies like an arrow, but fruit flies like a banana.
    User avatar
    Toxyy
    Registered User
    Posts: 964
    Joined: Mon Oct 24, 2016 3:22 pm
    Location: Namek

    Re: [3.3][BETA] Post Form Templates

    Post by Toxyy »

    stone23 wrote: Fri Sep 15, 2023 5:26 pm Thank you so much.
    So the fix will be in the next version?
    When do you plan to release it?
    It's already solved on my end, I just have yet to push the update. I've been made aware of a few other issues that I want to try to tackle before I do so.. though I suppose nothing is stopping me from pushing what I have now, really. Done, those are now pushed to the github master branch. Next version won't be released until I've wrestled enough with the other issues I'm working on.
    warmweer wrote: Fri Sep 15, 2023 8:01 pm Most probably in the future. :mrgreen: (but you can follow the development on github).

    Just realise that it's still in beta stage and you shouldn't really use it on a live board as yet.
    This is true, but I've never really released any of my extensions to the CDB (even though I really, really should send a few of them in for review as they're ready, they're not really in beta anymore yet their tag still says it...)

    A client sponsored extension for their forum this so I have a great debugging source to find bugs much more quickly than I'd be able to on my own, so that helps a lot :D
    I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

    Some of my extensions:
    [3.3][BETA] Post Form Templates || [3.3][BETA] Anonymous Posts || [3.2][3.3][BETA] ACP Merge Child Forums || [3.2][BETA] Sticky Ad || [3.2][DEV] User Delete Topics || [3.3][DEV] Moderate While Searching || [3.3][RC] Short Number Twig Extension
    User avatar
    stone23
    Registered User
    Posts: 177
    Joined: Sat Nov 02, 2019 4:44 pm
    Location: France

    Re: [3.3][BETA] Post Form Templates

    Post by stone23 »

    warmweer wrote: Fri Sep 15, 2023 8:01 pm Most probably in the future. :mrgreen: (but you can follow the development on github).

    Just realise that it's still in beta stage and you shouldn't really use it on a live board as yet.
    This is exactly what I do ;)
    Toxyy wrote: Sat Sep 16, 2023 9:06 am It's already solved on my end, I just have yet to push the update. I've been made aware of a few other issues that I want to try to tackle before I do so.. though I suppose nothing is stopping me from pushing what I have now, really. Done, those are now pushed to the github master branch. Next version won't be released until I've wrestled enough with the other issues I'm working on.
    Thank you for this informations.
    encreuse.net
    Forum version : 3.3.11
    php version : 8.2.10

    Excuse my English, I'm French...

    Return to “Extensions in Development”