← All changes
|
includes/admin/projects/open_project/wppm_get_project_visibility.php
+46
-46
5.0.7
→
6.0.7
View file →
| @@ -1,47 +1,47 @@ | ||
| 1 | -<?php | |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | - exit; // Exit if accessed directly | |
| 4 | -} | |
| 5 | -global $current_user,$wpdb,$wppmfunction; | |
| 6 | -$project_id = isset($_POST['id']) ? absint(sanitize_text_field(wp_unslash($_POST['id']))) : '' ; | |
| 7 | -$project = $wppmfunction->get_project($project_id); | |
| 8 | -$wppm_current_user_capability = get_user_meta( $current_user->ID, 'wppm_capability', true ); | |
| 9 | -$public_project=$wppmfunction->get_project_meta($project_id,'public_project',true); | |
| 10 | -if (!(($current_user->ID && $current_user->has_cap('manage_options')) || ($current_user->ID && $current_user->has_cap('wppm_admin')) || ($project['created_by']==$current_user->ID && $wppm_current_user_capability == 'wppm_manager'))) {exit;} | |
| 11 | -ob_start(); | |
| 12 | -?> | |
| 13 | -<div class="row"> | |
| 14 | - <div class="col-sm-12"> | |
| 15 | - <span> | |
| 16 | - <label><?php echo esc_html_e('Change Project visibility','taskbuilder');?></label> | |
| 17 | - </span><br> | |
| 18 | - <input type="checkbox" name="wppm_project_visibility_option" style="margin-top: 0px;" value="0" <?php echo ((esc_attr($public_project))==0 || (esc_attr($public_project)=="")) ?'checked="checked"':'';?> onchange="wppm_select_project_visibility(<?php echo esc_attr($project_id) ?>)"> | |
| 19 | - <span style="padding-left: 10px;"><?php echo esc_html_e('Private','taskbuilder');?></span> | |
| 20 | - <br> | |
| 21 | - <input type="checkbox" name="wppm_project_visibility_option" style="margin-top: 0px;" value="1" <?php echo ((esc_attr($public_project))==1) ?'checked="checked"':'';?> onchange="wppm_select_project_visibility(<?php echo esc_attr($project_id) ?>)"> | |
| 22 | - <span style="padding-left: 10px;"><?php echo esc_html_e('Public','taskbuilder');?></span> | |
| 23 | - <br> | |
| 24 | - </div> | |
| 25 | -</div> | |
| 26 | -<input type="hidden" name="wppm_proj_visibility_ajax_nonce" id="wppm_proj_visibility_ajax_nonce" value="<?php echo esc_attr( wp_create_nonce( 'wppm_change_project_visibility' ) ); ?>"> | |
| 27 | -<script> | |
| 28 | -jQuery(document).ready(function(){ | |
| 29 | - jQuery('input:checkbox').click(function() { | |
| 30 | - jQuery('input:checkbox').not(this).prop('checked', false); | |
| 31 | - }); | |
| 32 | -}); | |
| 33 | -<?php | |
| 34 | -$body = ob_get_clean(); | |
| 35 | -ob_start(); | |
| 36 | -?> | |
| 37 | -<button type="button" class="btn wppm_popup_close" onclick="wppm_modal_close();"><?php echo esc_html_e('Close','taskbuilder');?></button> | |
| 38 | -<?php | |
| 39 | - | |
| 40 | -$footer = ob_get_clean(); | |
| 41 | - | |
| 42 | -$response = array( | |
| 43 | - 'body' => $body, | |
| 44 | - 'footer' => $footer | |
| 45 | -); | |
| 46 | - | |
| 1 | +<?php | |
| 2 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | + exit; // Exit if accessed directly | |
| 4 | +} | |
| 5 | +global $current_user,$wpdb,$wppmfunction; | |
| 6 | +$project_id = isset($_POST['id']) ? absint(sanitize_text_field(wp_unslash($_POST['id']))) : '' ; | |
| 7 | +$project = $wppmfunction->get_project($project_id); | |
| 8 | +$wppm_current_user_capability = get_user_meta( $current_user->ID, 'wppm_capability', true ); | |
| 9 | +$public_project=$wppmfunction->get_project_meta($project_id,'public_project',true); | |
| 10 | +if (!(($current_user->ID && $current_user->has_cap('manage_options')) || ($current_user->ID && $current_user->has_cap('wppm_admin')) || ($project['created_by']==$current_user->ID && $wppm_current_user_capability == 'wppm_manager'))) {exit;} | |
| 11 | +ob_start(); | |
| 12 | +?> | |
| 13 | +<div class="row"> | |
| 14 | + <div class="col-sm-12"> | |
| 15 | + <span> | |
| 16 | + <label><?php echo esc_html_e('Change Project visibility','taskbuilder');?></label> | |
| 17 | + </span><br> | |
| 18 | + <input type="checkbox" name="wppm_project_visibility_option" style="margin-top: 0px;" value="0" <?php echo ((esc_attr($public_project))==0 || (esc_attr($public_project)=="")) ?'checked="checked"':'';?> onchange="wppm_select_project_visibility(<?php echo esc_attr($project_id) ?>)"> | |
| 19 | + <span style="padding-left: 10px;"><?php echo esc_html_e('Private','taskbuilder');?></span> | |
| 20 | + <br> | |
| 21 | + <input type="checkbox" name="wppm_project_visibility_option" style="margin-top: 0px;" value="1" <?php echo ((esc_attr($public_project))==1) ?'checked="checked"':'';?> onchange="wppm_select_project_visibility(<?php echo esc_attr($project_id) ?>)"> | |
| 22 | + <span style="padding-left: 10px;"><?php echo esc_html_e('Public','taskbuilder');?></span> | |
| 23 | + <br> | |
| 24 | + </div> | |
| 25 | +</div> | |
| 26 | +<input type="hidden" name="wppm_proj_visibility_ajax_nonce" id="wppm_proj_visibility_ajax_nonce" value="<?php echo esc_attr( wp_create_nonce( 'wppm_change_project_visibility' ) ); ?>"> | |
| 27 | +<script> | |
| 28 | +jQuery(document).ready(function(){ | |
| 29 | + jQuery('input:checkbox').click(function() { | |
| 30 | + jQuery('input:checkbox').not(this).prop('checked', false); | |
| 31 | + }); | |
| 32 | +}); | |
| 33 | +<?php | |
| 34 | +$body = ob_get_clean(); | |
| 35 | +ob_start(); | |
| 36 | +?> | |
| 37 | +<button type="button" class="btn wppm_popup_close" onclick="wppm_modal_close();"><?php echo esc_html_e('Close','taskbuilder');?></button> | |
| 38 | +<?php | |
| 39 | + | |
| 40 | +$footer = ob_get_clean(); | |
| 41 | + | |
| 42 | +$response = array( | |
| 43 | + 'body' => $body, | |
| 44 | + 'footer' => $footer | |
| 45 | +); | |
| 46 | + | |
| 47 | 47 | echo wp_json_encode($response); |