Support » Networking WordPress » Creating accounts automatically through WP-API

  • Hello,

    let´s see if I can explain what I need in a somewhat understandable way.
    Im trying to start a crowdfunding campaign and in the center of the project is a wp-website which is supposed to “connect” all the members. What I now want to do is to give each backer (person who donates money on Indiegogo) an account on my website (maybe even different membership levels so I can divide the content). There will also be a “free” membership level, thats why I sort of need to distinguish between those two groups.

    So I thought I can use both API´s and write a litte program that does the following:

    1. Checks periodically if there are “new” backers (status: captured/pending) via the Indiegogo API
    2. If so, create a new account (via the WP-API??), send it to the backers email (unique token or URL?) and set the status to “in-fulfillment”
    3. As soon as the account has been verified by the backer, set the status to “fulfilled”

    That´s the theory.

    My main goal with those different membership levels is to devide the content. Usually I would use one of the many membership plugins on the market because they make it very easy to set up different levels. With my automatic approach I´m not sure if that is feasible with a Plugin (I didnt find one where the API looked like it would support that).
    So my Question: Is it possible to create similiar membership levels in WP itself? Im aware of the standard user leves in WP (Admin, Editor, Contributor,..) but they are more about publishing rights or editing possibilites.

    If it´s not possible this way or if there are easier ways:
    Does anybody know a plugin which supports my approach or a different approach I haven´t thought of yet?

    As you might see I have little to no clue when it comes to programming. I would be very grateful for any help or tips I can get 🙂

    Indiegogo API: http://developer.indiegogo.com/docs/campaign-contributions

    I was planning on doing the periodical request with Cronjob. Im not sure which programming language I should use and neither do I know if a databank is necessary.

    I really hope someone can give me a hand here, I would really appreciate it!
    Regards Dennis

    • This topic was modified 2 months, 3 weeks ago by  step23.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello Dennis,

    you have many issues here. The most important is adding users based on the Indiegogo API.

    I would implement it the following way:

    1. Use the WP Cron jobs and scan every X minutes (https://codex.wordpress.org/Function_Reference/wp_schedule_event).
    2. The Cron job will ask the API for new users
    3. Foreach new user you insert and the account is created automtically (https://codex.wordpress.org/Function_Reference/wp_insert_user).

    For the divided content you can hook on the ‘the_content’ and check if the user is logged in. If the user is not logged in you return a custom message asking them to go to Indiegogo to support the project.

    Hey,

    thanks a lot for the reply!

    Using the WP Cronjobs sounds like a good idea. So what you say is, that the WP cronjob will ask the Indiegogo API if there are new user and if so, adds a new one inside WP?

    Can you please elaborate on the last point? 😀 I don´t really understand what you mean there. How can I devide the content? Lets say between a “free” and a “premium” group.

    Are there any downsides on not using membership plugins to handle high numbers of members?

    Thanks a lot again!

    that the WP cronjob will ask the Indiegogo API if there are new user and if so, adds a new one inside WP?

    Yes exactly.

    How can I devide the content? Lets say between a “free” and a “premium” group.

    By using the the_content hook (https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content) you can actually check if the users is logged in and if not print a message instead of the original content.

    This is how the membership plugins do it. They check the status of the user and if he/she has certain attributes and print the appropriate content (or override it with some sort of message).

    One other option would be to redirect all users to log-in before accessing your site .. but that might be more demanding.

    Thanks a lot! I really appreciate your help, this might help a lot.

    Just out of curiosity: Would it be possible to block a part of the website or some sub-sites from the “free” users.

    Let´s say I have a main menu on the front page. Would it be possible to either grey out or not show some of the menu points at all? It´s obviously possible but does it involve “hardcore” coding or are there less difficult ways to achieve it?

    Thanks a lot again!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.