0
votes

The registration form in the Buddypress auto generates html for the dynamic fields (such as name). How can I modify the label text (for example replace "(required)" with an * (asterisk).

enter image description here

2

2 Answers

1
votes

If you're looking to make that type of change to BuddyPress profile fields, you can use these filters:

add_filter( 'bp_get_the_profile_field_name', function ($field_name){
     if($field_name === 'Name') {
         return 'Your Name';
     }

     return $field_name;
});

add_filter( 'bp_get_the_profile_field_required_label', function($string, $id) {
     return '*';
});

If you're looking to make changes to those account fields on the left, it looks like you'll need to use a template file copied from BuddyPress into your theme. A bit more intrusive, but will work.

Copy this: buddypress/bp-templates/bp-legacy/buddypress/members/register.php

To here: /your-theme/buddypress/members/register.php

Hope this helps a bit! Customizing BuddyPress & WordPress markup can get stringy real fast, so I'd recommend tracing the code back to a filter or action if you can find one. If not, look for a template file you can bring into your own theme.

0
votes

If I did not undestand you wrong, It depends if you want to do it in the client (with Javascript for example) or from the server (with the back-end languaje). But the common languajes have a replace() method that takes two arguments, usually strings with the text you want to replace and the one you want to replace it with.

This page explains the replace method: https://www.w3schools.com/jsref/jsref_replace.asp

Hope it help