*/ class Partnerexpo_Core_User_Fields extends Partnerexpo_Core { protected $loader; public function __construct( $loader ) { $this->loader = $loader; $this->activate_fields(); } private function activate_fields() { $this->loader->add_action( 'show_user_profile', $this, 'add_custom_user_fields' ); $this->loader->add_action( 'edit_user_profile', $this, 'add_custom_user_fields' ); $this->loader->add_action( 'personal_options_update', $this, 'save_custom_user_fields' ); $this->loader->add_action( 'edit_user_profile_update', $this, 'save_custom_user_fields' ); $this->loader->add_action( 'user_register', $this, 'add_value_after_reg' ); $this->loader->add_action( 'register_form', $this, 'registration_form' ); $this->loader->add_filter( 'registration_errors', $this, 'registration_errors', 10, 3 ); $this->loader->add_filter( 'comment_post', $this, 'validate_comment' ); } public function add_custom_user_fields( $user ) { $company = get_user_meta( $user->ID, 'company', true ); ?>

Additional Information

add( 'company_error', sprintf('%s: %s',__( 'Error', 'partnerexpo-core' ),__( 'Cég megadása kötelező!', 'partnerexpo-core' ) ) ); } return $errors; } function validate_comment( $id ) { if ( empty( $_POST['company'] ) || ! empty( $_POST['company'] ) && trim( $_POST['company'] ) == '' ) { wp_delete_comment( $id, true ); wp_die( sprintf('%s: %s',__( 'Error', 'partnerexpo-core' ),__( 'Cég megadása kötelező!', 'partnerexpo-core' ) ) ); return false; } add_comment_meta( $id, 'company', sanitize_text_field($_POST['company']) ); if ( ! empty( $_POST['name'] ) && trim( $_POST['name'] ) != '' ) { add_comment_meta( $id, 'name', sanitize_text_field($_POST['name']) ); } return true; } }