CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Blocking a user using Rules when membership expires
Pages: [1]

Author Topic: Blocking a user using Rules when membership expires  (Read 691 times)

juillet19

  • I’m new here
  • *
  • Posts: 1
  • Karma: 0
  • CiviCRM version: 4.4
  • CMS version: Drupal
  • MySQL version: 5
  • PHP version: 5.3/5.4
Blocking a user using Rules when membership expires
December 27, 2014, 06:23:42 am
I would like to block the associated Drupal user account when a membership expires. I am using Rules and CiviCRM Entity, but can't figure out what data selector to use. I've tried both:

civicrm-membership:contact-id-contact:civicrm-user
civicrm-membership:contact-id-contact:civi-user

but neither of them seem to hold the user ID for the user.

I have the Event and Condition set up as follows and (as a test) when I enter a Drupal user ID in direct input mode, it blocks out that particular user when any membership expires. What I need is the right data-selector so that the associated user is blocked.

Event: CiviCRM Membership has been updated
Condition: Data Comparison: Parameter: Data to compare: [civicrm-membership:status-id], Data value: 4
Action: Block a User: Data Selector: ?????

I have seen posts with similar questions but haven't been able to find a solution.
https://www.drupal.org/node/2191085
http://www.jackrabbithanna.com/comment/5#comment-5

Thanks for your help!

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Blocking a user using Rules when membership expires
January 12, 2015, 12:52:18 pm
hi - a late reply, but can't this be achieved just by using the civimember synch module and setting the 'Role' for expired members to a Role that has no permissions beyond what Anon has?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

flug

  • I post frequently
  • ***
  • Posts: 126
  • Karma: 12
Re: Blocking a user using Rules when membership expires
January 23, 2015, 06:25:52 am
Quote from: juillet19 on December 27, 2014, 06:23:42 am
I would like to block the associated Drupal user account when a membership expires. I am using Rules and CiviCRM Entity, but can't figure out what data selector to use. I've tried both:

civicrm-membership:contact-id-contact:civicrm-user
civicrm-membership:contact-id-contact:civi-user

Probably that is giving you the Civicrm contact id, but to change the Drupal permissions you need the Drupal User ID.  You can use a SQL query or (better) API call to figure out the one from the other, using the civicrm uf_match table.  However, i don't think you can do that without having a bit of custom PHP code to pull that value for you.

Probably the way to go is civimember sync module, as petednz says.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Blocking a user using Rules when membership expires

This forum was archived on 2017-11-26.