You are here

protected function ContributeManager::getUserBadge in Contribute 8

Get a user account's badge from Drupal.org.

Return value

string|NULL A user account's badge from Drupal.org.

1 call to ContributeManager::getUserBadge()
ContributeManager::getMembership in src/ContributeManager.php
Get membership status.

File

src/ContributeManager.php, line 525

Class

ContributeManager
Class ContributeManager.

Namespace

Drupal\contribute

Code

protected function getUserBadge() {
  $account_id = $this
    ->getAccountId();
  $body = $this
    ->get('https://www.drupal.org/u/' . urlencode($account_id));
  if (strpos($body, 'association_ind_member_badge.svg') !== FALSE) {
    return 'https://www.drupal.org/sites/all/modules/drupalorg/drupalorg/images/association_ind_member_badge.svg';
  }
  elseif (strpos($body, 'association_org_member_badge.svg') !== FALSE) {
    return 'https://www.drupal.org/sites/all/modules/drupalorg/drupalorg/images/association_org_member_badge.svg';
  }
  else {
    return NULL;
  }
}