woooccm_restrict_manage_posts

The WooCommerce Checkout Manager woooccm restrict manage posts function.

Description

woooccm_restrict_manage_posts(); 

Usage

  1. if ( !function_exists( 'woooccm_restrict_manage_posts' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-checkout-manager/includes/classes/main.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = woooccm_restrict_manage_posts(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/classes/main.php  
  1. function woooccm_restrict_manage_posts() { 
  2. $options = get_option( 'wccs_settings' ); 
  3. $options2 = get_option( 'wccs_settings2' ); 
  4. $options3 = get_option( 'wccs_settings3' ); 
  5. $billing = array( 'country', 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode', 'email', 'phone' ); 
  6. $shipping = array( 'country', 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode' ); 
  7.  
  8. if ( get_current_screen()->post_type == 'shop_order' ) { 
  9.  
  10. foreach($options['buttons'] as $name) { 
  11. $values[$name['label']] = $name['cow']; 
  12. if( !empty($values) ) { 
  13. array_unique($values); 
  14.  
  15. foreach($options2['shipping_buttons'] as $name) { 
  16. if( !in_array($name['cow'], $shipping)) { 
  17. $values2['Shipping '.$name['label']] = '_shipping_'.$name['cow']; 
  18. if( !empty($values2) ) { 
  19. array_unique($values2); 
  20.  
  21. foreach($options3['billing_buttons'] as $name) { 
  22. if( !in_array($name['cow'], $billing)) { 
  23. $values3['Billing '.$name['label']] = '_billing_'.$name['cow']; 
  24. if( !empty($values3) ) { 
  25. array_unique($values3); 
  26.  
  27. if( !empty($values) && !empty($values2) && !empty($values3) ) { 
  28. $values = array_merge($values, $values2); 
  29. $values = array_merge($values, $values3); 
  30. } elseif( !empty($values) && !empty($values2) && empty($values3) ) { 
  31. $values = array_merge($values, $values2); 
  32. }elseif( !empty($values) && empty($values2) && !empty($values3) ) { 
  33. $values = array_merge($values, $values3); 
  34. }elseif( empty($values) && !empty($values2) && !empty($values3) ) { 
  35. $values = array_merge($values2, $values3); 
  36. }elseif( empty($values) && empty($values2) && !empty($values3) ) { 
  37. $values = $values3; 
  38. }elseif( empty($values) && !empty($values2) && empty($values3) ) { 
  39. $values = $values2; 
  40. }elseif( !empty($values) && empty($values2) && empty($values3) ) { 
  41. $values = $values; 
  42.  
  43.  
  44. ?> 
  45. <select name="wooccm_abbreviation"> 
  46. <?php 
  47. if( empty($values) && empty($values2) && empty($values3) ) { ?> 
  48. <option value=""><?php _e('No Added Fields', 'woocommerce-checkout-manager'); ?></option> 
  49. <?php }else { ?> 
  50. <option value=""><?php _e('Field Name', 'woocommerce-checkout-manager'); ?></option> 
  51. <?php } 
  52.  
  53. $current_v = isset($_GET['wooccm_abbreviation'])? $_GET['wooccm_abbreviation']:''; 
  54. foreach ($values as $label => $value) { 
  55. printf 
  56. '<option value="%s"%s>%s</option>',  
  57. $value,  
  58. $value == $current_v? ' selected="selected"':'',  
  59. $label 
  60. ); 
  61. ?> 
  62. </select> 
  63. <?php