Hey everyone!

With the holiday season upon us, we want to share our upcoming working hours:

After that, we’ll return to our regular schedule and assist you as quickly as possible.

In the meantime, you can explore our documentation for Amelia and wpDataTables. You'll find tons of helpful resources, including articles and handy video tutorials on YouTube (Amelia's YouTube Channel and wpDataTables' YouTube Channel), which might just have the answers you need while we’re away.

Thanks a bunch for your understanding and support!

Warm regards and happy holidays!

TMS

Okay
  Public Ticket #3759254
WP Hooks, object structure
Closed

Comments

  • stefano started the conversation

    Good evening,

    I am trying to write a WordPress plugin that uses Amelia's hooks.

    Specifically, I added a custom field on an appointment, and would like to pre-fill it. It should contain the previous page visited or the referral anyways.

    I thought I could use "amelia_before_cf_added_filter" hook, but I would need to know how the $customField object is made (properties, methods etc.).

    Where could I look this up?

    Thank you

  •  1,564
    Uroš replied
     

    Good evening,

    To work with Amelia's hooks and filters like amelia_before_cf_added_filter, it's helpful to review the plugin's source code directly, as Amelia’s documentation does not always provide a detailed breakdown of each object’s structure. Here’s what you can do:

    1. Explore the Source Code: Navigate to the Amelia plugin folder in your WordPress installation (wp-content/plugins/ameliabooking/). Look for files related to custom fields, particularly under src/Infrastructure/WP/Filters. Here, you can usually find filter definitions and see how the $customField object is constructed and used.

    2. Debug the Object: If you need to quickly inspect the $customField object, try logging it using error_log() or var_dump(). For example:

       
      add_filter('amelia_before_cf_added_filter', 'custom_pre_fill_cf', 10, 1); function custom_pre_fill_cf($customField) { error_log(print_r($customField, true)); // Check the properties in the PHP error log return $customField; }

      This way, you can get a list of available properties and methods directly.

    Let me know if you need further assistance with specific parts of the code!

    Kind Regards, 

    Uros Jovanovic
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps, and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables