CRM-10274 civicrm_member_roles_sync_user breaks with Drupal membership-based integration

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.1.2
    • Fix Version/s: 4.3.0
    • Labels:
      None

      Description

      The following function references the variable $op which is undefined, and causes an E_NOTICE warning to be shown to end users. My fix was to remove the if condition entirely, but not knowing the intended functionality, I haven't attached a patch.

      File: sites/all/modules/civicrm/drupal/modules/civicrm_member_roles/civicrm_member_roles.module

      function civicrm_member_roles_sync_user( $account)
      {
      if ( ! civicrm_initialize( ) )

      { return; }

      if ( variable_get('civicrm_member_roles_sync_method', 0) == 0)

      { _civicrm_member_roles_sync($account->uid); }

      if (variable_get('civicrm_member_roles_sync_method', 0) == 3) {
      if ($op == 'insert')

      { _civicrm_member_roles_sync($account->uid); }

      }
      }

        Attachments

          Activity

          [CRM-10274] civicrm_member_roles_sync_user breaks with Drupal membership-based integration
          Donald A. Lobo added a comment -


          Hoping someone who uses this module can take a look and figure out what needs to be done

          Andrew Wasson added a comment -

          One of my live installations (civiCRM 4.2.4) is having the same problem. I get a warning:

          Notice: Undefined variable: op in civicrm_member_roles_sync_user() (line 111 of /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/drupal/modules/civicrm_member_roles/civicrm_member_roles.module).

          The issue seems to be that the variable $op isn't being passed to the function but I can't seem to figure out where to get it from. I thought at one point it was because the author tried to use Drupal's hook_user() and had incorrectly named it hook_synch_user() but that ended being a red herring.

          Sean MacGillivray added a comment -

          I'm encountering this issue as well, and am also planning to remove completely the IF statement in question. This error started happening for me when I switched the Automatic Synchronization Method from "Synchronize whenever a user logs in or logs out" to "Synchronize when membership is updated. " in the Configure screen for the CiviMember Roles Sync module.

          Sean MacGillivray added a comment -

          I should say that this is under Civi 4.2.7 under Drupal 7.

          Donald A. Lobo added a comment -


          note that those lines have been removed in v4.3

          Sean MacGillivray added a comment -

          You rule, Lobo.

            People

            • Assignee:
              Donald A. Lobo
              Reporter:
              Stefan

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 5 minutes
                5m
                Remaining:
                Remaining Estimate - 5 minutes
                5m
                Logged:
                Time Spent - Not Specified
                Not Specified