Question

I'm trying to add an accountActive and accountExpirationDate to a user's profile when it is created. According to everything I've read, I should use Accounts.onCreateUser like so:

// Add accountActive and accountExpirationDate
Accounts.onCreateUser(function(options, user) {
  if (options.profile) {
    user.profile = options.profile;
    user.profile.accountActive          =   false;
    user.profile.accountExpirationDate  =   null;
  }
  return user;
});

The two fields are not being added and I'm receiving this error in Console.

Uncaught TypeError: Object #<Object> has no method 'onCreateUser' 

What am I doing wrong?

Was it helpful?

Solution

The problem is that the Accounts.onCreateUser was running in the client folder. It cannot operate in the client, only on the server.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top