Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: The name feild at registration

@sbrajesh

Participant

Hi,
Since I got this same question in my email today. Assuming that it was you or a coincidence, I will post the code here as well for everyone else.

1. BuddyPress Needs the field_1, so you can not delete it. That gives us a solution, we can hide it using css/js and set it’s value to the value of username.

There are two possible approaches.
The first step is use following in css


div.field_1{
display:none;
}

That will hide the input box on the form.

Now, we can update it using the js or PHP. I will post the simple solution using js

You can put the following code in your bp-custom.php or functions.php


function buddydev_disable_firstname() {
	?>
<script type="text/javascript">
	jQuery(document).ready(function(){

	var jq=jQuery;

	jq("#signup_username").on("blur",function(){

	jq("#field_1").val(jq("#signup_username").val());

	});

	});
</script>
<?php
}
add_action( 'bp_after_register_page', 'buddydev_disable_firstname');

That should do it.

There is another pure php solution by settings $_POST[‘field_1’] to the other value but I will leave that for others to figure out 🙂

Skip to toolbar