Changeset 1394820
- Timestamp:
- 04/13/2016 10:27:19 PM (9 years ago)
- Location:
- wp-jv-post-reading-groups/trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
wp-jv-post-reading-groups/trunk/Readme.txt
r1307605 r1394820 4 4 Tags: access, login, permission, permissions, post, posts, privacy, private, restrict, simple, user, users, member, members, membership, page, pages 5 5 Requires at least: 3.9.2 6 Tested up to: 4. 47 Stable tag: 1. 76 Tested up to: 4.5 7 Stable tag: 1.8 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 59 59 60 60 == Changelog == 61 62 = 1.8 = 63 Release 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 61 67 62 68 = 1.7 = … … 158 164 159 165 * 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 = 168 Release 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 3 3 msgid "" 4 4 msgstr "" 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" 8 7 "POT-Creation-Date: 2015-12-13 17:32:38+00:00\n" 9 8 "MIME-Version: 1.0\n" 10 9 "Content-Type: text/plain; charset=UTF-8\n" 11 10 "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" 15 17 16 18 #: wp-jv-post-reading-groups.php:39 wp-jv-post-reading-groups.php:474 … … 102 104 #. Description of the plugin/theme 103 105 msgid "" 104 "Grant read-only permission for selected users (with no administrator role) "105 " on selectedprivate posts"106 "Grant read-only permission for selected users (with no administrator role) on selected " 107 "private posts" 106 108 msgstr "" 107 109 -
wp-jv-post-reading-groups/trunk/uninstall.php
r1307603 r1394820 4 4 * 5 5 * WP JV Post Reading Groups Settings Uninstaller 6 * @version 1. 76 * @version 1.8 7 7 */ 8 8 -
wp-jv-post-reading-groups/trunk/wp-jv-post-reading-groups.css
r1307603 r1394820 1 1 /* 2 2 // CSS for WP JV Post Reading Groups 3 // @version: 1. 73 // @version: 1.8 4 4 */ 5 5 -
wp-jv-post-reading-groups/trunk/wp-jv-post-reading-groups.js
r1307603 r1394820 1 1 /* 2 2 // Scripts for WP JV Post Reading Groups 3 // @version: 1. 73 // @version: 1.8 4 4 */ 5 5 … … 58 58 wp_jv_prg_refresh_rg_list(); 59 59 } 60 //Disable loading icon and enable button 61 $('#spnAddRG').hide(); 62 $('#btnAddNewRG').attr('disabled', false); 63 document.getElementById("jv-new-reading-group-text").value = ''; 60 64 }); 61 //Disable loading icon and enable button62 $('#spnAddRG').hide();63 $('#btnAddNewRG').attr('disabled', false);64 document.getElementById("jv-new-reading-group-text").value = '';65 65 }); 66 66 -
wp-jv-post-reading-groups/trunk/wp-jv-post-reading-groups.min.js
r1307603 r1394820 1 1 /* 2 2 // Scripts for WP JV Post Reading Groups 3 // @version: 1. 73 // @version: 1.8 4 4 */ 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()})})});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(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 4 4 * Plugin URI: http://janosver.com/projects/wordpress/wp-jv-post-reading-groups 5 5 * Description: Grant read-only permission for selected users (with no administrator role) on selected private posts 6 * Version: 1. 76 * Version: 1.8 7 7 * Author: Janos Ver 8 8 * Author URI: http://janosver.com … … 629 629 /************************************************************************************************************/ 630 630 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 639 function 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 } 652 add_filter('get_post_status','wp_jv_prg_post_status',10,2); 653 631 654 632 655 //Display private posts as well (only those for which user has permissions) … … 802 825 803 826 //add support for WP JV Custom Email Settings Plugin 804 function wp_jv_prg_user_can_see_a_post($user _id, $post_id) {827 function wp_jv_prg_user_can_see_a_post($user, $post_id) { 805 828 $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 806 837 //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 808 840 else { 809 841 //Display all to admins 810 if (user_can($u ser_id,'edit_users')) {$user_can_see_a_post=true;}842 if (user_can($uid,'edit_users')) {$user_can_see_a_post=true; } 811 843 else { 812 844 //Get current user and his/her permissions 813 $user_permissions = get_user_meta($u ser_id,'wp_jv_user_rg',true);845 $user_permissions = get_user_meta($uid,'wp_jv_user_rg',true); 814 846 if (!is_array($user_permissions)) { 815 847 $user_permissions=str_split($user_permissions); 816 848 } 849 817 850 //if current user has any kind of permission... 818 851 if ($user_permissions) { … … 824 857 //If post permissions set AND current user has appropriate permissions add this post to the list of posts to show 825 858 $this_user_can_see_this_post=array_intersect($user_permissions, $post_permitted); 859 826 860 if (!empty($user_permissions) && !empty($this_user_can_see_this_post)) { 827 861 $user_can_see_a_post=true; 862 828 863 } 829 864 }
Note: See TracChangeset
for help on using the changeset viewer.