PluginProbe
Taskbuilder – Project Management & Task Management Tool With Kanban Board / 6.0.7
Taskbuilder – Project Management & Task Management Tool With Kanban Board v6.0.7
6.0.7 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 All 59 releases
← All changes | includes/admin/projects/wppm_open_project.php +58 -35 5.0.6 → 6.0.7 View file →
@@ -17,9 +17,11 @@
17 17 $wppm_deafault_time_duration_project = get_option('wppm_display_time_duration_project');
18 18 $current_date = wp_date('Y-m-d');
19 19 $id = isset($_POST) && isset($_POST['id']) ? absint(sanitize_text_field(wp_unslash($_POST['id']))) : 0;
20 20 if (!isset($id)) {exit;}
21 -$auth_id = $wppmfunction->get_project_meta($id,'project_auth_code',true);
21 +$wppm_can_create_project = ($current_user->has_cap('manage_options')) || $wppm_current_user_capability == 'wppm_manager'|| $wppm_current_user_capability == 'wppm_admin';
22 +$wppm_can_create_project = apply_filters( 'wppm_can_create_project', $wppm_can_create_project, $current_user->ID, $id );
23 +$auth_id = $wppmfunction->get_project_fields($id,'project_auth_code',true);
22 24 $auth_id = sanitize_text_field($auth_id);
23 25 $project = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}wppm_project where id = %d",$id));
24 26 $orderby_sql = (sanitize_sql_orderby("create_time DESC"));
25 27 // url authentication.
@@ -38,10 +40,19 @@
38 40 $users = "";
39 41 }
40 42 $wppm_users_role = get_option('wppm_user_role');
41 43 $current_user_role='';
42 -if(in_array($current_user->ID,$users)){
43 - $current_user_role = $wpdb->get_var($wpdb->prepare("SELECT role_id FROM {$wpdb->prefix}wppm_project_users WHERE proj_id = %d AND user_id = %d",$id,$current_user->ID));
44 +if ( ! empty( $users ) && in_array( $current_user->ID, $users, true ) ) {
45 + $current_user_role = $wpdb->get_var(
46 + $wpdb->prepare(
47 + "SELECT role_id
48 + FROM {$wpdb->prefix}wppm_project_users
49 + WHERE proj_id = %d
50 + AND user_id = %d",
51 + $id,
52 + $current_user->ID
53 + )
54 + );
44 55 }
45 56 if(isset($project->status)){
46 57 $projstatus = absint($project->status);
47 58 $project_status = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}wppm_project_statuses where id = %d",$projstatus));
@@ -147,18 +158,24 @@
147 158 <div style="align-item:center;" ><h6><?php esc_attr_e( 'Unauthorized access!', 'taskbuilder' ); ?></h6></div>
148 159 <?php
149 160 wp_die();
150 161 }
151 -
162 +if( $wppm_current_user_capability == 'wppm_admin' || $current_user->has_cap('manage_options') || $project_data['created_by']==$current_user->ID){
163 + $archive_style= "display:inline;";
164 +}else{
165 + $archive_style= "display:none;";
166 +}
152 167 ?>
153 168 <form id="wppm_open_project" method="post">
154 169 <div class="row">
155 170 <div class="col-sm-12">
156 171 <span class="wppm-heading-inline"><?php echo esc_html_e('Project','taskbuilder');?></span>
157 - <?php if($current_user->has_cap('manage_options') || $wppm_current_user_capability == 'wppm_manager'|| $wppm_current_user_capability == 'wppm_admin'){ ?>
172 + <?php if($wppm_can_create_project){ ?>
158 173 <span class="wppm-add-new-btn btn-primary" style="background-color:<?php echo esc_attr($appearance_settings['menu-button-bg-color'])?>;color:<?php echo esc_attr($appearance_settings['menu-button-text-color'])?>" id="wppm_add_new_project_btn" onclick="wppm_add_new_project()"><span style="margin-right:5px;"><img id="wppm_add_new_project_icon" src="<?php echo esc_url( WPPM_PLUGIN_URL . 'asset/images/plus_icon.svg'); ?>" alt="plus_icon"></span><span><?php echo esc_html_e('Add New','taskbuilder');?></span></span>
159 174 <?php } ?>
160 175 <span class="wppm-add-new-btn btn-primary" id="wppm_project_list" style="background-color:<?php echo esc_attr($appearance_settings['menu-button-bg-color'])?>;color:<?php echo esc_attr($appearance_settings['menu-button-text-color'])?>" onclick="wppm_get_project_list()" ><span style="margin-right:5px;"><img id ="wppm_project_list_icon" src="<?php echo esc_url( WPPM_PLUGIN_URL . 'asset/images/list-symbol.svg'); ?>" alt="list-symbol"></span><span><?php echo esc_html_e('Project List','taskbuilder');?></span></span>
176 + <span class="wppm-add-new-btn btn-primary"" id="wppm_archieve_project_btn" title="<?php echo ($project->is_archived==1 ) ? 'Restore Project' : 'Archive Project'; ?>" onclick="wppm_archive_project(<?php echo esc_attr($project->id) ?>,<?php echo esc_attr($project->is_archived) ?>)" style="<?php echo esc_attr($archive_style) ?>"><img src="<?php echo esc_url( WPPM_PLUGIN_URL . 'asset/images/archive_project.svg'); ?>" alt="archive"><span style="margin-left:5px;"><?php echo ($project->is_archived==1 ) ? esc_html_e('Restore Project','taskbuilder') : esc_html_e('Archive Project','taskbuilder');?></span></span>
177 + <input type="hidden" name="wppm_archive_project_ajax_nonce" id="wppm_archive_project_ajax_nonce" value="<?php echo esc_attr( wp_create_nonce( 'wppm_archive_project_ajax_nonce' ) ); ?>">
161 178 <!-- Dashboard Button -->
162 179 <a class="wppm-add-new-btn btn-primary" style="background-color:<?php echo esc_attr($appearance_settings['menu-button-bg-color'])?>;color:<?php echo esc_attr($appearance_settings['menu-button-text-color'])?>" href="<?php echo esc_url( admin_url('admin.php?page=wppm-dashboard') ); ?>">
163 180 <img src="<?php echo esc_url( WPPM_PLUGIN_URL . 'asset/images/dashboard.svg'); ?>" alt="dashboard_icon">
164 181 <?php esc_html_e('Dashboard','taskbuilder'); ?>
@@ -168,10 +185,12 @@
168 185 <?php $style = (($current_user->ID && $current_user->has_cap('manage_options')) || ($wppmfunction->has_project_permission('delete_project',$project->id)) || ($project->created_by==$current_user->ID && $wppm_current_user_capability == 'wppm_manager') || ($current_user->ID && $current_user->has_cap('wppm_admin')))? "display:inline":"display:none"; ?>
169 186 <span class="wppm-add-new-btn btn-primary" id="wppm_delete_project_btn" style="background-color:<?php echo esc_attr($appearance_settings['menu-button-bg-color'])?>;color:<?php echo esc_attr($appearance_settings['menu-button-text-color'])?>;<?php echo esc_attr($style) ?>" onclick="wppm_delete_project(<?php echo esc_attr($id) ?>)"><span style="margin-right:5px;"><img id="wppm_delete_project_icon" src="<?php echo esc_url( WPPM_PLUGIN_URL . 'asset/images/delete2.svg'); ?>" alt="delete"></span><span><?php echo esc_html_e('Delete','taskbuilder');?></span></span>
170 187 <?php $visibility_style = (($current_user->ID && ($current_user->has_cap('manage_options') || $current_user->has_cap('wppm_admin') || ($project->created_by==$current_user->ID && $wppm_current_user_capability == 'wppm_manager'))) && ($wppm_public_projects_permission==1))? "display:inline":"display:none"; ?>
171 188 <span class="wppm-add-new-btn btn-primary" id="wppm_project_visibility" style="background-color:<?php echo esc_attr($appearance_settings['menu-button-bg-color'])?>;color:<?php echo esc_attr($appearance_settings['menu-button-text-color'])?>;<?php echo esc_attr($visibility_style) ?>" onclick="wppm_get_project_visibility(<?php echo esc_attr($id) ?>)"><span style="margin-right:5px;"><img id ="wppm_task_list_icon" src="<?php echo esc_url( WPPM_PLUGIN_URL . 'asset/images/wppm_visibility.svg'); ?>" alt="project_visibility"></span><span><?php echo esc_html_e('Project Visibility','taskbuilder');?></span></span>
172 - <?php do_action('wppm_after_open_project_buttons',$project->id);?>
173 - </div>
189 + <?php do_action('wppm_after_open_project_buttons',$project->id); ?>
190 + <?php foreach ( wppm_get_locked_pro_addons_by_placement('toolbar') as $wppm_addon_key => $wppm_addon ) : ?>
191 + <a class="wppm-add-new-btn btn-primary wppm-locked-toolbar-btn" style="background-color:<?php echo esc_attr($appearance_settings['menu-button-bg-color'])?>;color:<?php echo esc_attr($appearance_settings['menu-button-text-color'])?>" href="<?php echo esc_url( wppm_pro_upgrade_url() ); ?>" target="_blank" rel="noopener noreferrer" title="<?php echo esc_attr( sprintf( __( '%s is a Pro feature. Click to upgrade.', 'taskbuilder' ), $wppm_addon['label'] ) ); ?>"><span class="wppm-pro-icon-wrap" style="margin-right:5px;"><img src="<?php echo esc_url( WPPM_PLUGIN_URL . 'asset/images/' . $wppm_addon['icon'] ); ?>" alt=""><span class="wppm-pro-badge-corner"><?php echo wppm_pro_badge_svg( 11 ); ?></span></span><span><?php echo esc_html( $wppm_addon['label'] ); ?></span></a>
192 + <?php endforeach; ?>
174 193 </div>
175 194 <div id="wppm_load_individual_project_container" class="row">
176 195 <div class="col-sm-8 wppm_body col-md-9">
177 196 <div class="row">
@@ -178,9 +197,10 @@
178 197 <div class="col-sm-12" id="wppm_project_details_container">
179 198 <div class="row">
180 199 <div class="col-sm-12">
181 200 <span class="wppm_project_label"> <?php echo isset($project->project_name) ? esc_html($project->project_name):"";
182 - if (($wppmfunction->has_project_permission('change_project_details',$id)) || ($current_user->has_cap('manage_options') || $current_user->has_cap('wppm_admin') || ($project->created_by==$current_user->ID && $wppm_current_user_capability == 'wppm_manager'))) { ?>
201 + if ((($wppmfunction->has_project_permission('change_project_details',$id)) || ($current_user->has_cap('manage_options') || $current_user->has_cap('wppm_admin') || ($project->created_by==$current_user->ID && $wppm_current_user_capability == 'wppm_manager'))) && $project_data['is_archived']!=1) {
202 + ?>
183 203 <span id="wppm_individual_edit_project_subject" onclick="wppm_edit_proj_details(<?php echo esc_attr($id) ?>)" class="btn btn-sm wppm_action_btn" style="background-color:#FFFFFF !important;color:#000000 !important;"><img src="<?php echo esc_url( WPPM_PLUGIN_URL . 'asset/images/edit_01.svg'); ?>" alt="edit"></span>
184 204 <?php } ?>
185 205 </span>
186 206 </div>
@@ -267,12 +287,13 @@
267 287 ?>
268 288 <div class="col-sm-9 wppm_project_description">
269 289 <span><?php echo (!empty($project_description))? wp_kses(wpautop($project_description),$allowedtags):"" ?></span>
270 290 </div>
291 + <?php do_action('wppm_after_project_details_in_open_project',$project->id);?>
271 292 </div>
272 293 </div>
273 294 </div>
274 - <div id="wppm_proj_discussion_container" style="<?php echo ($wppm_proj_hide_comment_section==0 || $current_user_role==3) ? 'display:none;' : 'display:block;' ?>">
295 + <div id="wppm_proj_discussion_container" style="<?php echo ($wppm_proj_hide_comment_section==0 || $current_user_role==3|| $project_data['is_archived']==1) ? 'display:none;' : 'display:block;' ?>">
275 296 <div class="row">
276 297 <div class="col-sm-12" style="margin-top:5px;">
277 298 <span class="wppm_proj_discussion"><?php echo esc_html_e('Comment','taskbuilder')?></span><br>
278 299 </div>
@@ -300,9 +321,9 @@
300 321 <div class="wppm_proj_attachment_container col-sm-12" style="display:none;">
301 322 </div>
302 323 </div>
303 324 </div>
304 - <div class="wppm_thread_container" style="<?php echo ($wppm_proj_hide_comment_section==0 || $current_user_role==3) ? 'display:none;' : 'display:block;' ?>">
325 + <div class="wppm_thread_container" style="<?php echo ($wppm_proj_hide_comment_section==0 || $current_user_role==3 || $project_data['is_archived']==1) ? 'display:none;' : 'display:block;' ?>">
305 326 <?php
306 327 if(!empty($project_comment)){
307 328 foreach($project_comment as $comment){
308 329 $proj_comment_meta = $wpdb->get_row( "SELECT * FROM {$wpdb->prefix}wppm_project_comment_meta where proj_id='".esc_sql($id)."' AND comment_id='".esc_sql($comment->id)."'");
@@ -464,9 +485,9 @@
464 485 <div class="wppm_individual_project_widget col-sm-4 wppm_sidebar col-md-3">
465 486 <div class="row wppm_widget" id="wppm_project_status_widget">
466 487 <div class="wppm-widget-header" style="background-color:<?php echo esc_attr($appearance_settings['widget-header-bg-color'])?>">
467 488 <h4 class="widget_header" style="color:<?php echo esc_attr($appearance_settings['widget-header-text-color'])?>"><?php echo esc_html_e('Status','taskbuilder')?></h4>
468 - <?php $style = ($wppmfunction->has_project_permission('change_project_status',$id) || $current_user->has_cap('manage_options') || ($project->created_by==$current_user->ID && $wppm_current_user_capability == 'wppm_manager') || $wppm_current_user_capability == 'wppm_admin')? "display:flex":"display:none"; ?>
489 + <?php $style = (($wppmfunction->has_project_permission('change_project_status',$id) || $current_user->has_cap('manage_options') || ($project->created_by==$current_user->ID && $wppm_current_user_capability == 'wppm_manager') || $wppm_current_user_capability == 'wppm_admin') && $project_data['is_archived']!=1)? "display:flex":"display:none"; ?>
469 490 <span class="wppm_edit_project_details_widget" style="<?php echo esc_attr($style) ?>" onclick="wppm_edit_project_status(<?php echo esc_attr($id) ?>)"><img src="<?php echo esc_url( WPPM_PLUGIN_URL . 'asset/images/edit_01.svg'); ?>" alt="edit"></span>
470 491 </div>
471 492 <hr class="widget_divider">
472 493 <div class="wppm-widget-body" style="background-color:<?php echo esc_attr($appearance_settings['widget-body-bg-color'])?>">
@@ -475,9 +496,9 @@
475 496 </div>
476 497 <div class="row wppm_widget" id="wppm_project_raisedby_widget">
477 498 <div class="wppm-widget-header" style="background-color:<?php echo esc_attr($appearance_settings['widget-header-bg-color'])?>">
478 499 <h4 class="widget_header" style="color:<?php echo esc_attr($appearance_settings['widget-header-text-color'])?>"><?php echo esc_html_e('Project Creator','taskbuilder')?></span></h4>
479 - <?php if ($current_user->has_cap('manage_options') || $wppm_current_user_capability == 'wppm_admin'|| ($project->created_by==$current_user->ID && $wppm_current_user_capability == 'wppm_manager')) { ?>
500 + <?php if (($current_user->has_cap('manage_options') || $wppm_current_user_capability == 'wppm_admin'|| ($project->created_by==$current_user->ID && $wppm_current_user_capability == 'wppm_manager')) && $project_data['is_archived']!=1) { ?>
480 501 <span class="wppm_edit_project_details_widget" onclick="wppm_edit_project_creator(<?php echo esc_attr($id) ?>)"><img src="<?php echo esc_url( WPPM_PLUGIN_URL . 'asset/images/edit_01.svg'); ?>" alt="edit"></span>
481 502 <?php } ?>
482 503 </div>
483 504 <hr class="widget_divider"> <?php
@@ -498,9 +519,9 @@
498 519 </div>
499 520 <div class="row wppm_widget" id="wppm_project_users_widget_container">
500 521 <div class="wppm-widget-header" style="background-color:<?php echo esc_attr($appearance_settings['widget-header-bg-color'])?>">
501 522 <h4 class="widget_header" style="color:<?php echo esc_attr($appearance_settings['widget-header-text-color'])?>"><?php echo esc_html_e('Users','taskbuilder')?></h4>
502 - <?php if ($wppmfunction->has_project_permission('assign_project_users',$id ) || $current_user->has_cap('manage_options') || ($project->created_by==$current_user->ID && $wppm_current_user_capability == 'wppm_manager') || $wppm_current_user_capability == 'wppm_admin') { ?>
523 + <?php if (($wppmfunction->has_project_permission('assign_project_users',$id ) || $current_user->has_cap('manage_options') || ($project->created_by==$current_user->ID && $wppm_current_user_capability == 'wppm_manager') || $wppm_current_user_capability == 'wppm_admin') && $project_data['is_archived']!=1) { ?>
503 524 <span class="wppm_edit_project_details_widget" onclick="wppm_get_users(<?php echo esc_attr($id) ?>)"><img src="<?php echo esc_url( WPPM_PLUGIN_URL . 'asset/images/edit_01.svg'); ?>" alt="edit"></span>
504 525 <?php } ?>
505 526 </div>
506 527 <hr class="widget_divider">
@@ -506,34 +527,36 @@
506 527 <hr class="widget_divider">
507 528 <div class="wppm-widget-body" style="background-color:<?php echo esc_attr($appearance_settings['widget-body-bg-color'])?>">
508 529 <div id="wppm_project_users">
509 530 <?php
510 - if(!(empty(array_filter($users)))){
511 - foreach($users as $user) {
512 - $user_data = get_userdata($user);
513 - $user = absint($user);
514 - $project_user = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}wppm_project_users WHERE proj_id = %d AND user_id = %d",$id,$user));
515 - ?>
516 - <div style="padding:2px 0;">
517 - <span class="wppm_project_user_avatar"><?php echo (get_avatar($user, 25, "mysteryman")); ?></span>
518 - <span class="wppm_project_user_names" style="color:<?php echo esc_attr($appearance_settings['widget-header-text-color'])?>"><?php echo esc_html($user_data->display_name); ?></span>
519 - <?php
520 - if(!empty($wppm_users_role)){
521 - foreach($wppm_users_role as $key=>$role){
522 - if(!empty($role)){
523 - foreach($role as $k=>$val){
524 - if( !empty($project_user) && $key == $project_user->role_id){ ?>
525 - <span class="wppm_project_user_role" style="color:<?php echo esc_attr($appearance_settings['widget-body-text-color'])?>">(<?php echo esc_html($role['label']); ?>)</span><?php
531 + if(!empty($users)){
532 + if(!(empty(array_filter($users)))){
533 + foreach($users as $user) {
534 + $user_data = get_userdata($user);
535 + $user = absint($user);
536 + $project_user = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}wppm_project_users WHERE proj_id = %d AND user_id = %d",$id,$user));
537 + ?>
538 + <div style="padding:2px 0;">
539 + <span class="wppm_project_user_avatar"><?php echo (get_avatar($user, 25, "mysteryman")); ?></span>
540 + <span class="wppm_project_user_names" style="color:<?php echo esc_attr($appearance_settings['widget-header-text-color'])?>"><?php echo esc_html($user_data->display_name); ?></span>
541 + <?php
542 + if(!empty($wppm_users_role)){
543 + foreach($wppm_users_role as $key=>$role){
544 + if(!empty($role)){
545 + foreach($role as $k=>$val){
546 + if( !empty($project_user) && $key == $project_user->role_id){ ?>
547 + <span class="wppm_project_user_role" style="color:<?php echo esc_attr($appearance_settings['widget-body-text-color'])?>">(<?php echo esc_html($role['label']); ?>)</span><?php
548 + }
526 549 }
527 550 }
528 551 }
529 552 }
530 - }
531 - ?>
532 - </div>
533 - <?php
534 - }
535 - } else {
553 + ?>
554 + </div>
555 + <?php
556 + }
557 + }
558 + }else {
536 559 ?><span class="wppm_project_users_not_assign_label" style="color:<?php echo esc_attr($appearance_settings['widget-body-text-color'])?>"> <?php echo esc_html_e('None','taskbuilder'); ?></span><?php
537 560 }
538 561 ?>
539 562 </div>