I asked the same question here but could get good answer:
http://wpquestions.com/question/showChronoLoggedIn/id/9634
I want to hide the name field in buddypress, so that users cant see to change it. Is it possible to do it with CSS?
* Creating that custom code in bp-custom.php creates a lot of problems. There should be a cleaner way.
Romel Apuya answers:
set the attribute to readonly
add this in your header.php
just above the
<?php wp_head(); ?>
<?php
if( bp_is_my_profile()) {
?>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type='text/javascript'>
/* <![CDATA[ */
jQuery.noConflict();
jQuery( document ).ready(function( $ ) {
$( "#field_1" ).prop('readonly', true);
});
/* ]]> */
</script>
<?php
}
?>
Romel Apuya comments:
hide to hide
<?php
if( bp_is_my_profile()) {
?>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type='text/javascript'>
/* <![CDATA[ */
jQuery.noConflict();
jQuery( document ).ready(function( $ ) {
$( "#field_1" ).hide();
});
/* ]]> */
</script>
<?php
}
?>
Romel Apuya comments:
hide the whole are including the Name label
<?php
if( bp_is_my_profile()) {
?>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type='text/javascript'>
/* <![CDATA[ */
jQuery.noConflict();
jQuery( document ).ready(function( $ ) {
$( ".field_1" ).hide();
});
/* ]]> */
</script>
<?php
}
?>