• Resolved jtrollia

    (@malivuk)


    Hello,

    Thanks for your plugin.

    I’m following your doc to create and save a new field.

    So far, the field is showing in frontend with the following code:

    
    function awesomesupport_custom( ) {
    	$checkbox = array(
    		'title' => 'SMS optin',
    		'field_type' => 'checkbox',
    		'options' => array( 'option1' => 'Reply by SMS' ),
    		'capability' => 'edit_ticket'
    	);
    	if ( function_exists( 'wpas_add_custom_field' ) ) {
    		wpas_add_custom_field( 'sms_optin', $checkbox );
    	}
    add_action( 'wpas_submission_form_inside_after_subject', 'awesomesupport_custom', 1 );
    

    However, the field is not saved and is not showing in admin/ticket thread. I tried to var_dump the $post variable in the ticket detail page but I can’t find the field value.

    What did I miss?

    Alternatively, can you provide an integration example of save_callback?

    Thanks

    • This topic was modified 7 years, 3 months ago by jtrollia.
    • This topic was modified 7 years, 3 months ago by jtrollia.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Hello,
    Ijust wanted to say that I have exactly the same problem.
    I just could not find any way to save custom field.
    JM

    Plugin Author awesomesupport

    (@awesomesupport)

    @jtrollia – the custom fields on the back-end will be in a metabox on the right hand side of the ticket. Please look for a metabox with the title “custom fields”. Custom fields are automatically saved with the ticket and the values are placed in this metabox.

    @jmaubert75 – please open a new thread with your issue – its going to be tough to trouble-shoot issues for two individuals in the same thread. Since jtrollia started this thread we’ll troubleshoot his issue here.

    Thanks.

    Thread Starter jtrollia

    (@malivuk)

    Hello,

    Thanks for you answer.

    I can see nothing more there. I did dump WPAS()->custom_fields in ./includes/admin/metaboxes/custom-fields-backend.php and it returns an array of arrays. Top-level elements are :

    
    object(WPAS_Custom_Fields)#538 (2) {
      ["remove_mb"]=> (...)
      ["options"]=> (...)
      ["status"]=> (...)
      ["ticket-tag"]=> (...)
      ["product"]=>  (...) // properly showing as a dropdown
      ["ticket_channel"]=> (...)
      ["secondary_assignee"]=> (...)
      ["tertiary_assignee"]=> (...)
      ["ttl_replies_by_agent"]=> (...)
      ["ttl_replies_by_customer"]=> (...)
      ["ttl_replies"]=> (...)
      ["ttl_calculated_time_spent_on_ticket"]=> (...)
      ["ttl_adjustments_to_time_spent_on_ticket"]=> (...)
      ["time_adjustments_pos_or_neg"]=> (...)
      ["final_time_spent_on_ticket"]=> (...)
      ["time_notes"]=> (...)
      ["first_addl_interested_party_name"]=> (...)
      ["first_addl_interested_party_email"]=> (...)
      ["second_addl_interested_party_name"]=> (...)
      ["second_addl_interested_party_email"]=> (...)
    

    Also screenshot of metaboxes here: https://ibb.co/iA3xCw

    No trace of my custom field ??

    Thanks

    Plugin Author awesomesupport

    (@awesomesupport)

    Hi:

    It doesn’t look like your custom field is in the custom fields array. Try creating the field using the plugins_loaded action hook instead. See if that helps.

    Thanks.

    Thread Starter jtrollia

    (@malivuk)

    Hmm using plugins_loaded doesn’t displays the field in frontend form anymore, sadly.

    Plugin Author awesomesupport

    (@awesomesupport)

    Hi:

    If the plugins_loaded action hook isn’t showing the fields then something must be getting in the way. Are you trying this with just the awesome support plugin and your custom function plugin installed? If not, you can try that and see if it helps. But, generally speaking the plugins_loaded action hook is the best place to define the custom fields. Its early enough in the loading process that everything else that needs access to the custom fields array will have it.

    Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Custom fields not saving/displaying’ is closed to new replies.