Is there any way to use pcp in combination with the User role field module? Right now, the module calculates user profile completeness by taking all the user fields, also the ones which do not apply for the current user role.

Any help would be appreciated!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

perennial.sky’s picture

Status: Active » Needs review
FileSize
1.63 KB

Hello Attila

This patch may solve your problem.

subhojit777’s picture

Status: Needs review » Needs work
  1. +++ b/pcp.module
    @@ -183,6 +183,10 @@ function pcp_get_complete_percentage_data($entity_type, $bundle, $user) {
    +  if (module_exists('user_role_field')) {
    

    Provide a comment saying that you are restricting profile completeness for fields which user do not has access.

  2. +++ b/pcp.module
    @@ -631,3 +635,22 @@ function pcp_user_login(&$edit, $account) {
    + *  Check user has access to field or not.
    

    Parameter definition missing for $fields

  3. +++ b/pcp.module
    @@ -631,3 +635,22 @@ function pcp_user_login(&$edit, $account) {
    +function check_user_field_access($fields) {
    

    Incorrect function name. Function names should start with module machine name.

  4. +++ b/pcp.module
    @@ -631,3 +635,22 @@ function pcp_user_login(&$edit, $account) {
    +  global $user;
    

    Is is required? You can get $user object from pcp_get_complete_percentage_data() itself.

  5. +++ b/pcp.module
    @@ -631,3 +635,22 @@ function pcp_user_login(&$edit, $account) {
    \ No newline at end of file
    

    There should be a new line.

perennial.sky’s picture

Thank you subhojit777 for such a good review

Here is a new patch

perennial.sky’s picture

Status: Needs work » Needs review
BarisW’s picture

Status: Needs review » Fixed

Thanks for the patch. I tweaked it a little bit and committed it.

  • BarisW committed bbbfd0f on 7.x-1.x authored by akashjain132
    Issue #2350729 by akashjain132, subhojit777, Attila: User role field...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.