Plugin Directory

Changeset 1394820


Ignore:
Timestamp:
04/13/2016 10:27:19 PM (9 years ago)
Author:
janosver
Message:

v1.8
Release date: April 14, 2016

  • Fixed spinner icon while adding new Reading Group on Settings -> Reading screen - thanks to dbasilioesp for the fix
  • Fix an issue when a subscriber is not able to comment on private posts which he/she has otherwise read access to
Location:
wp-jv-post-reading-groups/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • wp-jv-post-reading-groups/trunk/Readme.txt

    r1307605 r1394820  
    44Tags: access, login, permission, permissions, post, posts, privacy, private, restrict, simple, user, users, member, members, membership, page, pages
    55Requires at least: 3.9.2
    6 Tested up to: 4.4
    7 Stable tag: 1.7
     6Tested up to: 4.5
     7Stable tag: 1.8
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5959
    6060== Changelog ==
     61
     62= 1.8 =
     63Release date: April 14, 2016
     64
     65* Fixed spinner icon while adding new Reading Group on Settings -> Reading screen - thanks to dbasilioesp for the fix
     66* Fix an issue when a subscriber is not able to comment on private posts which he/she has otherwise read access to
    6167
    6268= 1.7 =
     
    158164
    159165* Fix a compatibility issue with WP 4.4 when it was not possible to add / rename or delete a Reading Group
     166
     167= 1.8 =
     168Release date: April 14, 2016
     169
     170* Fixed spinner icon while adding new Reading Group on Settings -> Reading screen - thanks to dbasilioesp for the fix
     171* Fix an issue when a subscriber is not able to comment on private posts which he/she has otherwise read access to
  • wp-jv-post-reading-groups/trunk/languages/wp-jv-post-reading-groups.pot

    r1307463 r1394820  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: WP JV Post Reading Groups 1.5\n"
    6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-jv-post-"
    7 "reading-groups\n"
     5"Project-Id-Version: WP JV Post Reading Groups 1.8\n"
     6"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-jv-post-reading-groups\n"
    87"POT-Creation-Date: 2015-12-13 17:32:38+00:00\n"
    98"MIME-Version: 1.0\n"
    109"Content-Type: text/plain; charset=UTF-8\n"
    1110"Content-Transfer-Encoding: 8bit\n"
    12 "PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
    13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    14 "Language-Team: LANGUAGE <[email protected]>\n"
     11"PO-Revision-Date: 2016-04-13 23:24-0000\n"
     12"Plural-Forms: nplurals=2; plural=(n != 1);\n"
     13"Last-Translator: \n"
     14"Language-Team: \n"
     15"Language: en\n"
     16"X-Generator: Poedit 1.7.5\n"
    1517
    1618#: wp-jv-post-reading-groups.php:39 wp-jv-post-reading-groups.php:474
     
    102104#. Description of the plugin/theme
    103105msgid ""
    104 "Grant read-only permission for selected users (with no administrator role) "
    105 "on selected private posts"
     106"Grant read-only permission for selected users (with no administrator role) on selected "
     107"private posts"
    106108msgstr ""
    107109
  • wp-jv-post-reading-groups/trunk/uninstall.php

    r1307603 r1394820  
    44 *
    55 * WP JV Post Reading Groups Settings Uninstaller
    6  * @version 1.7
     6 * @version 1.8
    77 */
    88
  • wp-jv-post-reading-groups/trunk/wp-jv-post-reading-groups.css

    r1307603 r1394820  
    11/*
    22// CSS for WP JV Post Reading Groups
    3 // @version: 1.7
     3// @version: 1.8
    44*/
    55
  • wp-jv-post-reading-groups/trunk/wp-jv-post-reading-groups.js

    r1307603 r1394820  
    11/*
    22// Scripts for WP JV Post Reading Groups
    3 // @version: 1.7
     3// @version: 1.8
    44*/
    55
     
    5858                wp_jv_prg_refresh_rg_list();               
    5959            }           
     60            //Disable loading icon and enable button
     61            $('#spnAddRG').hide();
     62            $('#btnAddNewRG').attr('disabled', false);     
     63            document.getElementById("jv-new-reading-group-text").value = '';                               
    6064        });
    61         //Disable loading icon and enable button
    62         $('#spnAddRG').hide();
    63         $('#btnAddNewRG').attr('disabled', false);     
    64         document.getElementById("jv-new-reading-group-text").value = '';                               
    6565    });     
    6666   
  • wp-jv-post-reading-groups/trunk/wp-jv-post-reading-groups.min.js

    r1307603 r1394820  
    11/*
    22// Scripts for WP JV Post Reading Groups
    3 // @version: 1.7
     3// @version: 1.8
    44*/
    5 jQuery(document).ready(function(t){function e(){data={action:"wp_jv_prg_refresh_rg_list",url:ajaxurl,type:"POST"},t.post(ajaxurl,data,function(e){var e=t.parseJSON(e);e.rows.length&&t("#the-list").html(e.rows)})}t("#btnAddNewRG").click(function(){t("#btnAddNewRG").attr("disabled",!0),t("#spnAddRG").show();var a=document.getElementById("jv-new-reading-group-text").value;data={action:"wp_jv_prg_add_new_rg_to_db",url:ajaxurl,type:"POST",dataType:"text",newrg:a,wp_jv_rg_nonce:wp_jv_prg_obj.wp_jv_rg_nonce},t.post(ajaxurl,data,function(t){t.error?alert(t.error_msg+"\n\n[Error: "+t.error_code+"]"):e()}),t("#spnAddRG").hide(),t("#btnAddNewRG").attr("disabled",!1),document.getElementById("jv-new-reading-group-text").value=""}),t(".lnkEdit").live("click",function(a){a.preventDefault(),t.ajaxSetup({async:!1}),e(),t.ajaxSetup({async:!0});var r=t(this).attr("data-RG");t(".RenameDiv-"+r).html('<input type="text" id="renamed-reading-group-text" style="width:100%" value="'+t("div.ItemDiv-"+r).text()+'"><br><button class="btnCancel button-secondary">Cancel</button><button style="float:right" class="btnSave button-primary" data-rename-RG="'+r+'">Save</button>')}),t(".btnCancel").live("click",function(t){t.preventDefault(),e()}),t(".btnSave").live("click",function(a){a.preventDefault(),t(".btnSave").attr("disabled",!0);var r=document.getElementById("renamed-reading-group-text").value,n=t(this).attr("data-rename-RG");data={action:"wp_jv_prg_save_renamed_rg_to_db",url:ajaxurl,type:"POST",dataType:"text",RGToRename:n,NewRGName:r},t.post(ajaxurl,data,function(t){t.error?alert(t.error_msg+"\n\n[Error: "+t.error_code+"]"):e()}),t(".btnSave").attr("disabled",!1)}),t(".lnkDelete").live("click",function(a){a.preventDefault();var r=jQuery(this).attr("href");data={action:"wp_jv_prg_delete_rg",url:ajaxurl,type:"POST",delurl:r},t.post(ajaxurl,data,function(t){t.error?alert(t.error_msg+"\n\n[Error: "+t.error_code+"]"):e()})})});
     5jQuery(document).ready(function(t){function e(){data={action:"wp_jv_prg_refresh_rg_list",url:ajaxurl,type:"POST"},t.post(ajaxurl,data,function(e){var e=t.parseJSON(e);e.rows.length&&t("#the-list").html(e.rows)})}t("#btnAddNewRG").click(function(){t("#btnAddNewRG").attr("disabled",!0),t("#spnAddRG").show();var a=document.getElementById("jv-new-reading-group-text").value;data={action:"wp_jv_prg_add_new_rg_to_db",url:ajaxurl,type:"POST",dataType:"text",newrg:a,wp_jv_rg_nonce:wp_jv_prg_obj.wp_jv_rg_nonce},t.post(ajaxurl,data,function(a){a.error?alert(a.error_msg+"\n\n[Error: "+a.error_code+"]"):e(),t("#spnAddRG").hide(),t("#btnAddNewRG").attr("disabled",!1),document.getElementById("jv-new-reading-group-text").value=""})}),t(".lnkEdit").live("click",function(a){a.preventDefault(),t.ajaxSetup({async:!1}),e(),t.ajaxSetup({async:!0});var r=t(this).attr("data-RG");t(".RenameDiv-"+r).html('<input type="text" id="renamed-reading-group-text" style="width:100%" value="'+t("div.ItemDiv-"+r).text()+'"><br><button class="btnCancel button-secondary">Cancel</button><button style="float:right" class="btnSave button-primary" data-rename-RG="'+r+'">Save</button>')}),t(".btnCancel").live("click",function(t){t.preventDefault(),e()}),t(".btnSave").live("click",function(a){a.preventDefault(),t(".btnSave").attr("disabled",!0);var r=document.getElementById("renamed-reading-group-text").value,n=t(this).attr("data-rename-RG");data={action:"wp_jv_prg_save_renamed_rg_to_db",url:ajaxurl,type:"POST",dataType:"text",RGToRename:n,NewRGName:r},t.post(ajaxurl,data,function(t){t.error?alert(t.error_msg+"\n\n[Error: "+t.error_code+"]"):e()}),t(".btnSave").attr("disabled",!1)}),t(".lnkDelete").live("click",function(a){a.preventDefault();var r=jQuery(this).attr("href");data={action:"wp_jv_prg_delete_rg",url:ajaxurl,type:"POST",delurl:r},t.post(ajaxurl,data,function(t){t.error?alert(t.error_msg+"\n\n[Error: "+t.error_code+"]"):e()})})});
  • wp-jv-post-reading-groups/trunk/wp-jv-post-reading-groups.php

    r1307603 r1394820  
    44 * Plugin URI: http://janosver.com/projects/wordpress/wp-jv-post-reading-groups
    55 * Description: Grant read-only permission for selected users (with no administrator role) on selected private posts
    6  * Version: 1.7
     6 * Version: 1.8
    77 * Author: Janos Ver
    88 * Author URI: http://janosver.com
     
    629629/************************************************************************************************************/
    630630
     631// Amend status of privately published posts if user has permission to view it
     632//#TODO: Find a proper way to handle this issue
     633//
     634// Use these WP Core files to debug/fix:
     635//      wp-comments-post.php
     636//      wp-includes/comment.php (look for this function: wp_handle_comment_submission)
     637//
     638// This is a temporary fix for the issue when a subscriber is not able to comment on private posts which he/she has otherwise read access to
     639function wp_jv_prg_post_status($post_status, $post) {   
     640   
     641    if ($post_status == 'private') {
     642
     643        $current_user = wp_get_current_user(); 
     644        $can_view_this_post = wp_jv_prg_user_can_see_a_post($current_user, $post->ID); 
     645
     646        if ($can_view_this_post) {
     647                $post_status = 'publish';
     648        }   
     649    }
     650    return $post_status;
     651}
     652add_filter('get_post_status','wp_jv_prg_post_status',10,2);
     653
    631654
    632655//Display private posts as well (only those for which user has permissions)
     
    802825
    803826//add support for WP JV Custom Email Settings Plugin
    804 function wp_jv_prg_user_can_see_a_post($user_id, $post_id) {   
     827function wp_jv_prg_user_can_see_a_post($user, $post_id) {   
    805828    $user_can_see_a_post=false;
     829   
     830    //Try to use user irrespectively of its type
     831    if (is_a($user, 'WP_User')) {
     832        $uid=$user->ID;
     833    } else {
     834        $uid=$user;
     835    }
     836   
    806837    //If a post is public then anybody can see it
    807     if (get_post_status($post_id)== 'publish') {$user_can_see_a_post=true;}
     838    if (get_post($post_id)->post_status == 'publish') { $user_can_see_a_post=true; }
     839   
    808840    else {
    809841        //Display all to admins
    810         if (user_can($user_id,'edit_users')) {$user_can_see_a_post=true;}
     842        if (user_can($uid,'edit_users')) {$user_can_see_a_post=true; }
    811843        else {
    812844            //Get current user and his/her permissions
    813             $user_permissions = get_user_meta($user_id,'wp_jv_user_rg',true);
     845            $user_permissions = get_user_meta($uid,'wp_jv_user_rg',true);           
    814846            if (!is_array($user_permissions)) {
    815847                $user_permissions=str_split($user_permissions);
    816848            }
     849           
    817850            //if current user has any kind of permission...             
    818851            if ($user_permissions) {   
     
    824857                //If post permissions set AND current user has appropriate permissions add this post to the list of posts to show               
    825858                $this_user_can_see_this_post=array_intersect($user_permissions, $post_permitted);
     859               
    826860                if (!empty($user_permissions) && !empty($this_user_can_see_this_post)) {   
    827861                    $user_can_see_a_post=true;
     862                   
    828863                }
    829864            }       
Note: See TracChangeset for help on using the changeset viewer.