How to implement a trial membership using Organic groups? I work on a Drupal site with the Organic groups module, where users can create account.

When the process for creating an account is finished, users have access to a specific group and should have og role Trial member (automatically assigned) with state Active, and this for a limited time period.

After that limited time period is passed, user still has og role Trial member assigned, but with state Pending.

Can someone help me with this?
Sounds like a perfect job to accomplish with the Rules module. Below are the headlines of how you could get this to work ...

Rule 1 (When user account is created)


Event: When a new user account is created
Action:


Grant access to role Trial member.
Set some Date field value = expiration date (cfr. your "limited time").
Set some State field value = Active.



Rule 2 (When expired)


Event: When user logs in
Condition: if the date indicated in field with expiration date is passed.
Action: Set your State field value = Pending.


Recommended video tutorials

Rules

If you're not familiar (enough/yet) with Rules, checkout the 32 (!!!) great, and free, video tutorials Learn the Rules framework.

Organic Groups

If you're not familiar (enough/yet) with Organic Groups, then reviewing the amazing set of videos to Learn Organic Groups might help.

Other variations

There are other variations to make this work with the Rules module. E.g. by using 'Rules Scheduler' (= sub-module of Rules) to schedule a variation of "Rule 2", to be executed on your expiration date.