Skip to content

Accounts.onCreateUser is not triggered for Guest Account #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Kostanos opened this issue Jul 10, 2015 · 2 comments
Open

Accounts.onCreateUser is not triggered for Guest Account #33

Kostanos opened this issue Jul 10, 2015 · 2 comments

Comments

@Kostanos
Copy link

When you register new user the event Accounts.onCreateUser will be triggered, and you'll be able to extend the User object there.

When Guest Account is created this event is not triggered. How can I extend Guest's user object? or can be Accounts.onCreateUser triggered?

Example of code:

Accounts.onCreateUser(function(options, user){
  user.address = {
    location: null, // Geolocation.currentLocation() object
    street: null, // With coordinates we need only street and department.
    department: null,
    note: null
  };
  if (options.profile)
    user.profile = options.profile;
  return user;
});

FYI. The event is working when you sign up new user, even if guest account is already exists.
The event is triggered when I moved it to lib/ folder from server/ with if (Meteor.isServer) {...}

@artwells
Copy link
Owner

I will look into this soon. Am I correct in understanding that moving the onCreateUser to lib/ will resolve this?

@Kostanos
Copy link
Author

Apparently yes. It looks like if you keep in in server/ folder the guest account is created before the onCreateUser code is loaded. I don't see any other reason why it didn't run there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants