1

I have a cloud driven drupal site. In the site one content type exists named as people it has email field. The content in this content type is around 5000. Whenever new user registered I want to check user email with the people content type email field that is around 5000 content i want to check. If user email matches with any one email in people content type I want to make them active automatically. How to do this.? Can anyone give me suggestions. I tried with rules but its not happening. Can anyone suggest some custom php code for rules module

0

Using PHP on admin end is not recommended. If you are interested in custom module here are the pointers

  1. Implement hook_user_presave : Invoked when a user is created or updated.
  2. Make sure your code inside presave hook is conditional for new account created but not updated. You can use in_new property of account object

    if ($account->is_new) {...}

  3. Use Entity Field query to find a node with email id of current account being created

  4. if you found a result then Set $edit['status'] as 1.

0

Try this steps in a custom module..

First load all your content Email values into an array. You can done it using db_query or db_select.Then in hook_user_insert check $user->email with array values. If match is found set $user->status = 1.

3

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.