Events Made Easy Forums How do I … Work with Custom Fields that are not Generic

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #60575
    Anonymous
    Inactive

    I am asking here because I have not tested enough to say that this is a bug.

    When defining custom fields you say that generic fields are deprecated. Using this information I created new fields that I define as RSVP.

    However, I have a plugin which works with the data collected by EME. When I ask EME for the answers provided in the forms I am only able to get data back when the fields are defined as generic. If I define the fields as RSVP the query returns empty fields, even though there is data in them.

    To get the data I call your function is this way:

    $answers = eme_get_booking_answers( $booking_id );

    The fields that are defined as generic return data. The fields that are defined as RSVP do not. Using the web interface I went to modify the field type. However, I had already used these fields in RSVP forms, so I was prevented from being able to modify the field type.

    I do not want to undo all my forms to be able to change a field type definition. There are lots of forms and they are in different places – it is a lot of work to undo my forms. Fortunately I can use phpMyAdmin to modify the field definition. This is also painful but much less painful than modifying a lot of forms so that I can use the web interface to reset my field type. Then going back and resetting the forms.

    The chances of making errors in all of those changes is almost certain. So it would be great to be able to have a warning – “You’re already using this field” – but allow us to make the changes if we want to.

    thank you

    #60583
    Franky
    Keymaster

    The function eme_get_booking_answers doesn’t take the type into account. From the code:

    function eme_get_booking_answers($booking_id) {
       global $wpdb;
       $answers_table = $wpdb->prefix.ANSWERS_TBNAME; 
       $sql = $wpdb->prepare("SELECT * FROM $answers_table WHERE booking_id=%d",$booking_id);
       return $wpdb->get_results($sql, ARRAY_A);
    }

    So I assume you have another problem here …
    Concerning the change of purpose for the field: it is a protection, so for now I’m going to leave that in place (the generic type should not be used anymore, so to avoid issues, I’ll remove it from the dropdown for new fields and hide it from the dropdown for existing fields if they are not of that purpose).

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘How do I …’ is closed to new topics and replies.
Scroll to Top