Skip to:
Content
Pages
Categories
Search
Top
Bottom

Custom field update form

  • Avatar of martinbeaulne
    martinbeaulne
    Participant

    @martinbeaulne

    Hi ! I want to put a simple form on the member-header.php to update three particular fields. The form only shows when a user is seeing his own profile. The three fields are in the same field group.

    I looked at the edit.php file as a template for my new form, and it seemded pretty simple. I’m afraid it is not, since I can’t make it work.

    The form appears all right. The values in the fields appear all right. But when I hit the Save Changes button, it only redirect me from …/misterX/profile to …/misterX/profile/edit/group/1/ and the new values are not saved to the database.

    I tried several things, and can’t get it to work. I don’t understand why.

    Here is the code of my form function, in member-header.php. The group slug is demo-1 and the field numbers are ok because the right values appear in the textboxes…

    
    <div>
    	<form action="<?php bp_the_profile_group_edit_form_action(); ?>" method="post" id="profile-edit-form" class="standard-form demo-1">
    
    		<label for="field_29">Titre </label>
    		<input id="field_29" type="text" value="<?php echo xprofile_get_field_data('29') ?>" name="field_29">
    
    		<label for="field_19">Lien </label>
    		<textarea id="field_19" name="field_19" cols="40" rows="5"><?php echo xprofile_get_field_data('19') ?></textarea>
    
    		<label for="field_20">Description </label>
    		<textarea id="field_20" name="field_20" cols="40" rows="5"><?php echo xprofile_get_field_data('20') ?></textarea>
    
    		<?php do_action( 'bp_after_profile_field_content' ); ?>
    
    		<div class="submit">
    			<input type="submit" name="profile-group-edit-submit" id="profile-group-edit-submit" value="<?php _e( 'Save Changes', 'buddypress' ); ?> " />
    		</div>
    
    		<input type="hidden" name="field_ids" id="field_ids" value="29,19,20" />
    
    		<?php wp_nonce_field( 'bp_xprofile_edit' ); ?>
    
    	</form>
    
    	</div>
    

    Can anyone help ?

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Avatar of Henry
    Henry
    Participant

    @henrywright-1

    @martinbeaulne how are you processing your new form?

    Avatar of martinbeaulne
    martinbeaulne
    Participant

    @martinbeaulne

    What do you mean ?

    As I said, I copied the form action and values from the edit.php. I thought wp would process it the same way…

    Avatar of martinbeaulne
    martinbeaulne
    Participant

    @martinbeaulne

    So… no one can answer my question ?

    Is there any way to make a custom form in the header.php and use already built wp-bp functions to update the database ?

    Why copying almost exactly edit.php form to somewhere else doesn’t work ?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Custom field update form’ is closed to new replies.