Guest User

Untitled

a guest
Dec 7th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. <?php
  2. /**
  3. * This adds a field to the end of the "Your Details" section in the Profile form.
  4. *
  5. * In this example, we add a Birthday field, which is a date field.
  6. *
  7. * @param array $fields
  8. * @param Charitable_Profile_Form $form
  9. */
  10. function ed_charitable_remove_phone_field_unless_creator( $fields ) {
  11. $user = charitable_get_user( get_current_user_id() );
  12.  
  13. if ( ! $user || ! $user->get_campaigns( array( 'status' => 'any' ) )->found_posts ) {
  14. unset( $fields['phone'] );
  15. }
  16.  
  17. return $fields;
  18. }
  19. add_filter( 'charitable_user_fields', 'ed_charitable_remove_phone_field_unless_creator' );
Add Comment
Please, Sign In to add comment