3

I need to send custom field data to the admin when a user registers. In this example I'm trying to send the ZIPCODE along with other standard fields. I'm using freemember to collect the custom field data.

This is my Admin Notification of New Member Registration Template:

    New member registration site: {site_name}

    Name: {name}
    User Name: {username}
    Email: {email}

    zipcode: {zipcode}

    Your control panel URL: {control_panel_url}

Any Help is greatly appreciated. I do have Solspace User, but that hasn't been any help.

2
  • What's the problem? Jan 5, 2014 at 10:36
  • The custom fields are not rendered in the template.
    – SteveO
    Jan 6, 2014 at 15:14

3 Answers 3

2

You can do this easily with Notify Control. No needs in any php coding. Just email template with regular expressionengine code.

2
  • I tried MX Notify Control. I could not get it to pass data for custom member fields. If you have a working example of this, will you please post it.
    – SteveO
    Jan 29, 2014 at 22:31
  • yes, you right - freemember used his own hooks on custom field saving step. I have Solspace hooks inside MC, but I will do quick update for NC today for Freemember too. Ping you later today.
    – Max Lazar
    Jan 30, 2014 at 5:45
1

I was able to get this to work using Postmaster. Thanks to Justin over there for pointing me in the right direction.

I created a new php file in the hooks dir of postmaster:

E.g.

Member_member_register.php

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Member_member_register_postmaster_hook extends Base_hook { 

    protected $title = 'Member member register';

    public function __construct($params = array())
    {
        parent::__construct(array());
    }

    public function trigger($data, $member_id) 
    {   


        $member = $this->channel_data->get_member($member_id)->row_array(); 

        $member['email'] = $_POST['email'];
        $member['street_address'] = $_POST['street_address'];
        $member['city'] = $_POST['city'];
        $member['state'] = $_POST['state'];
        $member['zipcode'] = $_POST['zipcode'];


        return $this->send($parse_vars, $member); 
    } 
}

Then in my postmaster template, I accessed the data like such:

Name: {hook:screen_name}
Email: {hook:email}
Address: {hook:street_address}
{hook:city}, {hook:state} {hook:zipcode}

The downside is that you have to hard code the values. If you were to add more fields, you would have to change the hook file. I'm sure with some tweaking you could make this dynamic.

1
  • For others reading this post, the hardcoded values can be worked around. When I tested this hook, I was just testing the member_member_register hook and the native EE registration form. I am positive that if the Freemember hooks were used, these would not have to be hardcoded values. I will see about getting Freemember support included into Postmaster to provide a more seamless integration. Jan 29, 2014 at 18:42
0

I haven't run into this specific problem before, but a quick google turned up this thread and this earlier thread, which seem to imply that you can't use custom fields in the member registration emails.

I am afraid there is no built-in way to use other variables in these mails. Perhaps Freeform can handle that? Otherwise it’d have to be a Feature Request.

I wouldn't recommend hacking core files, so your best bet is probably to check out Postmaster or another email plugin to see if it can do this for you.

1
  • Yes, that was my comment at the bottom of that thread. I do not want to hack core files. I'm not sure if postmaster will do the trick.
    – SteveO
    Jan 6, 2014 at 23:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.