Support » Plugins and Hacks » Membership 2 » [Resolved] Register/ Login with Twitter

[Resolved] Register/ Login with Twitter

  • Hi,

    I’m wondering if you can help me – I’m planning to use the Membership plugin to allow early access to a website for a select number of users.

    I have turned on Invite codes and added 100 random and unique codes.

    I’ve also configured the Membership plugin as follows…

    – VISITORS will see all PAGES, and only POST EXCERPTS. Anything after the MORE tag is hidden.
    – BETA TESTERS can see ALL content.

    – Beta access (FREE – no charge!)

    However, the REGISTER page (website.com/register), instead of showing the registration form displays the following:

    Select a subscription
    We have the following subscriptions available for our site. To join, simply click on the Sign Up button and then complete the registration details.”

    [BETA ACCESS – Sign-up button]

    After the user clicks the sign-up button, they are then taken to the registration form (website.com/register/?action=registeruser&subscription=1), where they can then create an account:

    – Username
    – Email address
    – Password
    – Invite code

    I have two questions:

    1. Is it possible to skip the first step and instead go straight to the registration form? Since I only have one subscription level, the first step is pointless.

    2. I would like users to be able to register/ login using Twitter. Does the Membership plugin support this?

    I currently have another (premium) plugin installed which works flawlessly, but I’m unsure how to get it working alongside Membership plugin.
    Here’s how it currently works:
    – User clicks Twitter login/ Register button
    – User is prompted to grant the Twitter app access. After user agrees..
    – They are then asked to enter an EMAIL ADDRESS and PASSWORD – this will in future allow them to login to the website manually, or they can simply log back in with their Twitter account – both methods will log them into the same profile.
    – Upon registration, the users are assigned to the ROLE “Subscriber”

    How I need it to work is like this:

    – User registers with Twitter but must enter an invite code
    – User is assigned automatically to the “BETA TESTERS” access level, and also subscribed as a BETA USER.
    – User should be able to login to their account in future using both methods.. manually via the login form, or by clicking the login with Twitter button.

    Is there a way to make this work? Or can you recommend another way to set this up so that it suits my needs?

    The Membership plugin looks great, but Login with Twitter is a must for me.



Viewing 9 replies - 1 through 9 (of 9 total)
  • J K


    WPMU DEV Support Staff

    Hi there Tom,

    Hope your well today and thanks for your question.

    Currently the membership plugin doesn’t allow twitter/facebook registration or login, as it uses it’s own custom sign up process.

    Yet if you keep the anyone can register set in wp-admin > settings > general, you could use a social registration plugin and have them sign up normally then assign a subscription, if that would work?


    Kind Regards

    Hi Jack,

    Is there any way to automatically assign a subscription to new users – perhaps using a custom function?


    Also I’m not sure this will work – if a user is registered, they would no longer be classed as a “Visitor”, would they?



    WPMU DEV Support Staff

    Hi @tom,

    Jack’s posted some great snippets for that to the following:

    I also dug up something a bit more specific in the way of an example you could use to see how a subscription could be added, here:

    function myaddusertosub( $user_id, $sub_id ) {
    $member = new M_Membership($user_id);
    $member->create_subscription( $sub_id );

    You could also set the access level as well:

    function myaddusertolevel( $user_id, $level_id ) {
    $member = new M_Membership($user_id);
    $member->add_level( $level_id );

    The “Stranger” level in Membership would apply to those who are either not logged in, or do not have an active membership or subscription to your website.

    Using the code above can achieve nearly anything though. 🙂

    Does that help?


    Hi Tom,

    Is there any way to automatically assign a subscription to new users – perhaps using a custom function?

    You can automatically assign a subscription to new users by selecting the subscription in use subscription section from the path :

    Admin -> Membership -> Options -> General Tab -> Use subscription

    Also I’m not sure this will work – if a user is registered, they would no longer be classed as a “Visitor”, would they?

    No they would no longer be classed as a “Visitor” if they are logged in.

    Please advise if you have more questions.

    Best Regards,

    Thank you both for your replies – I’m going to be working on this again in the next few days so I’ll let you know how I get on but it sounds promising.

    Most appreciated



    WPMU DEV Support Staff

    Hi Tom,

    Sounds great, looking forward to seeing how that progresses for ya! Something you might find helpful, the Code Snippets plugin will let you easily try out code, such as the snippets above, all from your admin area.


    I should mention though, you’ll wanna be sure you’re comfortable with FTP when using that, since you could potentially code an error that makes your site inaccessible. Through FTP you can remove the plugin from the /wp-content/plugins/ folder to get things back.

    Just a few tidbits you might find helpful. 🙂


    Thanks but I’m actually developing my own functionality plugin so I’ll be adding the code in there 🙂



    WPMU DEV Support Staff

    Sound great Tom! Just to mention too, if you take a good look at Membership’s code, you’ll see it’s well organized and easy to follow.

    Makes it quite a bit easier to customize things. 🙂

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Resolved] Register/ Login with Twitter’ is closed to new replies.
Skip to toolbar