Membership registration fields depending on subscrition type

I am using Membership to restrict access for different types of users on different pages. At registration I would like users to have different fields depending on what type of subscrition they have chosen (for example I want business members to add their VAT number). I am using BuddyPress, so it is possible to add fields to the registration form. However, I have not found a solution for the fileds to depend on subscription type. Is that possible?

  • Ash

    Hello @Andréa

    Welcome to WPMU community!

    I hope you are well today and thanks for asking the question.

    I don't think you can add fields from buddypress based on subscription. You can add fields by some custom code in functions.php: http://goo.gl/hU5rHh

    Now you need add fields based on selected subscription. So, if you have two subscription and their IDs are 5 and 9 (for example), you can add extra field based on the id like:

    function extra_fields($user) {
    if($_REQUEST['subscription'] == 5) {
            ?>
            <h3><?php _e("Extra profile information", "DOMAIN"); /*DOMAIN = Lang domain for l10n (optional)*/ ?></h3>
            <table class="form-table">
                <tbody>
                    <tr>
                        <th><?php _e("Extra profile information", "DOMAIN"); /*DOMAIN = Lang domain for l10n (optional)*/ ?></th>
                        <td><input class="regular-text" id="facebook" type="text" name="facebook" value="<?php echo esc_attr( get_the_author_meta( 'facebook', $user->ID ) ); ?>" /></td>
                    </tr>
                </tbody>
            </table>
        <?php
        }
       elseif($_REQUEST['subscription'] == 9) {
          //Do the same as above block.
      }
    }

    Hope it helps! Please feel free to ask more question if you have.

    Cheers
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.