Plugin Directory

Changeset 1025816


Ignore:
Timestamp:
11/14/2014 03:39:23 PM (11 years ago)
Author:
mr_mat
Message:

1.02

Location:
admin-users-advances-permissions/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • admin-users-advances-permissions/trunk/admin-users-advanced-permissions.php

    r1025697 r1025816  
    44 Plugin URI: https://wordpress.org/plugins/admin-users-advances-permissions/
    55 Description: Set up permissions for categories and taxonomies to admin users whose role is not "administrator"
    6  Version: 1.01
     6 Version: 1.02
    77 Author: Mathieu Thollet
    88 Author URI: http://www.awebvision.fr
  • admin-users-advances-permissions/trunk/inc/admin-restrict-cat-tax.php

    r1025631 r1025816  
    77function auap_admin_pre_get_posts($query){
    88    if (is_admin() && !current_user_can("administrator")) {
     9        $post_type = $query->query["post_type"];
    910        $tax_query = array();
    1011        foreach (auap_get_taxonomies() as $taxonomy) {
    11             if (count(get_terms($taxonomy, array("hide_empty" => false))) > 0) {
    12                 $access_tax = json_decode(get_user_meta(get_current_user_id(), "auap_".$taxonomy, true));
    13                 if (is_array($access_tax)) {
    14                     $tax_query[] = array(
    15                                         'taxonomy' => $taxonomy,
    16                                         'field'    => 'id',
    17                                         'terms'    => $access_tax
    18                                      );
     12            if (in_array($post_type, get_taxonomy($taxonomy)->object_type)) {
     13                if (count(get_terms($taxonomy, array("hide_empty" => false))) > 0) {
     14                    $access_tax = json_decode(get_user_meta(get_current_user_id(), "auap_".$taxonomy, true));
     15                    if (!is_array($access_tax))
     16                        $access_tax = array();
     17                    if (is_array($access_tax)) {
     18                        $tax_query[] = array(
     19                                            'taxonomy' => $taxonomy,
     20                                            'field'    => 'id',
     21                                            'terms'    => $access_tax
     22                                         );
     23                    }
    1924                }
    2025            }
  • admin-users-advances-permissions/trunk/inc/admin-users.php

    r1025672 r1025816  
    6363        <?php if ($term_id=="0") {?>
    6464            <p>
    65                 <a class="check-all" rel="<?php echo $input_name;?>"><?php _e("Check all", AUAP_I18N_DOMAIN);?></a>
     65                <a class="check-all" rel="<?php echo $input_name;?>" href="#"><?php _e("Check all", AUAP_I18N_DOMAIN);?></a>
    6666            </p>
    6767        <?php } ?>
  • admin-users-advances-permissions/trunk/js/admin-users.js

    r1025631 r1025816  
    1313            jQuery(this).html(auap_check_all_label);
    1414        }
     15        return false;
     16    });
     17    jQuery('.check-all').each(function() {
     18        var rel = jQuery(this).attr("rel");
     19        if (jQuery("input[type='checkbox'][rel='" + rel + "']").length == jQuery("input[type='checkbox'][rel='" + rel + "']:checked").length)
     20            jQuery(this).trigger("click");
    1521    });
    1622});     
  • admin-users-advances-permissions/trunk/readme.txt

    r1025697 r1025816  
    2828== Changelog ==
    2929
     30= 1.02 =
     31* Minor improvements and bug corrections
     32
    3033= 1.01 =
    3134* Minor improvements and bug corrections
Note: See TracChangeset for help on using the changeset viewer.