Skip to:
Content
Pages
Categories
Search
Top
Bottom

Limiting # of characters users may input in custom profile fields

  • Avatar of elianna
    elianna
    Participant

    @elianna

    Hello,

    I’m interested in preventing users from entering more than some set character limit (say, 300 characters) in one or all of the custom profile fields I’ve set up. I’ve seen a few threads here and on StackExchange saying one needs to either use HTML or Javascript, but I haven’t been able to figure out exactly where (specific Buddypress files and line numbers) to make these changes. I’d prefer to limit characters on the user input side of things, not just let them enter as much as they want but limit how much I display.

    Would some kind soul walk me through how I might do this, assuming out-of-the-box latest versions of WP and BP? I’m thinking I need to make changes somewhere inside buddypress/bp-xprofile, but haven’t been able to get anything to work… e.g.
    - this StackExchange thread (http://wordpress.stackexchange.com/questions/36159/how-to-limit-character-length-in-buddypress-function-output) doesn’t tell me exactly which files/lines to alter, so I haven’t been able to get its solution to work
    - haven’t been able to figure out this Javascript solution (linked in another thread on this forum)–where to place the function and

Viewing 1 replies (of 1 total)
  • Avatar of Toby Cryns (@themightymo)
    Toby Cryns
    Participant

    @themightymo

    This sounds like a basic jQuery+WordPress question and not necessarily a BuddyPress-specific question. You will need to do a couple of things to pull this off:

    1) Enqueue jQuery
    2) Write/copy-and-paste a jQuery script that limits the number of characters in a specific field. Then enqueue that script

    Start here (http://codex.wordpress.org/Function_Reference/wp_enqueue_script) and know that there will be a bit of a learning curve!

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.