packages/roles/src/Roles.php 1 location
|
@@ 38-46 (lines=9) @@
|
35 |
|
* |
36 |
|
* @return string|boolean Current user's role, false if not enough capabilities for any of the roles. |
37 |
|
*/ |
38 |
|
public function translate_current_user_to_role() { |
39 |
|
foreach ( $this->capability_translations as $role => $cap ) { |
40 |
|
if ( current_user_can( $role ) || current_user_can( $cap ) ) { |
41 |
|
return $role; |
42 |
|
} |
43 |
|
} |
44 |
|
|
45 |
|
return false; |
46 |
|
} |
47 |
|
|
48 |
|
/** |
49 |
|
* Get the role of a particular user. |
class.jetpack.php 1 location
|
@@ 4396-4404 (lines=9) @@
|
4393 |
|
return $url; |
4394 |
|
} |
4395 |
|
|
4396 |
|
static function translate_current_user_to_role() { |
4397 |
|
foreach ( self::$capability_translations as $role => $cap ) { |
4398 |
|
if ( current_user_can( $role ) || current_user_can( $cap ) ) { |
4399 |
|
return $role; |
4400 |
|
} |
4401 |
|
} |
4402 |
|
|
4403 |
|
return false; |
4404 |
|
} |
4405 |
|
|
4406 |
|
static function translate_user_to_role( $user ) { |
4407 |
|
foreach ( self::$capability_translations as $role => $cap ) { |