Support » Plugin: myCRED » Integration between multiple sites

  • Resolved godavid33


    I need to set the plugin up so the same points system is used between two different wordpress installs. I plan on sharing a user database (which I still need to figure out how to do). I know that there is a remote API, do I need to manually configure this on the remote site in order for it to add and deduct points or is there a way I can configure the remote plugin to automatically do all points functions on the primary site?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Gabriel



    Thank you for your question.
    There are several ways to accomplish this and it all depends on how these two websites are connected.

    If you have two separate websites on two different servers then the remove API would be the way to go. If on the other hand you are using a multisite or have two sites on the same server with their user and usermeta tables shared, then the remote API would be overkill.

    When it comes to the Remote API, you should see it as a “car engine”. I provide you with the engine but it is up to you to design and built the car it will power. There are simply way to many features the API can offer for me to build something that will suit all myCRED users. There are a lot of things you need to take into consideration like what type of security you want since the Remote API would allow outsides to adjust / query your users point balances.

    You are welcome to contact me directly via the myCRED website if you have any further queries or need assistance with the Remote API.

    Okay, so the remote API will probably be overkill in my case. Same server, going to be implementing a shared database. How would you suggest going about sharing the points system between both sites? Is there a way I can point the secondary install of MyCred to the primary MyCred databases (i.e. ideally just set the prefix to look for)?

    Plugin Author Gabriel


    If you are not going to use Multisite, then you would need to do the following:

    1. Have myCRED installed and setup on your “main site”.
    2. On your second website, before enabling myCRED, add the following to your wp-config.php file:

    define( 'MYCRED_LOG_TABLE', 'your_main_sites_mycred_log_table' );

    Replace the dummy text with your main sites log table name so if your main sites db prefix is wp_ while your second site is other_ then the code would be:

    define( 'MYCRED_LOG_TABLE', 'wp_myCRED_log' );

    If you are unsure what the table name is, just go to your db admin area and check the table name. myCRED always names it myCRED_log but if you have been using myCRED since 1.0 then it might be mycred_Log.

    3. Now enable myCRED on your second site and run the setup. Since the table will exist, myCRED will skip the install and you will be able to see your main sites log and users balance on your second site.

    Now at this stage, both sites will share the log and since you are using the same usermeta table (where the balance is stored) on both sites everyones balance will be the same on both sites.

    But this is where it ends. Since you are not using Multisite, you do not have access to the “Master Template” feature. This means that each site will have to be setup separate with regards of hooks and add-ons. If you want both sites to give the same amount of points then you will need to update myCRED on both sites to match.

    The “Master Template” feature basically overrides all other sites settings with your main sites. But it requires Multisite and myCRED being network wide enabled.

    I hope it all makes sense.
    Let me know if you require further assistance.

    Great reply! I hope I can be as responsive as you when I am a plugin author haha.

    So I made the change and it definitely seems to have worked (shared user DB, shared log) but when I get the balance on the second site it is still showing the old users balance. I’m thinking this is possibly because I had previously had myCred installed. Though I deactivated and deleted it prior to defining the myCred log table in the “secondary” site. Is there another table that houses balances? Could it be a cache problem?


    Plugin Author Gabriel


    Users balances are stored in your user meta table under the “mycred_default” key. If you connect both sites users and usermeta tables then on all sits you should see the balance as all sites will pull the balance from the same table.

    Thank you very much!

    I ran into some problems wrought by my own hand due to omitting an underscore from CUSTOM_USER_META_TABLE (doh >< )

    I hope when I’m a plugin author I can be half as responsive and helpful as you are. Cheers!

    Plugin Author Gabriel


    Excellent. Yeah, I have been there myself, staring myself blind at the smallest mistake and appreciate the kind words. Have fun and let me know if you require further assistance.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Integration between multiple sites’ is closed to new replies.