Redirect users using Rules, based on a profile field value
This tutorial will take you through the configuration of Rules, Profile module, and Views Bulk Operations (VBO), to create a user redirect. The redirect will depend on a user profile field value. You can use this technique to trigger any action available from rules based on the users profile input.
Required Modules:
- Rules: http://drupal.org/project/rules
- Views Bulk Operations (VBO): http://drupal.org/project/views_bulk_operations
- Profile Module: Core
- PHP Filter: Core
Code used in the video:
<?php return ($account->profile_welcome == 0); ?>
Hi,
great tutorial, I was wondering if you could help or perhaps point me in the right direction please. I have a field on my user/*/edit page called paypal_email, I would like to set a page redirect using a truth value. Basically, if the paypal_email field is blank I want to redirect the user.
I’ve tried the code below but it redirects the user regardless of whether the field is blank. Could you provide any guidance?
paypal_email == 0) ? ’1′ : ‘ ‘; ?>
Thanks again,
Evelyn
Seems the code was cut off.
return ($account->paypal_email == 0) ? ’1′ : ‘ ‘; ?>
You should be able to use ($account->paypal_email == ”). Since it is not a checkbox field, the default value would not be 0, but would be blank.
Thank you so much for your help, that worked perfectly!!
Wonderful! You’re welcome.