@@ -72,7 +72,7 @@ public function enqueue_styles($hook)
7272 wp_enqueue_style ("tooltipster " , plugin_dir_url (__FILE__ ) . "css/tooltipster.bundle.min.css " , false , "1.2 " , 'all ' );
7373 wp_enqueue_style ("tooltipster-noir " , plugin_dir_url (__FILE__ ) . "css/tooltipster-sideTip-noir.min.css " , false , "1.2 " , 'all ' );
7474 wp_enqueue_style ("admin " , plugin_dir_url (__FILE__ ) . "css/admin.css " , false , "1.2 " , 'all ' );
75- wp_enqueue_style ("chosen " , plugin_dir_url (__FILE__ ) . "css/chosen .min.css " , false , "1.2 " , 'all ' );
75+ wp_enqueue_style ("select2 " , plugin_dir_url (__FILE__ ) . "css/select2 .min.css " , false , "1.2 " , 'all ' );
7676 wp_enqueue_style ("smartWizard-dots " , plugin_dir_url (__FILE__ ) . "css/smart_wizard_dots.css " , false , "6.0.6 " , 'all ' );
7777 }
7878
@@ -90,13 +90,13 @@ public function enqueue_scripts($hook)
9090 wp_enqueue_script ('jquery-ui-tabs ' );
9191 wp_enqueue_script ('jquery-ui-accordion ' );
9292 wp_enqueue_script ('jquery-ui-dialog ' );
93- wp_enqueue_script ("bmlt_meeting_list " , plugin_dir_url (__FILE__ ) . "js/bmlt_meeting_list.js " , array ('jquery ' ), " 2.8.0 " , true );
93+ wp_enqueue_script ("bmlt_meeting_list " , plugin_dir_url (__FILE__ ) . "js/bmlt_meeting_list.js " , array ('jquery ' ), BREAD_VERSION , true );
9494 wp_enqueue_script ("tooltipster " , plugin_dir_url (__FILE__ ) . "js/tooltipster.bundle.min.js " , array ('jquery ' ), "1.2 " , true );
9595 wp_enqueue_script ("spectrum " , plugin_dir_url (__FILE__ ) . "js/spectrum.min.js " , array ('jquery ' ), "1.2 " , true );
96- wp_enqueue_script ("chosen " , plugin_dir_url (__FILE__ ) . "js/chosen.jquery .min.js " , array ('jquery ' ), "1.2 " , true );
96+ wp_enqueue_script ("select2 " , plugin_dir_url (__FILE__ ) . "js/select2 .min.js " , array ('jquery ' ), "1.2 " , true );
9797 wp_enqueue_script ("fetch-jsonp " , plugin_dir_url (__FILE__ ) . "js/fetch-jsonp.js " , array ('jquery ' ), "1.30 " , true );
9898 wp_enqueue_script ("smartWizard " , plugin_dir_url (__FILE__ ) . "js/jquery.smartWizard.js " , array ('jquery ' ), "6.0.6 " , true );
99- wp_enqueue_script ("breadWizard " , plugin_dir_url (__FILE__ ) . "js/bread-wizard.js " , array ('smartWizard ' ), " 2.8.0 " , true );
99+ wp_enqueue_script ("breadWizard " , plugin_dir_url (__FILE__ ) . "js/bread-wizard.js " , array ('smartWizard ' ), BREAD_VERSION , true );
100100 /**
101101 * Make some JSON from PHP available in JS.
102102 */
@@ -249,9 +249,6 @@ function pwsix_process_settings_export()
249249 if (!isset ($ _POST ['pwsix_export_nonce ' ]) || ! wp_verify_nonce ($ _POST ['pwsix_export_nonce ' ], 'pwsix_export_nonce ' )) {
250250 return ;
251251 }
252- if (! current_user_can ('manage_bread ' )) { // TODO: Is this necessary? Why not let the user make a copy
253- return ;
254- }
255252 $ this ->download_settings_inner ();
256253 }
257254 function download_settings ()
@@ -318,13 +315,13 @@ function exportLogFile($file)
318315 }
319316 function current_user_can_modify ()
320317 {
321- if (! current_user_can ('manage_bread ' )) {
322- return false ;
323- }
324318 $ user = wp_get_current_user ();
325319 if (in_array ('administrator ' , $ user ->roles )) {
326320 return true ;
327321 }
322+ if (! current_user_can ('manage_bread ' )) {
323+ return false ;
324+ }
328325 $ authors_safe = $ this ->bread ->getOption ('authors ' );
329326 if (!is_array ($ authors_safe ) || empty ($ authors_safe )) {
330327 return true ;
@@ -336,10 +333,17 @@ function current_user_can_modify()
336333 }
337334 function current_user_can_create ()
338335 {
339- if (! current_user_can ('manage_bread ' )) {
340- return false ;
336+ $ user = wp_get_current_user ();
337+ if (in_array ('administrator ' , $ user ->roles )) {
338+ return true ;
339+ }
340+ if (current_user_can ('manage_options ' )) {
341+ return true ;
342+ }
343+ if (current_user_can ('manage_bread ' )) {
344+ return true ;
341345 }
342- return true ;
346+ return false ;
343347 }
344348 /**
345349 * Process a settings import from a json file
@@ -349,7 +353,7 @@ function pwsix_process_settings_import()
349353 if (empty ($ _REQUEST ['pwsix_import_nonce ' ]) || !wp_verify_nonce ($ _REQUEST ['pwsix_import_nonce ' ], 'pwsix_import_nonce ' )) {
350354 return ;
351355 }
352- if (! current_user_can ( ' manage_bread ' )) {
356+ if (! $ this -> current_user_can_modify ( )) {
353357 return ;
354358 }
355359 $ this ->bread ->getConfigurationForSettingId ($ this ->bread ->getRequestedSetting ());
@@ -377,7 +381,7 @@ function pwsix_process_settings_import()
377381 update_option ($ this ->bread ->getOptionsName (), $ this ->bread ->getOptions ());
378382 setcookie ('current-meeting-list ' , $ this ->bread ->getRequestedSetting (), time () + 10 );
379383 setcookie ('bread_import_file ' , $ import_file , time () + 10 );
380- wp_safe_redirect (admin_url ('?page=class-bread-admin.php ' ));
384+ wp_safe_redirect (admin_url ('?page=bmlt-enabled-bread ' ));
381385 }
382386 function my_theme_add_editor_styles ()
383387 {
@@ -434,11 +438,15 @@ function admin_submenu_link($parent_slug)
434438 Bread_activate ();
435439 $ this ->bmltEnabled_admin ->createMenu ();
436440
441+ $ cap = 'manage_options ' ;
442+ if (!current_user_can ($ cap )) {
443+ $ cap = 'manage_bread ' ;
444+ }
437445 $ this ->hook = add_submenu_page (
438446 $ parent_slug ,
439447 'Printable Meeting Lists ' ,
440448 'Printable Meeting Lists ' ,
441- ' manage_bread ' ,
449+ $ cap ,
442450 'bmlt-enabled-bread ' ,
443451 array (&$ this , 'admin_options_page ' ),
444452 2
0 commit comments