PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.8
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
← All changes | inc/user/class-lp-profile.php +17 -12 4.4.04.4.8 View file →
@@ -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
@@ -443,12 +445,15 @@
443 445 * @since 3.0.0
444 446 * @version 1.0.2
445 447 */
446 448 public function current_user_can( $capability ) {
447 - $privacy = array(
448 - 'view-tab-courses' => self::get_option_publish_profile() === 'yes',
449 - 'view-tab-my-courses' => $this->get_privacy( 'courses' ) == 'yes',
450 - 'view-tab-quizzes' => $this->get_privacy( 'quizzes' ) == 'yes',
449 + $privacy = apply_filters(
450 + 'learn-press/profile/current-user-can/vew-tab',
451 + array(
452 + 'view-tab-courses' => self::get_option_publish_profile() === 'yes',
453 + 'view-tab-my-courses' => $this->get_privacy( 'courses' ) == 'yes',
454 + 'view-tab-quizzes' => $this->get_privacy( 'quizzes' ) == 'yes',
455 + )
451 456 );
452 457
453 458 if ( current_user_can( ADMIN_ROLE ) ) {
454 459 $can = true;