Skip to:
Content
Pages
Categories
Search
Top
Bottom

Send Form Data to BP Xprofile Field


  • mortspud
    Participant

    @mortspud

    Hi all,

    I have hit a roadblock and need some help.

    I am trying to collect a member’s address using 5 different html input text fields, then combine these values and pass them to a buddypress xprofile field.

    Here is what I have come up with so far:

    <?php $mailaddress = array('street_number', 'street_name', 'suburb', 'state', 'postcode');
    /******   Mailing Address    *******/ ?>
    			
    			<div class = "custom-edit-field">
    			<input id="street_number" type="text" name="<?php $mailaddress[street_number]; ?>" /><br />	
    			<input id="street_name" type="text" name="<?php $mailaddress[street_name]; ?>" /><br />
    			<input id="suburb" type="text" name="<?php $mailaddress[suburb]; ?>" /><br />
    			<input id="state" type="text" name="<?php $mailaddress[state]; ?>" /><br />
    			<input id="postcode" type="text" name="<?php $mailaddress[postcode]; ?>" /><br />
    			</div>
    			
    			<div class="submit-edit">
    			<input type="submit" name="profile-group-edit-submit" id="profile-group-edit-submit" value="<?php esc_attr_e( 'Save Changes', 'buddypress' ); ?> " />
    			</div>
    			</div>
    			&nbsp;
    
    	<?php
    	do_action( 'bp_after_profile_field_content' ); 
    	 ?>
    	
    	<?php $mailingaddress = implode(', ', $mailaddress);
    	xprofile_set_field_data( 'Mailing Address', $userid, $mailingaddress ); ?>

    This is not saving back to the XProfile field “Mailing Address” and I don’t know why.
    Does anyone see what I am doing wrong here?

  • You must be logged in to reply to this topic.
Skip to toolbar