Helping you Build Your Own Social Network!

Faster, better and easier!

wpautopfor x-profile fields

(6 posts) (2 voices)

Tags:

No tags yet.


  1. Hi Brajesh,
    I see that when i enter multiple lines in x-profile textarea and display it they show up on the same line.

    for example - if i save this
    line1
    line2

    it shows up as -
    line1 line2

    To fix this i added the following line
    add_filter( 'bp_get_member_profile_data', 'wpautop' );

    This fixed the pbm with text area, not everything shows up well formatted.
    But a new line
    is entered after every text input as well.

    So let say I have two text fields state and city, and i want to display them as state,city but now they are displayed as
    state
    city

    How can I fix this?

    Posted 1 year ago #
  2. anyone?

    Posted 1 year ago #
  3. HI Gwu,
    The problem is bp_get_member_profile_data do not provide any information about the field type but just data.

    Are you using bp_get_member_profile_data() or bp_member_profile_data() in your theme somewhere, we may find some alternative for these.

    Posted 1 year ago #
  4. i m using bp_member_profile_data( 'field=name' )

    Posted 1 year ago #
  5. any other way to do this?

    Posted 1 year ago #
  6. Hi Gwu, Use this function

    function my_member_profile_data( $args = '' ) {
    		global $bp;
    
    		if ( !function_exists( 'xprofile_install' ) )
    			return false;
                     $defaults = array(
    			'field'   => false, // Field name or ID.
    			'user_id' => $bp->displayed_user->id
    		);
            $r = wp_parse_args( $args, $defaults );
            extract( $r, EXTR_SKIP );
            if(is_numeric($field))
                $field_id=$field;
            else
                $field_id = xprofile_get_field_id_from_name( $field );
    
            $data= xprofile_get_field_data( $field_id, $user_id );
            $field_info=xprofile_get_field($field_id);
            if($field_info->type=="textarea")
                echo apply_filters( 'bp_get_profile_field_data', $data );//let apply all the normal filters xyz
            else
                echo $data;
    
    }

    call it file
    my_member_profile_data( 'field=name' )

    as you see, we have allowed to apply filter for textarea but not for other type. You can modify it to your linking.

    hope that helps.
    Brajesh

    Posted 1 year ago #

Reply

You must log in to post.