コード例 #1
0
 /**
  * can_teach( $user_id = null )
  *
  * This will check if current user is allowed to manage courseware for current group
  * @param Int $user_id, the id of the user to check
  * @return Bool, true or false
  */
 function can_teach($user_id = null)
 {
     global $bp;
     if (!$user_id) {
         $user_id = $bp->loggedin_user->id;
     }
     $is_admin = false;
     if (!BPSP_Groups::courseware_status()) {
         return false;
     }
     if (is_super_admin($user_id)) {
         return true;
     }
     if (self::is_teacher($user_id)) {
         $is_admin = true;
     }
     if (!get_option('bpsp_allow_only_admins') && !bp_group_is_admin()) {
         $is_admin = false;
     }
     return $is_admin;
 }
コード例 #2
0
 /**
  * can_teach( $user_id )
  *
  * This will check if current user is allowed to manage courseware for current group
  * @param Int $user_id, the id of the user to check
  * @return Bool, true or false
  */
 function can_teach($user_id)
 {
     $is_admin = false;
     if (!BPSP_Groups::courseware_status()) {
         return false;
     }
     if (is_super_admin($user_id)) {
         return true;
     }
     if (self::is_teacher($user_id)) {
         $is_admin = true;
     }
     if (!get_option('bpsp_allow_only_admins') && !bp_group_is_admin()) {
         $is_admin = false;
     }
     return $is_admin;
 }