You are here

public static function LearningPathAccess::getMembershipStatus in Opigno Learning path 8

Same name and namespace in other branches
  1. 3.x src/LearningPathAccess.php \Drupal\opigno_learning_path\LearningPathAccess::getMembershipStatus()

Returns user membership status.

4 calls to LearningPathAccess::getMembershipStatus()
GroupMembershipStatus::render in src/Plugin/views/field/GroupMembershipStatus.php
Renders the field.
LearningPathAccess::notifyUsersByMail in src/LearningPathAccess.php
Prepares and sends emails to users.
LearningPathAccess::statusGroupValidation in src/LearningPathAccess.php
Returns group user access flag in validation condition.
opigno_learning_path_form_alter in ./opigno_learning_path.module
Implements hook_form_alter().

File

src/LearningPathAccess.php, line 250

Class

LearningPathAccess
Class LearningPathAccess.

Namespace

Drupal\opigno_learning_path

Code

public static function getMembershipStatus($mid, $as_string = FALSE) {
  $query = \Drupal::database()
    ->select('opigno_learning_path_group_user_status', 'us')
    ->fields('us', [
    'status',
  ])
    ->condition('mid', $mid);
  $result = $query
    ->execute()
    ->fetchField();
  if ($as_string && $result != FALSE) {
    $statuses = LearningPathAccess::getMembershipStatusesArray();
    $result = $statuses[$result];
  }
  return $result;
}