[ create a new paste ] login | about

Link: http://codepad.org/NCrLETYn    [ raw code | output | fork ]

C, pasted on Aug 30:
/**
 * To display additional field at My Account page 
 * Once member login: edit account
 */
add_action( 'woocommerce_edit_account_form', 'my_woocommerce_edit_account_form' );
 
function my_woocommerce_edit_account_form() {
 
	$user_id = get_current_user_id();
	$user = get_userdata( $user_id );
 
	if ( !$user )
		return;
 
	$cod_fisc_iva = get_user_meta( $user_id, 'cod_fisc_iva', true );
 
?>
	<fieldset>
		<legend>Dati fiscali</legend>
    
		<p class="form-row form-row-thirds">
			<label for="cod_fisc_iva">Codice Fiscale/P.IVA<span class="required">*</span></label>
			<input type="text" name="cod_fisc_iva" value="<?php echo esc_attr( $cod_fisc_iva ); ?>" class="input-text" />
			<br />
		</p>
	</fieldset>
 
<?php
 
} // end func
 
/**
 * This is to save user input into database
 * hook: woocommerce_save_account_details
 */
add_action( 'woocommerce_save_account_details', 'my_woocommerce_save_account_details' );
 
function my_woocommerce_save_account_details( $user_id ) {
	update_user_meta( $user_id, 'cod_fisc_iva', htmlentities( $_POST[ 'cod_fisc_iva' ] ) ); 
} // end func


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Line 12: warning: character constant too long for its type
Line 5: error: expected declaration specifiers or '...' before '\x666f726d'
Line 45: warning: character constant too long for its type
Line 5: error: expected declaration specifiers or '...' before '\x666f726d'
Line 5: warning: data definition has no type or storage class
Line 7: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'my_woocommerce_edit_account_form'
Line 42: warning: character constant too long for its type
Line 12: warning: character constant too long for its type
Line 36: error: expected declaration specifiers or '...' before '\x61696c73'
Line 48: warning: character constant too long for its type
Line 36: error: expected declaration specifiers or '...' before '\x61696c73'
Line 36: warning: data definition has no type or storage class
Line 38: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'my_woocommerce_save_account_details'
Line 29: warning: character constant too long for its type
Line 67: warning: character constant too long for its type


Create a new paste based on this one


Comments: