UM_Admin_Functions

The Ultimate Member UM Admin Functions class.

Defined (1)

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

/admin/core/um-admin-functions.php  
  1. class UM_Admin_Functions { 
  2.  
  3. function __construct() { 
  4.  
  5. $this->slug = 'ultimatemember'; 
  6.  
  7. add_action('parent_file', array(&$this, 'parent_file'), 9); 
  8.  
  9. add_filter('gettext', array(&$this, 'gettext'), 10, 4); 
  10.  
  11. add_filter('post_updated_messages', array(&$this, 'post_updated_messages') ); 
  12.  
  13.  
  14. /*** 
  15. *** @updated post messages 
  16. ***/ 
  17. function post_updated_messages($messages) { 
  18. global $post, $post_ID; 
  19.  
  20. $post_type = get_post_type( $post_ID ); 
  21. if ($post_type == 'um_form') { 
  22.  
  23. $messages['um_form'] = array( 
  24. 0 => '',  
  25. 1 => __('Form updated.'),  
  26. 2 => __('Custom field updated.'),  
  27. 3 => __('Custom field deleted.'),  
  28. 4 => __('Form updated.'),  
  29. 5 => isset($_GET['revision']) ? __('Form restored to revision.') : false,  
  30. 6 => __('Form created.'),  
  31. 7 => __('Form saved.'),  
  32. 8 => __('Form submitted.'),  
  33. 9 => __('Form scheduled.'),  
  34. 10=> __('Form draft updated.'),  
  35. ); 
  36.  
  37.  
  38. if ($post_type == 'um_role') { 
  39.  
  40. $messages['um_role'] = array( 
  41. 0 => '',  
  42. 1 => __('Role updated.'),  
  43. 2 => __('Custom field updated.'),  
  44. 3 => __('Custom field deleted.'),  
  45. 4 => __('Role updated.'),  
  46. 5 => isset($_GET['revision']) ? __('Role restored to revision.') : false,  
  47. 6 => __('Role created.'),  
  48. 7 => __('Role saved.'),  
  49. 8 => __('Role submitted.'),  
  50. 9 => __('Role scheduled.'),  
  51. 10=> __('Role draft updated.'),  
  52. ); 
  53.  
  54.  
  55. return $messages; 
  56.  
  57. /*** 
  58. *** @check that we're on a custom post type supported by UM 
  59. ***/ 
  60. function is_plugin_post_type() { 
  61. if (isset($_REQUEST['post_type'])) { 
  62. $post_type = $_REQUEST['post_type']; 
  63. if ( in_array($post_type, array('um_form', 'um_role', 'um_directory'))) { 
  64. return true; 
  65. } else if ( isset($_REQUEST['action'] ) && $_REQUEST['action'] == 'edit') { 
  66. $post_type = get_post_type(); 
  67. if ( in_array($post_type, array('um_form', 'um_role', 'um_directory'))) { 
  68. return true; 
  69. return false; 
  70.  
  71. /*** 
  72. *** @gettext filters 
  73. ***/ 
  74. function gettext($translation, $text, $domain) { 
  75. global $post; 
  76. $screen = get_current_screen(); 
  77. if (isset($post->post_type) && $this->is_plugin_post_type() ) { 
  78. $translations = get_translations_for_domain( $domain); 
  79. if ( $text == 'Publish') { 
  80. return $translations->translate( 'Create' ); 
  81. if ( $text == 'Move to Trash') { 
  82. return $translations->translate( 'Delete' ); 
  83.  
  84. return $translation; 
  85.  
  86. /*** 
  87. *** @Fix parent file for correct highlighting 
  88. ***/ 
  89. function parent_file($parent_file) { 
  90. global $current_screen; 
  91. $screen_id = $current_screen->id; 
  92. if ( strstr($screen_id, 'um_') ) { 
  93. $parent_file = $this->slug; 
  94. return $parent_file; 
  95.