• Resolved ligma8alls

    (@ligma8alls)


    Can you guys please add a filter for variables in the forminator_replace_variables function? that would be extremely helpful in my current situation.

    Image of code to modify
    https://pasteboard.co/ApQGoQhmaSQY.png

    The code is on line #922 in library/helpers/helper-fields.php I just need to use the {user_name} found in the entry instead of the current user display name but a whole filter would be helpful for anything else user related since it doesn’t check the entry first.

    Thank you.

    • This topic was modified 3 years, 9 months ago by ligma8alls.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Laura – WPMU DEV Support

    (@wpmudev-support8)

    Hi @ligma8alls

    I hope you’re well today!

    There actually is a filter hook available already for that, right in that function (line 989) :

    return apply_filters( 'forminator_replace_variables', $content, $content_before_replacement );

    If you have any additional questions on this, let me know, please.

    Best regards,
    Adam

    Thread Starter ligma8alls

    (@ligma8alls)

    Hello and thank you for the reply!

    Sadly that hook is useless to me as it doesn’t give me the entry and form id
    On the other hand, I kept messing around with the email template until I realized that I can just use the field names {hidden-5} and so on in the email, which wasn’t really clear at first since whenever I chose to add the user display name field it would auto insert {user_name}, but it doesn’t matter now it’s doing the thing and working fine which is perfect!

    Thank you for this great plugin.

    Plugin Support Laura – WPMU DEV Support

    (@wpmudev-support8)

    Hi @ligma8alls

    Thank you for response and additional information!

    It seems I misunderstood the goal here and I referred solely to the function that you mentioned.

    But you are right, in this case you can indeed just use field names this way. I’m glad to know that it works for you.

    Best regards,
    Adam

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Add a filter?’ is closed to new replies.