Skip to content

Commit

Permalink
Changing the Strings to be related to Reports instead of Notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
bordoni committed Feb 11, 2014
1 parent 4d07b29 commit 09ebf2a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions includes/settings.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Settings class for Stream Notifications
* Settings class for Stream Reports
*
* @author X-Team <x-team.com>
* @author Shady Sharaf <shady@x-team.com>, Jaroslav Polakovič <dero@x-team.com>
Expand All @@ -17,7 +17,7 @@ public static function load() {
add_filter( 'user_has_cap', array( __CLASS__, '_filter_user_caps' ), 10, 4 );
add_filter( 'role_has_cap', array( __CLASS__, '_filter_role_caps' ), 10, 3 );

// Add Notifications settings tab to Stream settings
// Add Reports settings tab to Stream settings
add_filter( 'wp_stream_options_fields', array( __CLASS__, '_register_settings' ) );
}

Expand Down Expand Up @@ -45,7 +45,7 @@ public static function get_fields() {
}

/**
* Appends Notifications settings to Stream settings
* Appends Reports settings to Stream settings
*
* @filter wp_stream_options_fields
*/
Expand All @@ -71,7 +71,7 @@ public static function _filter_user_caps( $allcaps, $caps, $args, $user = null )
foreach ( $caps as $cap ) {
if ( WP_Stream_Reports::VIEW_CAP === $cap ) {
foreach ( $user->roles as $role ) {
if ( self::_role_can_access_notifications( $role ) ) {
if ( self::_role_can_access( $role ) ) {
$allcaps[ $cap ] = true;
break 2;
}
Expand All @@ -94,14 +94,14 @@ public static function _filter_user_caps( $allcaps, $caps, $args, $user = null )
* @return array
*/
public static function _filter_role_caps( $allcaps, $cap, $role ) {
if ( WP_Stream_Reports::VIEW_CAP === $cap && self::_role_can_access_notifications( $role ) ) {
if ( WP_Stream_Reports::VIEW_CAP === $cap && self::_role_can_access( $role ) ) {
$allcaps[ $cap ] = true;
}

return $allcaps;
}

private static function _role_can_access_notifications( $role ) {
private static function _role_can_access( $role ) {
if ( in_array( $role, WP_Stream_Settings::$options['reports_role_access'] ) ) {
return true;
}
Expand Down

0 comments on commit 09ebf2a

Please sign in to comment.