Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to validate custom profile fields.

  • Avatar of enderpal444
    enderpal444
    Participant

    @enderpal444

    I’m taking both a facebook and twitter url from my users so I can create links so I need to validate the url’s they submit. I found a nice little function to help me do that.

    `function validate_url(url)
    {
    if (/^(https?://)?((w{3}.)?)twitter.com/(#!/)?[a-z0-9_]+$/i.test(url))
    return ‘valid’;

    if (/^(https?://)?((w{3}.)?)facebook.com/.*/i.test(url))
    return ‘invalid’;

    return ‘not a valid link’;
    }`

    My question is how I can use this to check the url during profile edit and registration? I moved the bp template files to my child theme and started fooling around with the edit template under profiles but couldn’t really get anywhere. Any ideas on the best way to do this?

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

You must be logged in to reply to this topic.