This topic has 3 replies, 2 voices, and was last updated 8 years by Laura.

  • Author
  • #112125
     liam62244
    Participant

    Pleae see attached post. How can I limit the about me section to maybe 200 or 100 words?

    Thanks

    Attachments:
    You must be logged in to view attached files.
    #112338
     Laura
    Moderator

    Hello, try adding this to your functions.php of child theme

    COPY CODE
    
    function filtered_profile_data( $args ) {
    
    
    
    	$data = bp_get_member_profile_data( $args );
    
    
    
    	$defaults = array(
    
    		'field'   => false,   // Field name
    
    		'user_id' => $user_id
    
    	);
    
    
    
    	$r = wp_parse_args( $args, $defaults );
    
    	extract( $r, EXTR_SKIP );
    
    
    
    	switch($field) {
    
    		case 'About':
    
    			$len = 200;
    
    			break;
    
    		default:
    
    			$len =20;
    
    			break;
    
    	}
    
    
    
    	echo  substr( $data, 0, $len);
    
    	
    
    	$words = array_slice( explode( ' ', $data), 0, $len );
    
    	
    
    	echo implode( ' ', $words );
    
    }
    

    Let me know if it works 🙂

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #113774
     liam62244
    Participant

    how many letters does this code restrict?

    #114056
     Laura
    Moderator

    Hello, as you can see in the code, for About field, 200, and for default fields, 20 🙂

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?