Layout of fields on Membership 2 Pro

Hello,

I am new to WordPress and WPMU.

I am using Events + and Membership 2 Pro.

I have created custom fields in Membership 2 Pro and need to display members on a page with some fields hidden to the public and available only to members.

I need to be able to enter a user id and password for members to sign in.

I do not see any documentation on how that can be done.

Can you help me with this. And tell me where I can learn more about Membership 2 Pro.

Thank you!

  • Rupok
    • Ex Staff

    Hi Serge, hope you had a wonderful day.

    I need to be able to enter a user id and password for members to sign in

    You can easily do that with [ms-membership-login] shortcode. Put this shortcode on any page or posts where you want to show the login form where your users can enter username and password for signing in.

    To know about all other shortcodes from Membership 2 Pro, go to “Dashboard > Membership 2 > Help > Shortcode” section. There you will get full list of shortcodes with description.

    Please let us know if you have any confusion. We will be glad to help.

    Have a nice day. Cheers!

    Rupok

  • Rupok
    • Ex Staff

    Hi Serge, hope you had a wonderful day.

    I do apologize, I thought you are describing your situation with your initial lines. Lemme describe one by one:

    I have created custom fields in Membership 2 Pro and need to display members on a page with some fields hidden to the public and available only to members.

    You can list all your users with get_users() function. Here you will find the official documentation on this: https://codex.wordpress.org/Function_Reference/get_users

    In the codex page, you can get example of how you can show users with details. For example:

    <?php
    $blogusers = get_users( 'blog_id=1&orderby=nicename&role=subscriber' );
    // Array of WP_User objects.
    foreach ( $blogusers as $user ) {
    echo '<span>' . esc_html( $user->user_email ) . '</span><br>';
    echo '<span>' . esc_html( $user->display_name ) . '</span>';
    }

    This code will show a list of users with their emails and display names. Now if you want to hide display name from general users and want to make this available only to subscribers of Membership ID 1, then you can modify the code above like this:

    <?php
    $blogusers = get_users( 'blog_id=1&orderby=nicename&role=subscriber' );
    // Array of WP_User objects.
    foreach ( $blogusers as $user ) {
    echo '<span>' . esc_html( $user->user_email ) . '</span><br>';
    $t = '[ms-protect-content id="1"]';
    $t.= echo '<span>' . esc_html( $user->display_name ) . '</span>';
    $t. = '[/ms-protect-content]';
    echo do_shortcode( $t );
    }

    This will show the display_name field only to subscribers of Membership ID 1. I’ve not tested this but this should work. Use your own custom fields to be hidden in the same way. Please let us know how it goes.

    I need to be able to enter a user id and password for members to sign in.

    As you said, the previous solution is not working, would you mind allowing Support Access so we can have a closer look at this?

    To enable support access you can follow this guide here:

    http://wpmudev.com/manuals/wpmu-dev-dashboard-enabling-staff-login/

    I do not see any documentation on how that can be done.

    As I said before, to know about all shortcodes from Membership 2 Pro, go to “Dashboard > Membership 2 > Help > Shortcode” section. There you will get full list of shortcodes with description.

    where I can learn more about Membership 2 Pro

    To learn more about the usage, you can check this page: https://wpmudev.com/project/membership/#product-usage

    To learn more about our API Usage, go to “Dashboard > Membership 2 > Help > API Docs” section. There you will get full details. Basically the “Help” section is full of resources so you can get more idea about how Membership 2 Pro is working.

    If you still have any confusion, please let us know. We will be glad to help further.

    Have a nice day. Cheers!

    Rupok