Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author DBAR Productions

    (@dbar-productions)

    Hi Sutter,

    My guess is that you are just missing a few additional spots in the code that you need to modify to make this work. I’ve actually been working on an update where I added some new fields, so I just went through that process again.

    I think you are getting an error when it’s trying to add the signup to the database, but I found a small typo in my code on line 134 in class-pta_sus_public.php which prevents you from seeing that error.
    $this->messages on that line should be changed to $this->errors and then you will see the error that lets you know that WordPress returned an error when trying to add the signup to the database.

    My new version is almost ready to release, but I’m going to be on vacation until Tuesday evening, so I was going to wait to release it until I got back.

    One of the features of the new version that you might be able to use instead of rewriting the code yourself is for the “Need Details” option, you can specify a label for that field on the signup form, and this can be done on a per task basis. So, you could have that field label be set to something like “enter your call sign”, and then you may want to use the built-in filter in my code to alter the table header that would say “Item Details” to something like “Call sign”. The call sign would then show up in the signups, but I’m guessing call signs don’t need to be kept private.

    If you are interested in giving the new version a spin to see if it works for you without having to modify the code yourself, please send me a message through my web site:
    https://stephensherrardplugins.com/contact/
    If you send me a message in the next few hours, I can send the new version to you to test out… after that I’m on a plane and won’t be back until late Tuesday evening. Or, if you prefer, I can try to go through my code quickly before I go and let you know the other places you might have missed that you need to update with your new fields info, and to make sure you have it in the right format.

    Plugin Author DBAR Productions

    (@dbar-productions)

    Just in case you don’t have time to contact me before I leave, here are a few things that might help get your modifications functioning:

    1. I’m guessing you added a new database field for the signups table in the proper format. The field there should NOT have the word “signup” in it, it should just be something like “callsign”. If you updated the plugin in the main plugin php file to modify the table structure, be sure to increment the database version number near the beginning of that class so it will force a database update, otherwise you can update your database manually with any other database tool.

    2. On the signup for in the public class, you need to preface the field name you created with “signup_”, so, for example, if you used “callsign” in the database, the name of the signup form field should be “signup_callsign”. The signup part will get stripped from the field name before the entry is saved in the database. It’s a bit weird, but that’s how the original plugin was designed that I re-engineered for this plugin.

    3. In the data.php file, you need to make sure you add your field to the allowed fields array near the top, and set it to the appropriate input type (text). In that section you enter it without the “signup_” prefix.

    4. Make that minor code change I described above so you can see an error if there is a problem adding the signup to the database.

    I think that should be everything you need to do for the public side of things. There is a bit more you would have to do in the admin class file if you want to view that info for signups in admin lists/reports.

    Thread Starter ki6zon

    (@ki6zon)

    I’ve got the new version installed and running fine. I did everything you listed on the public side, and now have a nice new field for Callsign and the form works. However, it doesn’t seem to be saving the callsign data. I’ve tried in two different places (the volunteer name on the signup sheet and in the admin console) to call the data in that field, but it always returns empty. I was even able to add the field to the .csv export, but it’s still empty in the export.

    I’m so close…

    Have a great trip, and thanks for your help!

    -Sutter

    Thread Starter ki6zon

    (@ki6zon)

    Well, I found part of the problem. I added Callsign as an allowed field in data.php, but now when I try to submit a signup, I get “Error adding signup record. Please try again.”

    Plugin Author DBAR Productions

    (@dbar-productions)

    Did you add the field to the sign up database table, and then update the database? You can use PHPMYADMIN to verify the database table was updated correctly. You normally would define the field in the SQL statement in the main plugin file, and then increment the database version number to force the plugin to run the activation routine again to update the tables.

    Thread Starter ki6zon

    (@ki6zon)

    That did it! I was accidentally changing the plugin version number a few lines above the DB version number.

    Thanks!

    Plugin Author DBAR Productions

    (@dbar-productions)

    glad you got it working. I only brought my phone with me not much I can do from here.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Adding Fields to Sign-Up Form’ is closed to new replies.