One of our Organization Members does not have the member badge or membership appearing on the Drupal.org profile here https://association.drupal.org/user/65709

When the purchase of the Org. membership with auto-renew was made in June 2012, the CRM connected the new Org. membership to a previous Individual membership. Both payments were under 1 membership record and the CRM changed the membership level from Individual to Organization-USD. I deleted the incorrect record and payments so that I could manually re-enter new records and see a badge/membership on the profile but that did not work.

CommentFileSizeAuthor
#13 screenshot_user_1966376.png46.06 KBavpaderno
#5 Member bug.jpg35.91 KBlizzjoy

Comments

digitalfrontiersmedia’s picture

As another note, the badge used to show up here as well:
http://drupal.org/user/106070

Could the problem be that manually entering does not trigger the procedure that places the badge on the profile? Essentially meaning that the only way without re-purchase would be to fiddle with the database?

digitalfrontiersmedia’s picture

drupalorg_has_civimembership MUST return TRUE for the badge to display, but it doesn't. Could it be that it's not returning TRUE because the function is expecting to be passed $account as a parameter instead of $organization?

Its call:
drupalorg_has_civimembership($organization, 'Organization') <-----passing in $organization
where earlier it is declared: $organization = node_load($nid); <----- a node

versus the actual function:
function drupalorg_has_civimembership($account, $type) { <-----expecting to be passed $account
return (bool) db_select('drupalorg_civimembership', 'dc')
->fields('dc', array('user_name'))
->condition('user_name', $account->name, '=') <------ a user
->condition('membership_type', $type, '=')
->range(0, 1)->execute()->fetchField();
}

/** 
* Implements hook_user_view(). 
*/ 
function drupalorg_user_view($account, $view_mode) { 
global $user; 

...

// Link organization to organization node, if it exists. 
if (!empty($account->profile_current_company_organization)) { 
$nid = db_query("SELECT nid FROM {node} WHERE status = :status AND type = :type AND title = :title", array(':status' => 1, ':type' => 'organization', ':title' => $a$ 
if ($nid != 0) { 
$organization = node_load($nid); 
$link = check_plain($organization->title); 
// todo D7 make sure logo works once marketplace feature is back #1595348 
if (isset($organization->field_logo[0])) { 
// TODO Please change this theme call to use an associative array for the $variables parameter. 
$link = theme('imagecache', 'grid-3', $organization->field_logo[0]['filepath'], $organization->title, $organization->title); 
} 
$account->content['Work']['profile_current_company_organization']['#markup'] = l($link, 'node/' . $nid, array('html' => TRUE));

The above is obviously being invoked since the Current Company logo/link does indeed show up on my user profile page. The below SHOULD add the badge and a "We're a member/Join Us" link but it does NOT. It depends on the IF determining if we have an 'Oraganization' civimembership (and if the parent IFs are TRUE, of course) to add the badge to the $content['column_2']['membership'] array.

if (drupalorg_has_civimembership($organization, 'Organization')) { 
$content['column_2']['membership'][] = array( 
'#prefix' => '<div class="clear-block"><div class="grid-1 alpha"><a href="https://association.drupal.org/membership"><img src="' . url(drupal_get_path('module', 'drupalorg') . '/images/association-organization.png') . '" alt="' . t('Drupal Association Organization Member') . '" /></a></div><div class="grid-3 omega"><p>', 
'#markup' => t('My organization is a member of the <a href="https://association.drupal.org/">Drupal Association</a>. We e supporting the Drupal.org infrastructure and other large community initiatives. <a href="https://association.drupal.org/membership">Join us</a>.'), 
'#suffix' => '</p></div></div>', 
); 
} 

} 
} 

The below is being invoked and adding a personal ("Individual") membership message/link (when viewing the profile while logged in as myself) to the $membership_personal variable.

// Get the membership display content 
if ($account->uid === $user->uid) { 
$membership_personal = t('Hey! Want to support the Drupal Community, Drupal.org infrastructure, and get one of the cool <a href="https://association.drupal.org">Drupal Association</a> badges on your profile page? <a href="https://association.drupal.org/membership">Become a member today.</a>'); 
} 

...

Below, the $membership_personal variable (holding the personal ("Individual") membership message/link) is added to the same $content['column_2']['membership'] array that the badge was supposedly added to above. The difference being that the personal ("Individual") membership message/link is actually being displayed and is visible on the page but the badge is NOT. Thus, it appears that the function drupalorg_has_civimembership($organization, 'Organization') is returning FALSE and therefore never adding the badge to the page. This would coincide with your observation that my profile shows no indication of a membership at all.

if (isset($membership_personal)) { 
$content['column_2']['membership'][] = array( 
'#prefix' => '<p>', 
'#markup' => $membership_personal, 
'#suffix' => '</p>', 
'#weight' => -1, 
); 
} 

Out of curiosity, am I the only person/organization reporting this problem?
The above code discrepancy MUST be affecting others.

digitalfrontiersmedia’s picture

On second look, I guess this would still work if $node->name is set. Question is: is it?

I also notice some individual badges don't seem to display correctly ( http://drupal.org/user/64383 ). Seems there are a few problems going on here.

lizzjoy’s picture

Another example. A current Individual member purchased an Organization membership on July 14. The system attached the Org. payment to the current Ind. membership and changed the level to Org. It should have created a new membership record for the Org. membership. I tried to add the Ind. membership back into the CRM and it does not appear in the Membership record. This cannot be fixed in the CRM. http://drupal.org/user/1144180

lizzjoy’s picture

Title: Membership and badge not appearing on Profile » Membership and badge not appearing on Profile/ membership records are overwritten incorrectly
StatusFileSize
new35.91 KB

I'm changing the title of this issue for clarity.
Renewing members buy their memberships and the data is incorrect in the CRM. It is affecting display of the badges and member statuses on profiles.
Example: Individual member decides to also buy an Organization membership. Makes purchase. In the data, the individual membership is overwritten with the new contribution. So one membership disappears and then the new contribution and new Org. membership does not show up on the profile.
Image attached for clarity.

digitalfrontiersmedia’s picture

Hi Lizz,

Sorry you did not make it to Munich. Was hoping to touch base with you and possibly a dev on this while here but heard you stayed in New York. In lieu of that, Any update on this issue or ideas on who might be able to look at this? Anymore I can do to help?

drumm’s picture

https://association.drupal.org/api/association_members.json has the username truncated "user_name":"DigitalFrontier...". We should update the view to not do that, re-export the feature, etc, deploy.

Dev sites aren't helpful for this, we have to do CiviCRM on staging. CiviCRM won't be on dev since it is full of personal information.

twardnw’s picture

Interesting, the view in question has nothing set to actually truncate the username

lizzjoy’s picture

Adding another example to this issue: http://drupal.org/user/1201508
The transaction and record look fine in the CRM, but no record on Drupal profile of the Org. membership

twardnw’s picture

Component: Code » association_drupalorg.module
Status: Active » Fixed

I think I've got this solved :) The JSON feed plugin for Views was truncating the usernames, and my setting for the Membership type was cutting off 1 character too soon.

Searching through the JSON file from the view for 'membership_type" : " ' comes back with no results now, which means that every user listed has a membership type show properly. Previously it was coming showing "" for USD organization members.

digitalfrontiersmedia’s picture

Excellent work. Confirming that this is indeed fixed on my profile!

shyamala’s picture

Status: Fixed » Needs work

Though the organisation membership badge and individual membership badge is now displayed on my profile. It still doesnot dispaly on my colleagues profiles. List of colleagues can be viewed by clicking the company name on my profile or visiting http://drupal.org/profile/profile_current_company_organization/UniMity%2....

Is it something wrong that I am doing or is it a bug?

avpaderno’s picture

StatusFileSize
new46.06 KB

@Shyamala I see it.

screenshot

shyamala’s picture

Added my organisation to the Drupal market place and it started showing up. SO yes it's working for me now.
Prior to adding the organisation to the market place, I was facing this issue.

Thanks

avpaderno’s picture

Status: Needs work » Fixed
lizzjoy’s picture

+1 to Infinity.
Thanks very much.
Shyamala - I see you found the solution by having the listing here http://drupal.org/node/1817376
Any employee who chooses to list your company as their Current Employer in their Drupal.org profile will show up in this node and will also get the badge because it appears on the node.

Thanks for making my weekend.

Status: Fixed » Closed (fixed)

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

tvn’s picture

Component: association_drupalorg.module » Code
lizzjoy’s picture

Component: Code » CiviCRM
Status: Closed (fixed) » Needs work

We need to make a change in CiviCRM to prevent the overwriting of memberships. This is not about badges, but is about renewal transactions causing the problem.
If a person has ever had an Individual Membership and they purchase an Organization Membership, the new purchase overwrites the old one. This is unacceptable for any member who is a current Individual Member buying also for their Org.
This can be fixed, but I need someone with direct access to the Civi database to coordinate with me so I can move Org. Memberships to a new Civi organization (ID 236678) and then you run a query to move all the existing Organization Memberships into this new Civi organization.
This will prevent future overwriting and allow for fixing of currently overwritten memberships to begin.

digitalfrontiersmedia’s picture

Status: Needs work » Active

This issue has regressed as the badge which previously was fixed and appeared on my account has again disappeared:
http://drupal.org/user/106070

avpaderno’s picture

Status: Active » Needs work

This is why the current status is needs work: because somebody needs to work on this. ;)

digitalfrontiersmedia’s picture

Sorry. I reset it since #19 seemed to indicate work needed to be done in a different area for a more robust fix without mentioning (or possibly even realizing) that the original issue had re-expressed itself, i.e. one might be under the impression that the original issue was solved but that further work was needed when I just wanted to point out that in fact we're still at the same point where we started 5 months ago.

I changed status since http://drupal.org/node/156119 states that the "Active" status...

...may also sometimes be used for 'resetting' an issue that has gotten off-course even if the issue has old patches attached.

Sorry for being too aggressive with it.

twardnw’s picture

the 'Link this field to its user' setting on the user_name field of the view seems to have been the cause of this. When I inspected the view it was checked, clearing it removes the shortening of that field. DigitalFrontiersMedia, I checked your profile, the badge is being displayed properly.

digitalfrontiersmedia’s picture

@twardnw, as you say. It is indeed back. Thank you!

twardnw’s picture

Status: Needs work » Fixed

#1859410: Update organization memberships with new membership organization
dealt with the original problem for this issue. New org memberships will now be associated with a different 'membership organization' and will prevent them from being over-written and thus not displaying the correct badge.

Closing this one out, if you have problems with your badge again, please open a new issue.

Status: Fixed » Closed (fixed)

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