Support

Account

Home Forums Feature Requests Add pre and post do_action calls for user render function

Unread

Add pre and post do_action calls for user render function

  • Inside the forms/user.php file, where the render function can be found, I would benefit greatly from having (inside the foreach( $field_groups as $field_group ) { loop) a do_action call pre and post the acf_render_fields call.

    My use case is that I often create complex field groups(for instance, a complex/nested repeater/flexible_content) for users, and I then wish to have a secondary way of displaying the data, to make it more understandable for the user. This may be a quick Vue.js (React, whatever…) app or just php.

    In other cases I may want to display some things from my custom tables that are directly dependent upon the values of the ACF fields in those field groups.

    Ideally, I would wire up my parts of the code to display right under/above these field groups, which I can’t (easily) do right now.

    What I’m proposing is either 2 or 4 new lines of code.

    do_action('acf_pre_user_render_field_group', $field_group, $post_id, $user_id);
    do_action('acf_post_user_render_field_group', $field_group, $post_id, $user_id);

    I say 4 in case it makes sense to make 1 pair of calls inside the <table> and one pair outside. The default for my use cases would always be outside the table element.

    This introduces no breaking changes, as far as I can imagine.

Viewing 1 post (of 1 total)

The topic ‘Add pre and post do_action calls for user render function’ is closed to new replies.