category = _x( 'WordPress Fields', 'xprofile field type category', 'buddypress' );
$this->name = _x( 'Biography', 'xprofile field type', 'buddypress' );
$this->accepts_null_value = true;
$this->wp_user_key = 'description';
$this->set_format( '/^.*$/m', 'replace' );
/**
* Fires inside __construct() method for BP_XProfile_Field_Type_WordPress_Biography class.
*
* @since 8.0.0
*
* @param BP_XProfile_Field_Type_WordPress_Biography $this Instance of the field type object.
*/
do_action( 'bp_xprofile_field_type_wordpress_biography', $this );
}
/**
* Sanitize the user field before saving it to db.
*
* @since 8.0.0
*
* @param string $value The user field value.
* @return string The sanitized field value.
*/
public function sanitize_for_db( $value ) {
if ( ! $value ) {
return '';
}
return trim( $value );
}
/**
* Sanitize the user field before displaying it as an attribute.
*
* @since 8.0.0
*
* @param string $value The user field value.
* @param integer $user_id The user ID.
* @return string The sanitized field value.
*/
public function sanitize_for_output( $value, $user_id = 0 ) {
if ( ! $user_id ) {
$user_id = bp_displayed_user_id();
}
return sanitize_user_field( $this->wp_user_key, $value, $user_id, 'attribute' );
}
/**
* Output the edit field HTML for this field type.
*
* Must be used inside the {@link bp_profile_fields()} template loop.
*
* @since 8.0.0
*
* @param array $raw_properties Optional key/value array of
* {@link http://dev.w3.org/html5/markup/textarea.html permitted attributes}
* that you want to add.
*/
public function edit_field_html( array $raw_properties = array() ) {
/*
* User_id is a special optional parameter that certain other fields
* types pass to {@link bp_the_profile_field_options()}.
*/
if ( ! is_admin() && isset( $raw_properties['user_id'] ) ) {
unset( $raw_properties['user_id'] );
}
$user_id = bp_displayed_user_id();
if ( isset( $raw_properties['user_id'] ) && $raw_properties['user_id'] ) {
$user_id = (int) $raw_properties['user_id'];
unset( $raw_properties['user_id'] );
}
?>
40,
'rows' => 5,
)
);
?>
40,
'rows' => 5,
)
);
?>