/app/helper/class-ms-helper-member.php

  1. <?php 
  2. /** 
  3. * Helper functions and data used by the Member class. 
  4. */ 
  5. class MS_Helper_Member extends MS_Helper { 
  6.  
  7. const MSG_MEMBER_ADDED = 1; 
  8. const MSG_MEMBER_DELETED = 2; 
  9. const MSG_MEMBER_UPDATED = 3; 
  10. const MSG_MEMBER_ACTIVATION_TOGGLED = 4; 
  11. const MSG_MEMBER_BULK_UPDATED = 5; 
  12. const MSG_MEMBER_USER_ADDED = 6; 
  13. const MSG_MEMBER_NOT_ADDED = -1; 
  14. const MSG_MEMBER_NOT_DELETED = -2; 
  15. const MSG_MEMBER_NOT_UPDATED = -3; 
  16. const MSG_MEMBER_ACTIVATION_NOT_TOGGLED = -4; 
  17. const MSG_MEMBER_BULK_NOT_UPDATED = -5; 
  18.  
  19. public static function get_admin_message( $msg = 0 ) { 
  20. $messages = apply_filters( 
  21. 'ms_helper_member_get_admin_messages',  
  22. array( 
  23. self::MSG_MEMBER_ADDED => __( 'Membership added.', 'membership2' ),  
  24. self::MSG_MEMBER_DELETED => __( 'Membership deleted.', 'membership2' ),  
  25. self::MSG_MEMBER_UPDATED => __( 'Member updated.', 'membership2' ),  
  26. self::MSG_MEMBER_ACTIVATION_TOGGLED => __( 'Member activation toggled.', 'membership2' ),  
  27. self::MSG_MEMBER_BULK_UPDATED => __( 'Members bulk updated.', 'membership2' ),  
  28. self::MSG_MEMBER_USER_ADDED => __( 'Users added to Membership2 member list.', 'membership2' ),  
  29. self::MSG_MEMBER_NOT_ADDED => __( 'Membership not added.', 'membership2' ),  
  30. self::MSG_MEMBER_NOT_DELETED => __( 'Membership not deleted.', 'membership2' ),  
  31. self::MSG_MEMBER_NOT_UPDATED => __( 'Member not updated.', 'membership2' ),  
  32. self::MSG_MEMBER_ACTIVATION_NOT_TOGGLED => __( 'Member activation not toggled.', 'membership2' ),  
  33. self::MSG_MEMBER_BULK_NOT_UPDATED => __( 'Members bulk not updated.', 'membership2' ),  
  34. ); 
  35.  
  36. if ( array_key_exists( $msg, $messages ) ) { 
  37. return $messages[ $msg ]; 
  38.  
  39. return null; 
  40.  
  41. public static function print_admin_message() { 
  42. $msg = ! empty( $_GET['msg'] ) ? (int) $_GET['msg'] : 0; 
  43.  
  44. $class = ( $msg > 0 ) ? 'updated' : 'error'; 
  45.  
  46. if ( $msg = self::get_admin_message( $msg ) ) { 
  47. lib3()->ui->admin_message( $msg, $class ); 
  48.  
.