Plugin Directory

Changeset 588973


Ignore:
Timestamp:
08/22/2012 07:18:42 PM (14 years ago)
Author:
leethompson
Message:

Version 2.0 allows use of ajax calls from the front end

Location:
no-more-admin
Files:
2 edited
3 copied

Legend:

Unmodified
Added
Removed
  • no-more-admin/tags/2.0/no-more-admin.php

    r581339 r588973  
    44Plugin URI: http://www.confusedthoughts.com
    55Description: This disables access to wp-admin to all users who are not admins.
    6 Version: 1.0
    7 Author: Lee Thompson   
     6Version: 2.0
     7Author: Lee Thompson   
    88Author URI: http://www.confusedthoughts.com
    99License: GPL2
     
    2626*/
    2727
     28$wpba_required_capability = 'edit_others_posts';
     29$wpba_redirect_to = '';
     30
    2831add_action('admin_init', 'no_more_dashboard');
    2932function no_more_dashboard() {
    30   if (!current_user_can('manage_options') && $_SERVER['DOING_AJAX'] != '/wp-admin/admin-ajax.php') {
    31   wp_redirect(site_url()); exit;
    32   }
     33        global $wpba_required_capability, $wpba_redirect_to;
     34                if (
     35                        stripos($_SERVER['REQUEST_URI'],'/wp-admin/') !== false
     36                        &&
     37                        stripos($_SERVER['REQUEST_URI'],'async-upload.php') == false
     38                        &&
     39                        stripos($_SERVER['REQUEST_URI'],'admin-ajax.php') == false
     40                ) {
     41                        if (!current_user_can($wpba_required_capability)) {
     42                                if ($wpba_redirect_to == '') { $wpba_redirect_to = get_option('siteurl'); }
     43                                wp_redirect($wpba_redirect_to,302);
     44                        }
     45                }
    3346}
     47?>
    3448
    35 ?>
  • no-more-admin/tags/2.0/readme.txt

    r581339 r588973  
    55Requires at least: 3.0
    66Tested up to: 3.4.1
    7 Stable tag: 1.0
     7Stable tag: 2.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3333== Screenshots ==
    3434
    35 There are no screenshots, but you can test it [confusedthoughts](http://www.confusedthoughts.com) here
     35There are no screenshots, but you can test it [confusedthoughts](http://www.confusedthoughts.com/wp-admin)
    3636
    3737== Changelog ==
     
    4040* Initial Release
    4141
     42= 2.0 =
     43* This version allows for the use of ajax call from the front end. Also compatable with Buddypress
     44
    4245== Upgrade Notice ==
    4346
    4447= 1.0 =
    4548* Initial Release
     49
     50= 2.0 =
     51* This version allows for the use of ajax call from the front end. Also compatable with Buddypress
  • no-more-admin/trunk/no-more-admin.php

    r581339 r588973  
    44Plugin URI: http://www.confusedthoughts.com
    55Description: This disables access to wp-admin to all users who are not admins.
    6 Version: 1.0
    7 Author: Lee Thompson   
     6Version: 2.0
     7Author: Lee Thompson   
    88Author URI: http://www.confusedthoughts.com
    99License: GPL2
     
    2626*/
    2727
     28$wpba_required_capability = 'edit_others_posts';
     29$wpba_redirect_to = '';
     30
    2831add_action('admin_init', 'no_more_dashboard');
    2932function no_more_dashboard() {
    30   if (!current_user_can('manage_options') && $_SERVER['DOING_AJAX'] != '/wp-admin/admin-ajax.php') {
    31   wp_redirect(site_url()); exit;
    32   }
     33        global $wpba_required_capability, $wpba_redirect_to;
     34                if (
     35                        stripos($_SERVER['REQUEST_URI'],'/wp-admin/') !== false
     36                        &&
     37                        stripos($_SERVER['REQUEST_URI'],'async-upload.php') == false
     38                        &&
     39                        stripos($_SERVER['REQUEST_URI'],'admin-ajax.php') == false
     40                ) {
     41                        if (!current_user_can($wpba_required_capability)) {
     42                                if ($wpba_redirect_to == '') { $wpba_redirect_to = get_option('siteurl'); }
     43                                wp_redirect($wpba_redirect_to,302);
     44                        }
     45                }
    3346}
     47?>
    3448
    35 ?>
  • no-more-admin/trunk/readme.txt

    r581339 r588973  
    55Requires at least: 3.0
    66Tested up to: 3.4.1
    7 Stable tag: 1.0
     7Stable tag: 2.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3333== Screenshots ==
    3434
    35 There are no screenshots, but you can test it [confusedthoughts](http://www.confusedthoughts.com) here
     35There are no screenshots, but you can test it [confusedthoughts](http://www.confusedthoughts.com/wp-admin)
    3636
    3737== Changelog ==
     
    4040* Initial Release
    4141
     42= 2.0 =
     43* This version allows for the use of ajax call from the front end. Also compatable with Buddypress
     44
    4245== Upgrade Notice ==
    4346
    4447= 1.0 =
    4548* Initial Release
     49
     50= 2.0 =
     51* This version allows for the use of ajax call from the front end. Also compatable with Buddypress
Note: See TracChangeset for help on using the changeset viewer.