PluginProbe
Taskbuilder – Project Management & Task Management Tool With Kanban Board / 5.0.9
Taskbuilder – Project Management & Task Management Tool With Kanban Board v5.0.9
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 1.0.6 All 57 releases
taskbuilder / includes / admin / projects / wppm_set_project_meta.php

wppm_set_project_meta.php in Taskbuilder – Project Management & Task Management Tool With Kanban Board 5.0.9, at includes/admin/projects/wppm_set_project_meta.php

40 lines 1.3 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 $wpdb,$wppmfunction,$current_user;
6 $project_id = intval(sanitize_text_field($project_id));
7 $project_data = $wppmfunction->get_project($project_id);
8 $users = explode(',',$project_data['users']);
9 $users = array_unique($users);
10 if(!empty($users)){
11 foreach($users as $user){
12 if(!empty($user)){
13 $user_role = sanitize_text_field(wp_unslash($_POST['wppm_select_user_role_'.$user]));
14 $project_user = $wpdb->get_row(
15 $wpdb->prepare(
16 "SELECT * FROM {$wpdb->prefix}wppm_project_users WHERE proj_id = %d AND user_id = %d",
17 absint($project_id),
18 absint($user)
19 )
20 );
21 if(!empty($project_user)){
22 $project_user_id = absint($project_user->id);
23 $values=array(
24 'role_id'=> absint($user_role),
25 'assigned_by'=>absint($current_user->ID)
26 );
27 $wpdb->update($wpdb->prefix.'wppm_project_users', $values, array('id'=>$project_user_id));
28 }else{
29 $wpdb->insert(
30 $wpdb->prefix . 'wppm_project_users',
31 array(
32 'proj_id' => absint($project_id),
33 'user_id' => absint($user),
34 'role_id' => absint($user_role),
35 'assigned_by' =>absint($current_user->ID)
36 ) );
37 }
38 }
39 }
40 }