Trim long strings in field labels (backend only)

This commit is contained in:
Ultimate Member
2015-12-31 16:49:50 +02:00
parent 75e5b85d80
commit 59e0c4da12
2 changed files with 9 additions and 2 deletions
+2 -2
View File
@@ -167,7 +167,7 @@
if ( !isset( $array['account_only'] ) && !isset( $array['private_use'] ) ) {
?>
<a href="#" class="button" data-silent_action="um_admin_add_field_from_predefined" data-arg1="<?php echo $field_key; ?>" data-arg2="<?php echo $arg2; ?>"><?php echo stripslashes( $array['title'] ); ?></a>
<a href="#" class="button" data-silent_action="um_admin_add_field_from_predefined" data-arg1="<?php echo $field_key; ?>" data-arg2="<?php echo $arg2; ?>"><?php echo um_trim_string( stripslashes( $array['title'] ), 20 ); ?></a>
<?php } } } else { echo '<p>' . __('None','ultimatemember') . '</p>'; } ?>
@@ -182,7 +182,7 @@
?>
<a href="#" class="button with-icon" data-silent_action="um_admin_add_field_from_list" data-arg1="<?php echo $field_key; ?>" data-arg2="<?php echo $arg2; ?>"><?php echo stripslashes( $array['title'] ); ?><span class="remove"></span></a>
<a href="#" class="button with-icon" data-silent_action="um_admin_add_field_from_list" data-arg1="<?php echo $field_key; ?>" data-arg2="<?php echo $arg2; ?>"><?php echo um_trim_string( stripslashes( $array['title'] ), 20 ); ?><span class="remove"></span></a>
<?php } } else { echo '<p>' . __('You did not create any custom fields', 'ultimatemember') . '</p>'; } ?>
+7
View File
@@ -35,6 +35,13 @@
wp_mail( $email, $subject_line, $message, $headers, $attachments );
}
/***
*** @Trim string by char length
***/
function um_trim_string( $s, $length = 20 ) {
$s = strlen($s) > $length ? substr($s,0,$length)."..." : $s;
return $s;
}
/***
*** @Convert urls to clickable links
***/