@shanebp
hi. tnx for answer and patience. got 5 more minutes? 🙂
i read and worked on what you said. and if i want to be honest, i could’t do anything special unfortunately.
now, i want to ask your opinion about this idea:
i’ve come up with the idea of hiding that field. (not email field), how?
with the use of if condition… (if it’s not empty show it. if it has data, hide it)!
——-
i’ve created a custom-meta with this code in theme functions:
add_action( 'personal_options_update', 'my_save_extra_profile_fields' );
add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' );
function my_save_extra_profile_fields( $user_id ) {
if ( !current_user_can( 'edit_user', $user_id ) )
return false;
/* Copy and paste this line for additional fields. */
add_user_meta( $user_id, ‘person_relation’, 30318 );
update_usermeta( absint( $user_id ), 'person_relation', wp_kses_post( $_POST['person_relation'] ) );
update_user_meta( $user_id, 'person_relation', $_POST['person_relation'] );
}
and used it in my buddypress signup form, to get data from users. ok?
after what you said, i went to edit.php (copy to my theme buddypress folder…)
and added these codes. but it seems that they do not recieve/send data at all.
it looks like they are empty!! 😐
after <?php
at the start,
i added :
global $user, $user_id;
$person_relation = get_the_author_meta( 'person_relation', $user->ID );
$user_id = get_current_user_id();
and in the <form>
,
i added this piece of code (not working)
then copied and changed the “save changes button”.
so there is 2 buttons. one is for my-custom-meta, and the other is for buddypress form.
buddypress edit page
if user writes the name and click save. the box/button, all should gone. and i have to see the data in Users admin panel.
but nothing is getting save… and i dont know where am i doing it wrong
<?php if( $person_relation == '' ): ?>
<tr>
<th><label for="person_relation">Invitor's Name</label></th>
<td>
<input type="text" name="person_relation" id="person_relation" value="<?php update_usermeta( $user_id, 'person_relation', $_POST['person_relation'] ); ?>" class="regular-text" /><br />
<span class="description">Please enter your invitor's name.</span>
</td>
</tr>
<input type="hidden" id="userID" value="<?php echo $user_id ?>"/>
<div class="submit">
<input type="submit" name="profile-group-edit-submit" id="profile-group-edit-submit" value="<?php esc_attr_e( 'Save Name', 'buddypress' ); ?> " />
</div>
<input type="hidden" name="person_relation" id="person_relation" value="<?php update_usermeta( $user_id, 'person_relation', $_POST['person_relation'] ); ?>" />
<?php add_action( 'personal_options_update', 'my_save_extra_profile_fields' ); ?>
<?php add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' ); ?>
<?php do_action( 'xprofile_profile_field_data_updated'); ?>
<?php endif; ?>
so sorry for long description. tnx for help.
any suggestions do you have?