> I asked this question previously and didn’t get a useful answer
What post and why are you not continuing in that thread rather than creating a new one? Perhaps the advice was don’t do this?
If you want to modify core functionality then the WP approach is via hooks and filters, BP adds filters on a liberal basis where they would help in allowing devs to modify or interact with functions so you’ll need to check the functions in core see what filters are available for you to work with.
fwiw I’m not sure it’s wise to start messing around with the core WP signup process, these aspects are tricky, have you considered they may well be a reason underscores aren’t allowed, and regardless why would you think them useful?
@hnla Thanks for your reply and help!
would you please give me an example of how to use the filters? and where to find it? for example, in “bp_core_validate_user_signup” function there are:
$result = apply_filters( ‘wpmu_validate_user_signup’, $result );
and
return apply_filters( ‘bp_core_validate_user_signup’, $result );
Are those the filters you meant? How can I use it?
Unfortunately I cannot prevent underscores in usernames since the naming policy in my institution for the users is: name_number and it should be used the same in the social network.
Thanks
Hope
Yep, but not sure if this is going to work, essentially you would need a function that passes in $user_name & $user_email then run your user_name checks as the bp function does but omitting the underscore check then pass those two variables into the $results array as bp does but the $user_name will be based on your checks with the $user_mail & $errors just passed into that array as is and $result returned in the function, then you add_filter(‘bp_core_validate_blog_signup’, ‘your_function_name’, 2)
Note though likely I have got most of that wrong 🙂 WP has codex pages on working with filters that you probably should read for a better understanding of how to use them.
Okay, I’ll search for how to use filters and try it.
Thank you