gebeer

Adding custom field to comments form

Recommended Posts

Hello,

I need to add a checkbox to the  comments form to make it GDPR compliant and I guess I'm not the only one...

Doing a search and looking at the FieldTypeComments module file it seems that the only way to add custom fields to the form is by copying the module to  site/modules and apply the changes there.

I am just wondering why the comment form is not driven by the PW form API and also why none of the methods in that module are hookable?

Would be much appreciated if you could share your approaches on handling this.  

Share this post


Link to post
Share on other sites
On 6/13/2018 at 10:49 PM, gebeer said:

Doing a search and looking at the FieldTypeComments module file it seems that the only way to add custom fields to the form is by copying the module to  site/modules and apply the changes there.

Yep, that's the only way I know of to customise the comments module.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By mcwhitey
      Hi,
      I'm rather new to PW. (And loving it) I have installed PW3 with the FrontendUser module. I tried the standard simple script and that worked. But now I want to add some custom fields that are in my user templates. I have created a page-field called userparent where you can choose another user. I don't know if this is relevant.
      The answer is probably on this page: https://bitbucket.org/pwFoo/frontenduser/wiki/Code snippets / Examples
      "Add custom form field with hook after field processed
      Add an additional form field to the registration form with field processing (add value to user object) inside your template file."
      But I'm having difficulty implementing the script due to my lack of knowledge.  I keep getting internal server errors. How and where do I define the custom fields I want to make available in the form? I'm not extremely good at PHP but know more than the basic stuff.
      I hope someone can help me out.
    • By Doc
      Hi,
      I'm building my homepage, it contains ~60 custom fields (lines or words I define & translate in the admin in different languages).
      The homepage is dynamic and my users are logged.
      I'm trying to avoid many MySQL queries to retrieve the fields I've setup in the admin, I think I can do better than 60 different queries to display that content on the home.
      Regarding performance, will markup cache a good approach here ?
      I understand it makes sense when you have a scrolldown menu which is built within a loop for example but is it still good if I cache 60x a word or a group of words in my code ?
      Another idea I had was to dynamically determine which language is used by the user and load a language file which contains the translated text (uk.inc.php) and so on... (less elegant I think, but I'll use that anyway for dynamic expressions such as "you have %nb items in your cart").
      Thanks
    • By muzzer
      I've come to a situation which I have not come across previously and am wondering how best to solve.
      I have a template with a heap of "questions" which usually have a yes/no answer, but may also need further detail. So a textfield with a simple yes, no, or other text such are "sometimes" would cover it.
      But I'd also like a couple of additional checkboxes to accompany each of these fields as a toggle for display; eg
      For example:
      do you have children? yes, Display this field (yes), Include field in emails (no)
      do you have pets? (yes, 2 rabbits) Display this field (no), Include field in emails (yes)
      do you have rabies? (sometimes), Display this field (yes), Include field in emails (yes)
        ...etc, you get the picture. I have probably 50-80 fields like the above.   How would I go about doing this? Is this what is referred to in Processwire as a custom fieldtype? Are there any really basic tutorials or examples for something like this?
       
    • By nexflo
      One thing i cant seem to find is how to add custom blocks to pages.
      I.e. I've got a template which includes several content fields - headline, content1, content2 but i also want to add another teaser... it would be great adding "new field" -> teaser into pages where i want to add them to.
      is something like this possible,without creating a new template for everypage?
      The ACF plugin for wordpress includes options like this and its very convenient.
      http://www.advancedcustomfields.com/add-ons/flexible-content-field/