Advertisement
Guest User

functions-php

a guest
Sep 1st, 2012
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. function huddle_bp_get_the_profile_field_value( $value, $type = '', $id = '' ) {
  2. global $field;
  3.  
  4. if( substr_count( strtolower( $field->name ), 'twitter' ) ) {
  5. if( !substr_count( $field->data->value, 'twitter.com' ) ) {
  6. $value = 'http://twitter.com/' . $value;
  7. }
  8. } elseif( substr_count( strtolower( $field->name ), 'about' ) ) {
  9.  
  10. } else {
  11. $values = explode( ',', $value );
  12.  
  13. if ( $values ) {
  14. foreach ( (array)$values as $value ) {
  15. $value = trim( $value );
  16.  
  17. // If the value is a URL, skip it and just make it clickable.
  18. if ( preg_match( '@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', $value ) ) {
  19. $new_values[] = make_clickable( $value );
  20. } else {
  21. if ( count( explode( ' ', $value ) ) > 5 ) {
  22. $new_values[] = $value;
  23. } else {
  24. $new_values[] = '<a href="' . site_url( bp_get_members_root_slug() ) . '/?s=' . strip_tags( $value ) . '" rel="nofollow">' . $value . '</a>';
  25. }
  26. }
  27. }
  28.  
  29. $value = implode( ', ', $new_values );
  30. }
  31. }
  32.  
  33. return $value;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement