Plugin Directory

Changeset 1360586


Ignore:
Timestamp:
02/29/2016 09:17:09 AM (10 years ago)
Author:
stetic
Message:

Limit viewing of the stats to users, who can edit the dashboard

Location:
stetic/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • stetic/trunk/readme.txt

    r1197784 r1360586  
    33Tags: analytics, statistics, stats, tracking, widget, pageviews, visits, counter, visitors
    44Requires at least: 3.3
    5 Tested up to: 4.2
     5Tested up to: 4.4
    66Stable tag: trunk
    77
     
    5959== Changelog ==
    6060
     61= 1.0.3 =
     62* Limit viewing of the stats to users, who can edit the dashboard
     63
     64= 1.0.2 =
     65* PHP short open tag fix.
     66
    6167= 1.0.0 =
    6268* Initial version
  • stetic/trunk/stetic.php

    r1197826 r1360586  
    55Description: Adds real-time Web Analytics from Stetic with event tracking of all important actions to Wordpress. It comes with a dashboard to show you the important reports and numbers.
    66Author: Stetic
    7 Version: 1.0.2
     7Version: 1.0.3
    88Author URI: https://www.stetic.com/
    99*/
     
    3232                add_action( 'admin_menu', array( $this, 'add_page_to_navi' ) );
    3333               
    34                 if ( empty($GLOBALS['pagenow']) or ( !empty($GLOBALS['pagenow']) && $GLOBALS['pagenow'] == 'index.php' ) )
     34                if ( empty($GLOBALS['pagenow']) or ( !empty($GLOBALS['pagenow']) && $GLOBALS['pagenow'] == 'index.php' ) && current_user_can('edit_dashboard') )
    3535                {
    3636                    add_action(
     
    9292        {
    9393            global $wpdb;
    94             if ( function_exists('add_options_page') )
     94            if ( function_exists('add_options_page') && current_user_can('edit_dashboard') )
    9595            {
    9696                add_options_page('stetic', 'Stetic', 'manage_options', 'stetic/stetic.php&tab=settings', array('Stetic', 'config_page'));
    9797            }
    9898           
    99             if ( function_exists('add_menu_page') )
     99            if ( function_exists('add_menu_page') && current_user_can('edit_dashboard') )
    100100            {
    101101                add_menu_page('stetic', 'Stetic', 'read', __FILE__, array( 'Stetic', 'stats_page' ), plugins_url('stetic/img/icon.png'));
     
    133133        public static function stats_page()
    134134        {
     135            if( ! current_user_can('edit_dashboard') )
     136            {
     137                return;
     138            }
     139           
    135140            if(isset($_POST['submit']))
    136141            {
     
    209214               
    210215                wp_enqueue_style('stetic-css',
    211                                 plugins_url('css/stetic.css', __FILE__),
    212                                 false,
    213                                 $plugin_info['Version'],
    214                                 false);
     216                                plugins_url('css/stetic.css', __FILE__),
     217                                false,
     218                                $plugin_info['Version'],
     219                                false);
    215220                ?>
    216221                <div class="wrap">
     
    271276        public static function add_dashboard_stats()
    272277        {
    273             if ( !current_user_can('level_8') ) {
     278            if ( !current_user_can('edit_dashboard') )
     279            {
    274280                return;
    275281            }
     
    304310           
    305311            wp_enqueue_style('stetic-css',
    306                             plugins_url('css/dashboard.css', __FILE__),
    307                             false,
    308                             $plugin_info['Version'],
    309                             false);
     312                            plugins_url('css/dashboard.css', __FILE__),
     313                            false,
     314                            $plugin_info['Version'],
     315                            false);
    310316           
    311317        }
     
    320326        public static function show_dashboard_stats()
    321327        {
     328            if ( !current_user_can('edit_dashboard') )
     329            {
     330                return;
     331            }
    322332            $options  = get_option('stetic');
    323333            ?>
Note: See TracChangeset for help on using the changeset viewer.