PluginProbe
Taskbuilder – Project Management & Task Management Tool With Kanban Board / 6.0.6
Taskbuilder – Project Management & Task Management Tool With Kanban Board v6.0.6
6.0.6 6.0.5 6.0.2 6.0.3 6.0.4 6.0.1 6.0.0 5.0.8 5.0.9 4.0.9 5.0.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 All 58 releases
taskbuilder / includes / admin / projects / open_project / wppm_change_project_visibility.php

wppm_change_project_visibility.php in Taskbuilder – Project Management & Task Management Tool With Kanban Board 6.0.6, at includes/admin/projects/open_project/wppm_change_project_visibility.php

24 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit; // Exit if accessed directly
4 }
5 global $current_user,$wpdb,$wppmfunction;
6 if ( check_ajax_referer( 'wppm_change_project_visibility', '_ajax_nonce', false ) != 1 ) {
7 wp_send_json_error( 'Unauthorised request!', 401 );
8 }
9 $project_id = isset($_POST['project_id']) ? absint(sanitize_text_field(wp_unslash($_POST['project_id']))) : '' ;
10 $project = $wppmfunction->get_project($project_id);
11 $wppm_current_user_capability = get_user_meta( $current_user->ID, 'wppm_capability', true );
12 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;}
13 $wppm_project_visibility = isset($_POST['project_visibility']) ? sanitize_text_field(wp_unslash($_POST['project_visibility'])):"0";
14 $wppm_project_visibility = absint($wppm_project_visibility );
15 $id = $wpdb->get_var($wpdb->prepare("SELECT id FROM {$wpdb->prefix}wppm_project_meta WHERE project_id = %d AND meta_key ='public_project'", $project_id));
16 $id = absint($id);
17 if(empty($id )){
18 $wppmfunction->add_project_meta($project_id,'public_project',$wppm_project_visibility);
19 }elseif(!empty($id)){
20 $values = array(
21 'meta_value'=>$wppm_project_visibility
22 );
23 $wpdb->update($wpdb->prefix.'wppm_project_meta', $values,array('id'=>intval($id)));
24 }