User Informations in admin email notification

This topic contains 6 replies, has 3 voices, and was last updated by  Alex Rollin 6 years, 3 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #1244

    Dominik Schendl
    Free User
    Post count: 2

    Hi there,

    Regular there is that [#extras#] variable, which displays the default fields (in my case, I use only Name and emailadress) of the newly registrated user in the admin notification email.
    But Id’ like to display custom values/fields of the registration form in this email as well.
    Specifically, do I have a additional Text-field and a phonenumber-field I created.

    I couldn’t find out, where I could add those two fields to the variable. And would be very great full for help.

    Some Information:
    >I got some basic knowledge in coding but im far away from Pro in my opinion.
    >The PlugIn is used on a swissgerman Site, so I translated parts of the PlugIn to German (only displaying strings, no variables or such)
    >I saw in the PlugIn Files some criterias, from the Query I thought would pull the Information and I think the settings are correct. (I got some Screenshots from the two Fields)

    Thank you in advance

    #1253

    Alex Rollin
    Moderator
    Post count: 27815

    Hello!

    Some improvements were made by adding email tags in the past:
    https://userswp.io/support/topic/feature-request-more-tags-for-emails/

    I know we won’t be adding more tags right now, but Let me check with the team to see if we can find out more.
    Thank you for your patience while we look into this.

    #1255

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hello,

    You would need to use a filter to add the info, not tested but something like this(this will show all info available):

    
    
    add_filter('uwp_send_admin_mail_extras', '_my_admin_mail_extras', 15, 3);
    function _my_admin_mail_extras($extras, $type, $user_id) {
            switch ($type) {
                case "register_admin":
                     $usermeta = uwp_get_usermeta_row($user_id);
                    $extras .= "<p>".print_r($usermeta,true)."</p>";
            }
            return $extras;
        }

    Thanks,

    Stiofan

    #1261

    Dominik Schendl
    Free User
    Post count: 2

    Thank you for that fast replies!

    I couldn’t found what I search in the email tag post. Though I really would be happy if I could make a Tag like [#phonenumber#]. That was the first thought I had. If I could understand the way, the other tags are made, I could make my own, perhaps with the field ID. (Im more used to JS than to PHP) When I didn’t made it work, I thought, I could try to manipulate an existing tag. Which seems to be out of my knowledge as well. 🙁

    At least I wasn’t totally wrong with the filters, as it seems with the solution from Stiofan OConnor, that’s the way to do it.

    How ever, I think I don’t get it wright, because it seems, that I don’t understand, where to put the filter.

    Now, how I understud it:
    I have to find the definition of the the default variable

    [#extras#]

    which is basically

    $extras

    in the code.

    And I found this:

    $extras = apply_filters('uwp_send_mail_extras', "", $message_type, $user_id);

    The queries I found, seemed to be the wrong ones. And I don’t find in the PHP files a other definition of

    $extras

    , nor a filter or query, I could connect to this definition. So I thought, I had to put a code like the one from Stiofan OConnor either after the equal sign or in to the brackets. But obviously that’s a wrong thought.

    Where do I have to put the

    add_filter(...)

    code.

    Ususal I try to figure out such stuff more by my self. But I some how really don’t get it and I’m running out of time a bit. So I really appreciate your Help.

    Thank you and for your patience.

    #1262

    Alex Rollin
    Moderator
    Post count: 27815

    Hello!

    Above, Stiofan provided a Snippet, which you can use with the “Code Snippets” plugin.

    https://wpgeodirectory.com/docs/useful-plugins/#snippets

    You may need to customize that further, so let us know how it goes

    #1344

    Dominik Schendl
    Free User
    Post count: 2

    Hello,

    Just to close this. I tried it and failed horribly. XD
    Because I ran out of time, I hired a more experienced Programmer who created a new Mail Tag from scratch.

    I just wanted to thank for the help, regardless. I may could have done it, with more experience.

    Thanks!

    #1345

    Alex Rollin
    Moderator
    Post count: 27815

    Hello Dominik,

    thanks for writing in to let us know.

    Can you share how you went about this? Code samples?

    Thanks again for letting us know

Viewing 7 posts - 1 through 7 (of 7 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket