Membership2pro – add existing users (multisite)

Hello,

I'm unable to add existing (multisite/site-wide) users as Membership2pro users although they were added after M2 instalation.

The M2 searchbox can only find the admin (who is attached to the primary site in the network) but the other users who were added from the network admin users panel can't be found.

What's the best way to manually add new users so that the whole network can have protection and memberships?

  • Predrag Dubajic
    • Support

    Hey Matija,

    Hope you’re doing well today :slight_smile:

    If you want to enable network protection with M2 you would need to add this to your wp-config.php:

    define( 'MS_PROTECT_NETWORK', true );

    You can read more about this on plugin usage page here:

    https://premium.wpmudev.org/project/membership/#product-usage

    M2 requires users to have a role in order to find them, and network users don’t have any role assigned, you can use plugin like this to register your users across network:

    https://wordpress.org/plugins/multisite-user-management/

    Best regards,

    Predrag

  • HDNP
    • Flash Drive

    Hi,

    MS_PROTECT_NETWORK was already set in config, but the roles weren't. After setting the roles I was able to find the users.

    However, if I try adding them, I get this error:

    Warning: Creating default object from empty value in /home/content/87/9059787/html/wp-content/plugins/membership/app/controller/class-ms-controller-member.php on line 343

    Fatal error: Call to undefined method stdClass::save() in /home/content/87/9059787/html/wp-content/plugins/membership/app/controller/class-ms-controller-member.php on line 346

    (attached is the screen on which the error happens)

  • Predrag Dubajic
    • Support

    Hi Matija,

    I was doing some testing on my network with assigning, changing, extending and revoking membership from Edit Member screen as shown on your screenshot but none of those actions caused those errors for me.

    Could you grant me support access so I can see this in action on your end, and please provide any additional steps in order to reproduce it.

    To enable support access you can follow this guide here:

    https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Best regards,

    Predrag

  • HDNP
    • Flash Drive

    Hi Predrag,

    thanks for your help.

    I’ve found the problem – and a way around it (even though the error is still there).

    The problem is that the subscription ID of existing members is (somehow) equal to zero, so when a new member is added (like you did) there is no error – but when existing ones are added into M2pro, it doesn’t work.

    Luckily, the site is new, so we have only a few test members – I’ve just deleted them all and made new ones, which worked fine. I hope this won’t be a problem in the future.

    Thanks!

  • Adam Czajczyk
    • Support Gorilla

    Hello HDNP,

    I hope you’re well today!

    I’ve accessed your site and I was able to add existing user as a member with no errors (see that “wpmupredrag” user now has membership assigned). Just to make sure we’re on a same side, here’s exactly what I did:

    1. I went to your main site’s dashboard, “Membership 2 -> Add member” page

    2. I typed “wpm” in search form

    3. Once form showed a user, I selected that user

    4. I selected one of the memberships

    5 And clicked “Save”

    The membership was assigned and set to active. I’m describing the steps I took because I’d like to make sure that I’m not missing anything here. In case you’re doing this different way (even the slightest difference may be important!), let me know please – possibly giving also a step by step guide so I could try to replicate it.

    Best regards,

    Adam

  • HDNP
    • Flash Drive

    Thank you Adam,

    It seem problem was that my WP user was already added but I didn’t see it… Our wp-config.php was missing line define( ‘MS_PROTECT_NETWORK’, true ); (it vanished) and now everything is OK.

    Cheerios from Zagreb,

    Matija

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.