| @@ -262,17 +262,19 @@ | ||
| 262 | 262 | public function get_tabs() { |
| 263 | 263 | $user_of_profile = $this->get_user(); |
| 264 | 264 | $tabs = self::get_tabs_arr(); |
| 265 | 265 | |
| 266 | - $userModelProfile = UserModel::find( $user_of_profile->get_id(), true ); | |
| 267 | - if ( $userModelProfile ) { | |
| 268 | - $userModelProfileRoles = $userModelProfile->get_roles(); | |
| 266 | + if ( $user_of_profile ) { | |
| 267 | + $userModelProfile = UserModel::find( $user_of_profile->get_id(), true ); | |
| 268 | + if ( $userModelProfile ) { | |
| 269 | + $userModelProfileRoles = $userModelProfile->get_roles(); | |
| 269 | 270 | |
| 270 | - /* | |
| 271 | - * Check if user not Admin/Instructor, will be hide tab Courses. | |
| 272 | - */ | |
| 273 | - if ( ! array_intersect( $userModelProfileRoles, [ UserModel::ROLE_ADMINISTRATOR, UserModel::ROLE_INSTRUCTOR ] ) ) { | |
| 274 | - unset( $tabs['courses'] ); | |
| 271 | + /* | |
| 272 | + * Check if user not Admin/Instructor, will be hide tab Courses. | |
| 273 | + */ | |
| 274 | + if ( ! array_intersect( $userModelProfileRoles, [ UserModel::ROLE_ADMINISTRATOR, UserModel::ROLE_INSTRUCTOR ] ) ) { | |
| 275 | + unset( $tabs['courses'] ); | |
| 276 | + } | |
| 275 | 277 | } |
| 276 | 278 | } |
| 277 | 279 | |
| 278 | 280 | // Filter tabs by role - only show tabs with role restriction to users with matching roles |