Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By flawsome on
Right, here's what I want to do:
After having created a user with a specific role ("Advertiser") I would like to have a node (with a content type called "Advertiser") created.
This works fine, but how would I go about automagically populating the user id of the Advertiser entity?
Assuming I have to create a field of type Entity Reference in my Advertiser entity, but what else?
I've installed Rules and Entity Reference modules.
Any help is appreciated.
P
Comments
=-=
http://drupal.org/project/prepopulate may aid
Rules
I assume you are using the event "After saving a new user account". And then using a condition to check the role.
In the actions, you create an entity of node with type "Advertiser". You must enter a title and author. Perhaps the title is the same name as the user. The Author would be [account] (the new user account). You don't really need an additional entity reference if you use the author user id.