This topic has 4 replies, 3 voices, and was last updated 9 years by Radu.

  • Author
  • #44394
     Darkarcher
    Participant

    Was wanting to know of the best way to add a maximum character amount for areas such as the about me sections and multi line text areas. I did a search and all i could find was the snippet below but i can not get it to function any help would be great. I am wanting to limit the amount of characters to 250 if anyone can help with this. Thank you

    COPY CODE
    
    function filter_profile_data( $data ) {
     
    	return substr( $data, 0, 100);
     
    }
     
    add_filter( 'bp_get_member_profile_data', 'filter_profile_data' );
    #44395
     Darkarcher
    Participant

    also this was input into the sweetdate-child/functions.php encase that was wrong.

    #44419
     Andrei
    Moderator

    Hello,

    That function will only strip down the value of a field to the first 100 characters, and only at the point where you fetch that information from the database.

    If you need to limit as you type in an input field, before saving, then you should use some javascript validation.
    A quick example would be this jquery plugin ( http://rustyjeans.com/jquery-inputlimiter/demo.htm ), but for sure there are many more options out there.

    Let me know if I can help you with anything else.

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

    basically the issue i am running into is the section for looking for in the profile header with avatar is running on way further then i would like anytime someone fills out there profile. I want to limit what show up in that section i am fine with in the profile details it is longer just don’t want those to show everything causing the page to be entirely to large.as seen in the attached photo.

    Attachments:
    You must be logged in to view attached files.
    #44543
     Radu
    Moderator

    Hello,

    If you want to limit about me fields at 250 characters you need to add this file in this path

    wp-content/themes/sweetdate-child/custom_buddypress/class-bp-tabs.php ( @attachment )

    Note : This modification limit all fields to 250 characters.

    If you have programming skills you can add more conditions to fit your needs

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    Attachments:
    You must be logged in to view attached files.
Viewing 5 posts - 1 through 5 (of 5 total)

The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?