Skip to content

Commit

Permalink
Merge pull request #28 from itthinx/mmc-shield
Browse files Browse the repository at this point in the history
Mmc shield
  • Loading branch information
itthinx committed Jul 7, 2015
2 parents 75f9ed9 + d631274 commit a4bdaeb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
4 changes: 2 additions & 2 deletions groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Plugin Name: Groups
* Plugin URI: http://www.itthinx.com/plugins/groups
* Description: Groups provides group-based user membership management, group-based capabilities and content access control.
* Version: 1.7.0
* Version: 1.7.1
* Author: itthinx
* Author URI: http://www.itthinx.com
* Donate-Link: http://www.itthinx.com
Expand All @@ -30,7 +30,7 @@
if ( !defined( 'ABSPATH' ) ) {
exit;
}
define( 'GROUPS_CORE_VERSION', '1.7.0' );
define( 'GROUPS_CORE_VERSION', '1.7.1' );
define( 'GROUPS_FILE', __FILE__ );
if ( !defined( 'GROUPS_CORE_DIR' ) ) {
define( 'GROUPS_CORE_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
Expand Down
14 changes: 11 additions & 3 deletions lib/access/class-groups-post-access.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public static function init() {

/**
* Restrict access to edit or delete posts based on the post's access restrictions.
*
* @param array $caps
* @param string $cap
* @param int $user_id
Expand Down Expand Up @@ -111,9 +112,16 @@ public static function map_meta_cap( $caps, $cap, $user_id, $args ) {
}

if ( $cap === $edit_post_type || $cap === $delete_post_type ) {
$post_id = $args[0];
if ( !self::user_can_read_post( $post_id, $user_id ) ) {
$caps[] = 'do_not_allow';
$post_id = null;
if ( is_numeric( $args[0] ) ) {
$post_id = $args[0];
} else if ( $args[0] instanceof WP_Post ) {
$post_id = $post->ID;
}
if ( $post_id ) {
if ( !self::user_can_read_post( $post_id, $user_id ) ) {
$caps[] = 'do_not_allow';
}
}
}
}
Expand Down
9 changes: 6 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: http://www.itthinx.com/plugins/groups
Tags: access, access control, capability, capabilities, content, download, downloads, file, file access, files, group, groups, member, members, membership, memberships, paypal, permission, permissions, subscription, subscriptions, woocommerce
Requires at least: 4.0
Tested up to: 4.2.2
Stable tag: 1.7.0
Stable tag: 1.7.1
License: GPLv3

Groups is an efficient and powerful solution, providing group-based user membership management, group-based capabilities and content access control.
Expand Down Expand Up @@ -181,6 +181,9 @@ See also [Groups](http://www.itthinx.com/plugins/groups/)

== Changelog ==

= 1.7.1 =
* Fixes an issue with map_meta_cap filtering where no valid post ID is provided.

= 1.7.0 =
* Added the French translation.
* Added the [groups_login] shortcode.
Expand Down Expand Up @@ -474,5 +477,5 @@ Some installations wouldn't work correctly, showing no capabilities and making i

== Upgrade Notice ==

= 1.7.0 =
This release adds the [groups_login] and [groups_logout] shortcodes, the French translation and fixes issues with capabilities. Please back up your site and database before updating.
= 1.7.1 =
This release fixes an issue with a PHP error thrown under circumstances related to third-party plugins.

0 comments on commit a4bdaeb

Please sign in to comment.