• Resolved John Nicholas

    (@john-nicholas)


    Hello Kreg,

    Is it possible to add two additional “Display Opt-In Check Boxs”?

    It would be even better if it could be “replaced” with a drop down with three choices.

    Basically what I’m trying to do is to offer the petition voter to choose what category they belong in. For this particular instance the three options would be;

    Horse Industry Professional
    Horse Racing Fan
    Horse Racing Gambler

    I’d appreciate any guidance you could offer.

    Thank you,
    John

    https://www.ads-software.com/extend/plugins/speakup-email-petitions/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Kreg Wallace

    (@kreg)

    Hi John,

    There aren’t any options for adding the filed options you mentioned to the petition form. You could try hacking a solution together for yourself, but it would be a pretty involved process.

    Thread Starter John Nicholas

    (@john-nicholas)

    Kreg,

    Actually I thought that they only way to make this change was to modify the code. I suppose the question I’m asking is which files do I need to modify in order to do this?

    I’m willing to hack a solution on my own, just appreciate a little guidance.

    Thank you so much. This is a fabulous plug-in.

    John

    Plugin Author Kreg Wallace

    (@kreg)

    John,

    Well, you would first need to add some new fields to the “wp_dk_speakup_signatures” database table to hold the new data.

    Then you can add your new form fields to the HTML in emailpetition.php

    The form data is submitted via JavaScript by public.js. You can add your new field collection info there just following the pattern of the way other form fields are handled in that file.

    That JavaScript submits to ajax.php. It’s possible you wont need to change this file. Ajax.php implements class.signature.php to save and retrieve information from the database. You will definitely need to edit the create() method in that file to save data to the database. Just follow the examples already there and add your fields to the list.

    That should get the data saved. Now to retrieve the stored data to your CSV file, you should do a little editing on csv.php

    Hope that helps

    Having just implemented the above have to say those tips certainly made the job easier. One thing I would add is that widget.php and widget.js also need similar changes if the petition is to be used in widget form.

    Live example : diaspora.ie- democracy at work

    Could probably make the ‘no checkboxes selected’ error message a bit slicker, but it works ??

    Hi MickR,
    is it possible to post your changes? Your example is exactly what I need too.

    Thanks,
    Daniel.

    Hi Daniel,

    First off, I modified V2.1 of the plugin and Kreg released V2.2 a few days later. I’d imagine the relevant parts of the code haven’t changed too much, but if you’re using the latest version you’ll have to work through it and try and match up where the changes should be applied.

    Also worth noting that any subsequent update of the plugin would probably need the changes reapplied, as they’d get overwritten by the ‘standard’ code.

    Anyway here’s what I did:

    1. Using phpMyAdmin, inserted 3 new fields (named as follows) to the ‘wp_dk_speakup_signatures’ table:
    General
    Presidential
    Referendum

    All configured as follows:
    Type: varchar(1)
    Collation: utf8_general_ci
    (I positioned them just after ‘custom_message’ field).

    2. Modified emailpetition.php and public.js which manages petition when used in page or post content.

    3. Modified widget.php and widget.js which manages petition when used as a widget.

    4. Modified class.signature.php which is used by both of the above to write to the database table.

    Here’s some links to copies of the code as modified:

    emailpetition.php
    public.js
    widget.php
    widget.js
    class.signature.php

    Code should you appear when you click on each of those. Copy and paste into an editor (eg:PSPad) should make it easier to read. I’ve commented in where the hacks are.

    Haven’t got round to modding csv.php yet, but browsing the database table via phpMyAdmin shows that the updates are going in just fine.

    hope that helps,

    Mick.

    Wow, thanks for this! I’ll try it.

    I cut and pasted the code on each each but nothing changed.

    emailpetition.php
    public.js
    widget.php
    widget.js
    class.signature.php

    What Am I doing wrong? Tnx

    Hi TL,

    Two possible thoughts…

    1. Kreg has since updated the plugin after I applied the hack and I haven’t looked at the changes to his code since v2.1. It may be that you need to work through it to check that the changes still fit with the latest structure.

    2. Also, did you change the database structure to capture the user choices: Using phpMyAdmin, I inserted n x new fields to the ‘wp_dk_speakup_signatures’ table.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: SpeakUp! Email Petitions] Aadditional Display opt-in checkboxes or Drop Down’ is closed to new replies.