Is it possible to trigger an action based upon the condition of a checked field in the user profile?

Comments

PeterErnst’s picture

Interesting Question. Subscribing

I'm particularly interested on how to change a user role after a checked field in a User profile (or on a Content Profile page) using a trigger and an action based upon the condition of a checked field.

filpet’s picture

Subscribing!

fago’s picture

Title: Profile fields » Profile fields condition
Category: support » feature

Related issue: #363682: User account update rule doesn't include Profile updates

There isn't any profile module integration yet. Personally I'm using content profile instead, however I'd be happy to commit patches adding profile module integration.

mradcliffe’s picture

Status: Active » Needs work
StatusFileSize
new1.06 KB

I wrote up something quick today to handle basic profile field conditions and date profile field conditions. At the moment it's as its own module (not a patch).

This should give you a start. The method that grabs the profile fields of generic type or date should probably be expanded to sort out via select/checkbox items, date items, and text items (textarea, textfield, url, etc...), but I didn't need that functionality myself yet.

deggertsen’s picture

That worked like a charm! It would be great to see this integrated or created as its own module. It does need the work as mradcliffe stated but what's there currently works great!

YK85’s picture

+1 subscribing - do you think there is a chance to get this adding to Rules module as profile fields are in core? thanks!

OliverColeman’s picture

Title: Profile fields condition » Profile fields conditions and actions
Version: 6.x-1.1 » 6.x-1.x-dev
StatusFileSize
new1.81 KB

I've added to the profile_rules module provided in #4 Actions that allow setting a profile field value. Would be great to see this (though probably with some changes) included as an optional module along with Rules...

One of the changes would probably be to allow PHP processing for the conditionals (the Actions for setting a value already allow PHP processing). The other change would probably be Token support...

OliverColeman’s picture

Hmm, those should probably have been created as Rules Actions (and not Drupal core Actions). I'll probably do this some time soon.

izmeez’s picture

subscribing

OliverColeman’s picture

StatusFileSize
new1.46 KB

Okay, attached is a new version that uses Rules Actions. It also allows token replacement and PHP processing for both conditions and actions, and handles date fields more elegantly (I reckon anyway :)), just using a single action and condition for all field types and accepting dates in string format.

OliverColeman’s picture

StatusFileSize
new1.41 KB

Well, this is a bit embarrassing, but here's another version in which the Condition and Action actually works for date fields...

mr.andrey’s picture

subscribing... +1 to including this as part of rules module.

comfused’s picture

just tried this add-on-module
but I can't seem to get a rule triggered when a user updates his personal information

what I'd like is to update the users role after he completes his personal information form

comfused’s picture

Component: Provided module integration » Rules Engine

anyone ?

mradcliffe’s picture

I never actually needed any of what I did here as I went in a different direction. I don't have much time to look at it anymore, sorry.

jorditr’s picture

Hi you all. I've tried to use that small module on #11, but it doesn't appear on my modules list (in fact the whole .module file is empty). The ones that have tried it, what have you done to have it working?

Thanks.

jorditr’s picture

Ok, I've seen it was looking on a wrong place. I've modified the .info file to have it on the same Rules group.

fizk’s picture

What's the status of this issue?

If the Rules maintainers want this functionality to exist as a separate module, I will create a new project using the code from http://drupal.org/node/658504#comment-3241944

clemens.tolboom’s picture

I've updated the patch from #363682: User account update rule doesn't include Profile updates #49.

The (non) patch from #11 does comparison of profile field values which can be accomplished by using the http://drupal.org/project/token_profile and rules compare conditions for text/numeric/boolean.

The only comparison not yet possible through #363682: User account update rule doesn't include Profile updates and standard rules comparison is the date field so I've added #1488574: token_profile does not explode profile date field into year, month, day parts to token_profile making rules compare conditions for text/numeric usefull for comparing profile dates.

I would say we can close this issue and all move over to #363682: User account update rule doesn't include Profile updates.

What do you think?

tr’s picture

Component: Rules Engine » Rules Core
Issue summary: View changes

Drupal 6 end-of-life was more than two years ago - there will be no new feature in D6 Rules, and D6 Rules is no longer supported.

That said, this could go into Rules for D7 or D8 if someone is willing to contribute code or fund the development of this feature.

tr’s picture

Version: 6.x-1.x-dev » 7.x-2.x-dev