WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using buddypress and I offer users the chance to add links to their social networks (facebook/twitter) by entering the url's into custom profile fields. My issue is that people can;t follow directions and constantly enter in incomplete url's so I need to validate them while they're filling them out on profile edit and registration.

I found this nice little function to validate.

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 can I use this in conjunction with buddypress profile edit. 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?

share|improve this question

closed as off-topic by ialocin, kaiser Aug 4 '14 at 14:32

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.