php - where the html is created from the buddyboss wordpress template?
I have a wordpress theme buddyboss. and I want to change the register.php file(html). location: E:\Xampp\htdocs\wordpress\wp-content\plugins\buddyboss-platform\bp-templates\bp-nouveau\buddypress\members
But where is the html of this file generated? I don't see that anywhere.
This is the register.php file:
<?php
/**
* BuddyBoss - Members/Blogs Registration forms
*
* @since BuddyPress 3.0.0
* @version 3.1.0
*/
?>
<?php bp_nouveau_signup_hook('before', 'page'); ?>
<div id="register-page" class="page register-page">
<?php bp_nouveau_template_notices(); ?>
<?php bp_nouveau_user_feedback(bp_get_current_signup_step()); ?>
<form action="" name="signup_form" id="signup-form" class="standard-form signup-form " method="post" enctype="multipart/form-data">
<div>
<?php if ('request-details' === bp_get_current_signup_step()) : ?>
<?php bp_nouveau_signup_hook('before', 'account_details'); ?>
<div class="register-section default-profile" id="basic-details-section">
<?php /***** Basic Account Details ******/ ?>
</div><!-- #basic-details-section -->
<?php bp_nouveau_signup_hook('after', 'account_details'); ?>
<?php /***** Extra Profile Details ******/ ?>
<?php if (bp_is_active('xprofile') && bp_nouveau_base_account_has_xprofile()) : ?>
<?php bp_nouveau_signup_hook('before', 'signup_profile'); ?>
<div class="register-section extended-profile register-section-form " id="profile-details-section">
<?php /* Use the profile field loop to render input fields for the 'base' profile field group */ ?>
<?php while (bp_profile_groups()) : bp_the_profile_group(); ?>
<?php while (bp_profile_fields()) : bp_the_profile_field();
if (function_exists('bp_member_type_enable_disable') && false === bp_member_type_enable_disable()) {
if (function_exists('bp_get_xprofile_member_type_field_id') && bp_get_the_profile_field_id() === bp_get_xprofile_member_type_field_id()) {
continue;
}
}
?>
<div <?php bp_field_css_class('editfield');
bp_field_data_attribute(); ?>>
<fieldset>
<div>
<?php
$field_type = bp_xprofile_create_field_type(bp_get_the_profile_field_type());
$field_type->edit_field_html();
?>
</div>
</fieldset>
</div>
<?php endwhile; ?>
<input type="hidden" name="signup_profile_field_ids" id="signup_profile_field_ids" value="<?php bp_the_profile_field_ids(); ?>" />
<?php endwhile; ?>
<?php bp_nouveau_signup_hook('', 'signup_profile'); ?>
</div><!-- #profile-details-section -->
<?php bp_nouveau_signup_hook('after', 'signup_profile'); ?>
<?php endif; ?>
<?php bp_nouveau_signup_form(); ?>
</div><!-- //.layout-wrap -->
<?php bp_nouveau_signup_terms_privacy(); ?>
<?php bp_nouveau_submit_button('register'); ?>
<?php endif; // request-details signup step
?>
<?php bp_nouveau_signup_hook('custom', 'steps'); ?>
</form>
</div>
<?php bp_nouveau_signup_hook('after', 'page'); ?>
Thank you
If I do this:
add_filter( 'bp_nouveau_get_signup_fields', function($fields){
var_dump( $fields);
});
I get this as output:
array(2) { ["account_details"]=> array(3) { ["signup_email"]=> array(6) { ["label"]=> string(5) "Email" ["required"]=> bool(true) ["value"]=> string(25) "bp_get_signup_email_value" ["attribute_type"]=> string(5) "email" ["type"]=> string(5) "email" ["class"]=> string(0) "" } ["signup_password"]=> array(6) { ["label"]=> string(8) "Password" ["required"]=> bool(true) ["value"]=> string(0) "" ["attribute_type"]=> string(8) "password" ["type"]=> string(8) "password" ["class"]=> string(14) "password-entry" } ["signup_password_confirm"]=> array(6) { ["label"]=> string(16) "Confirm Password" ["required"]=> bool(true) ["value"]=> string(0) "" ["attribute_type"]=> string(8) "password" ["type"]=> string(8) "password" ["class"]=> string(22) "password-entry-confirm" } } ["blog_details"]=> array(4) { ["signup_blog_url"]=> array(6) { ["label"]=> string(8) "Site URL" ["required"]=> bool(true) ["value"]=> string(28) "bp_get_signup_blog_url_value" ["attribute_type"]=> string(4) "slug" ["type"]=> string(4) "text" ["class"]=> string(0) "" } ["signup_blog_title"]=> array(6) { ["label"]=> string(10) "Site Title" ["required"]=> bool(true) ["value"]=> string(30) "bp_get_signup_blog_title_value" ["attribute_type"]=> string(5) "title" ["type"]=> string(4) "text" ["class"]=> string(0) "" } ["signup_blog_privacy_public"]=> array(6) { ["label"]=> string(3) "Yes" ["required"]=> bool(false) ["value"]=> string(6) "public" ["attribute_type"]=> string(0) "" ["type"]=> string(5) "radio" ["class"]=> string(0) "" } ["signup_blog_privacy_private"]=> array(6) { ["label"]=> string(2) "No" ["required"]=> bool(false) ["value"]=> string(7) "private" ["attribute_type"]=> string(0) "" ["type"]=> string(5) "radio" ["class"]=> string(0) "" } } }
Answer
Solution:
That bp_nouveau_signup_form
in the register.php
file looks like it would be responsible for generating the form. Here is the code for it. Looking at that code, I see you could use do_action( "bp_{$section}_fields" );
to add fields to the end of a section, but even better, that function uses bp_nouveau_get_signup_fields which has a filter also called bp_nouveau_get_signup_fields
that you can hook into to change what fields are returned. If you do
add_filter( 'bp_nouveau_get_signup_fields', function($fields){
var_dump($fields);
});
then you will see what the data looks like and you can manipulate or add new fields as needed. If you need to add HTML that is more complicated then what is generated from the data presented by that filter, then use the do_action("bp_{$section}_fields")
filter where according to the docstring $section
will be either 'account_details'
or 'blog_details'
.