I am trying to add a way to create variants on my homepage in Drupal based on a users Civicrm Groups (I have also been looking at tags, but will stick with the former for this point).

The purpose of this is to try and utilise the information gathered from a user's groups in more than just a analytical sense, and to actually display certain content to that user that is either going to be of potential interest to them based on their grouping, or to ensure that information that they do not require can be excluded in place of something else.

An example of this might be a slideshow at the top of a page which has a view controlling it displaying 3 different 'highlighted' promotions.

An anonymous user (The default/fallback variant in panels) might receive information relating to the fact that they could be new, so: - A shop is also available on the website (with a call to action) - That they can find out about the website (With a call to action) - That they can sign up to become a member (with a call to action)

However once they have actually signed up and interacted with the website. Perhaps signed up to become a member, we would then have that information stored in Civicrm, and realistically would not need to promote the fact that they can become a member on front page.

From there, it would be ideal to be able to use the Selection Rules in Page Manager to go through a list of variants and alter what is displayed based on the users groups, and to then switch to another view created with different content/Filters.

I know that you can create variants based on whether a user is logged in / logged out and that you can also create something similar by using CiviGroup Roles Sync and then allocated the Roles to a variant. Using CiviGroup Roles Sync seems to be a little overkill for this situation though, as the actual user roles on the drupal website need only be the standard 'authorised', 'admin', 'anonymous' types, and adding extra roles to match each group would add a massive overhead to the website. All I need to do is to check whether a user has a group matching the variants created and adjust the display accordingly.

It may just be a case of adding an API call to Civi using the 'PHP code' criteria in the Selection Rules of the Page Manager variant and telling it to search through the current users Groups and if it equals X group then trigger, however unfortunately this is a bit beyond me at the moment.

Any help that could be provided on this issue would be greatly appreciated, or any suggested alternatives.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.