1

I am using the module Administration Views (https://www.drupal.org/project/admin_views) to change the layout and content of the Drupal users view at "site_path/admin/people". The site I am working on requires that users pay yearly for membership using Ubercart. Using Ubercart's add user role on purchase functionality, I have added the "Paid User" role to the site. When any registered user makes an Ubercart purchase of a "Membership", he/she is given this Paid User role.

The site admins want to be able to track users by whether or not they have made their yearly payments to ensure that their privileges within the organization for which I am producing this site reflect their membership payments. Therefore, I have added a "Dues Status" field to the "user" node type and displayed it in the Drupal users view at "site_path/admin/people" using the Administration Views module.

However, as the tracker for "Paid Dues" is whether or not the user has the role "Paid User" rather than a user edit, I have been unable to make the value of the "Dues Status" field update in the view. Since Administration Views has access to each user node in their respective views rows, I considered using Views PHP (https://www.drupal.org/project/views_php) to try to access the data in the "User Roles" field and check for the presence of the role "Paid User", but I did not know how to do this and change the value of the "Paid Dues" field.

I am familiar with re-writing fields using HTML, just not with PHP. Could someone explain how to use Views PHP to rewrite the value of a user field by checking for a user role on that user? Or, if there is a module I have been unable to find that can do this, please let me know.

1 Answer 1

1

Please never ever use something that uses eval(). Even if you don't migh related security problems because nobody else has access to your site eval() is very very slow.

What you are looking for is hook_views_pre_render()

or a preprocess hok for the specific field. There are plenty examples if you use google.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.