title: Add custom profile fields
body: <p>I am trying to add 2 custom user profile fields for phone numbers to a WordPress site I am working on. I have tried everything on the internet at this point so I am reach out here. </p>
  
  <p>I also need to add the fields to the registration page to integrate with another plugin I am already the registration is native to WordPress already so it's just a matter of adding of having the fields on the registration. </p>
  
  <p>I have been able to add the fields to the edit profile page in the wp-admin edit-profile page. But I cannot add them to the registration page.</p>
  
  <p>This is the code I have worked so far:</p>
  
  <pre><code>$extra_fields =  array( 
                                      array( 'company_phone', __('Company Phone', 'rc_cucm'), true ),
                                      array( 'personal_phone', __('Personal Phone', 'rc_cucm'), true ),
                                      );
  
                                      // Use the user_contactmethods to add new fields
                  add_filter( 'user_contactmethods', 'rc_add_user_contactmethods' );
  
                  /**
                   * Add custom users custom contact methods
                   *
                   * @access      public
                   * @since       1.0 
                   * @return      void
                  */
                  function rc_add_user_contactmethods( $user_contactmethods ) {
  
                      // Get fields
                      global $extra_fields;
  
                      // Display each fields
                      foreach( $extra_fields as $field ) {
                          if ( !isset( $contactmethods[ $field[0] ] ) )
                              $user_contactmethods[ $field[0] ] = $field[1];
                      }
  
                      // Returns the contact methods
                      return $user_contactmethods;
                  }
  </code></pre>
  
  <p>and when I add this part for the registration page I get the error "Parse error: syntax error, </p>
  
  <blockquote>
    <p>unexpected T_STRING in
    /home/content/e/t/e/eternalreefs/html/affiliates/wp-content/plugins/custom-user-contact-methods/rc-custom-user-contact-methods.php
    on line 44"</p>
  </blockquote>
  
  <p>:</p>
  
  <pre><code>//This is where the error occur when I try to add fields to the registration page
          // Add our fields to the registration process
          2
          add_action( 'register_form', 'rc_register_form_display_extra_fields' );
          3
          add_action( 'user_register', 'rc_user_register_save_extra_fields', 100 );
  
          /**
           * Show custom fields on registration page
           *
           * Show custom fields on registration if field third parameter is set to true
           *
           * @access      public
           * @since       1.0 
           * @return      void
          */
          function rc_register_form_display_extra_fields() {
  
              // Get fields
              global $extra_fields;
  
              // Display each field if 3th parameter set to "true"
              foreach( $extra_fields as $field ) {
                  if( $field[2] == true ) { 
                  if( isset( $_POST[ $field[0] ] ) ) { $field_value = $_POST[ $field[0] ]; } else { $field_value = ''; }
                  ?&gt;
                  &lt;p&gt;
                      &lt;label for="&lt;?php echo $field[0]; ?&gt;"&gt;&lt;?php echo $field[1]; ?&gt;&lt;br /&gt;
                      &lt;input type="text" name="&lt;?php echo $field[0]; ?&gt;" id="&lt;?php echo $field[0]; ?&gt;" class="input" value="&lt;?php echo $field_value; ?&gt;" size="20" /&gt;&lt;/label&gt;
                      &lt;/label&gt;
                  &lt;/p&gt;
                  &lt;?php
                  } // endif
              } // end foreach
          }
  
          /**
           * Save field values
           *
           * @access      public
           * @since       1.0 
           * @return      void
          */
          function rc_user_register_save_extra_fields( $user_id, $password = '', $meta = array() )  {
  
              // Get fields
              global $extra_fields;
  
              $userdata       = array();
              $userdata['ID'] = $user_id;
  
              // Save each field
              foreach( $extra_fields as $field ) {
                  if( $field[2] == true ) { 
                      $userdata[ $field[0] ] = $_POST[ $field[0] ];
                  } // endif
              } // end foreach
  
              $new_user_id = wp_update_user( $userdata );
          }
  </code></pre>
  
  <p>Any insight into what is going wrong would be helpful I feel like I am so close please let me know if I am wrong.</p>