Viewing 8 reply threads
  • Author
    Posts
    • #2699
      ajayphp
      Member

      add_filter(‘piklist_pre_update_option’,’my_update_option’,10,3);
      function my_update_option($settings, $setting, $new, $old)
      {

      if ($setting == ‘piklist_demo_fields’]))
      {
      $settings[‘option_key’] = ‘option_value’;
      }

      return $settings;

      }

      please update this code in doc, as that have error: (remove extra “])” from if expression)

      add_filter(‘piklist_pre_update_option’,’my_update_option’,10,3);
      function my_update_option($settings, $setting, $new, $old)
      {

      if ($setting == ‘piklist_demo_fields’)
      {
      $settings[‘option_key’] = ‘option_value’;
      }

      return $settings;

      }


      and when i tried with save setting for custom setting,
      then ERROR: Warning: Missing argument 4 for biztel_sms_send_update() in /var/www/piklist/wp-content/plugins/ <this error for not find the $old array data > on line 81

      as that was unable to find the $old db data …

    • #2706
      Steve
      Keymaster

      @ajayphp– The doc has been updated. Thanks for letting us know. What does biztel_sms_send_update() do? What is on line 81? $old_data is data that was saved, was there anything saved?

      Please provide more information in your tickets. It will allow us to help you faster.

    • #2716
      ajayphp
      Member

      Hi,

      add_filter(‘piklist_pre_update_option’,’ – using for access data before save,
      and logically when you are returning data base after modification,
      that is understood nothing will save when callback to this function

      update_option_update($settings, $setting, $new, $old = array())
      so $old = array() , as default pre initialize to over error , what other for you have in mind,
      which i am missing ?

      what is the hook you have for save admin page data ..?

    • #2719
      Steve
      Keymaster

      @ajayphp– What do you mean “admin page data”?

    • #2721
      ajayphp
      Member

      I created plugin which is not relate to any WP post type of wp default table.

      this is admin page gateways.php

      main menu
      form fields:
      gateway title:
      gateway Api URL:
      Api username:
      Api password..

      now how could i save these data into table gateways ..

      ???

    • #2728
      Steve
      Keymaster

      @ajayphp– The ability to save to custom tables is not yet supported.

    • #2729
      ajayphp
      Member

      Hi,

      if there would you add piklist_save_hook, then we could get form data and create custom query there.

      so , could you guide me how can i add that hook , till you add this support for adding data custom table

      please suggest me for now how to achieve this ..

    • #2732
      ajayphp
      Member

      Hi,

      I found the error :

      https://piklist.com/user-guide/docs/piklist_pre_update_option/
      please correct on the doc page, this took my lots of hours and have to make own solutions,
      which is not needed if to be correct, never mind, happens ,take care next time

      Change this to :
      add_filter(‘piklist_pre_update_option’,’biztel_sms_send_update’,10,3);
      WITH
      add_filter(‘piklist_pre_update_option’,’biztel_sms_send_update’,10,4);

      corrected – error gone as in doc you passing 3 args, but actually 4 – so 4th $old was not passing

    • #2738
      Steve
      Keymaster

      Docs have been updated. Thanks! Closing this ticket.

Viewing 8 reply threads
  • The topic ‘piklist_pre_update_option – $old array error’ is closed to new replies.