latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

multi-site remote API conundrum

Home Forums Community Forum multi-site remote API conundrum

This topic contains 5 replies, has 3 voices. Last updated by  Mark Hultgren 4 years, 2 months ago.

Topic Author Topic
Posted: Friday Sep 28th, 2012 at 8:29 pm #26900
Mark Hultgren
Username: MKWeb

Ok, here is my question (and I hope it is an easy fix, like copying the s2hacks file into the blogs.dir directory for each networked blog)

I have a client that wants to run several different memberships through a single networked blog. We will be installing S2member Pro on the site and what I need to know is how do I get the remote API to add the new user to the correct site membership?

Example:
I have an external API that provides me with everything I need to create a new user, but regardless of the site, they ALL get added to the main site only.

I have created the separate php files with the associated Secret key for the site that I want the remote API to connect to. How do I set the s2member_originating_blog number?

List Of Topic Replies

Viewing 5 replies - 1 through 5 (of 5 total)
Author Replies
Author Replies
Posted: Saturday Sep 29th, 2012 at 8:09 pm #26980
Raam Dev
Username: Raam
Staff Member

Hi Mark,

I’m not clear on what you’re trying to achieve here. Are you trying to use the s2Member Pro API (Dashboard -› s2Member® -› API / Scripting -› Remote Operations API) on the primary site in a Multi-Site WordPress Network to add new users to child blogs of that network?

Posted: Saturday Sep 29th, 2012 at 9:24 pm #26991
Mark Hultgren
Username: MKWeb

Hi Raam,
That is exactly what I am trying to do. I have several different product IDs that I will be using to set the s2member_originating_blog variable with, but not quite sure how to approach it.

Example:
Product A will be for the main site
Product B will be for Blog ID 2
Product C will be for Blog ID 3
Product D will be for Blog ID 4
Product E will be for Blog ID 5
Product F will allow access to Blogs 1 & 2
Product G will allow access to Blogs 1,2 & 3
Product H will allow access to Blogs 1,2,3 & 4
Blog ID 5 is a separate membership and doesn’t connect to any of the others.

Posted: Monday Oct 1st, 2012 at 5:16 am #27039
Raam Dev
Username: Raam
Staff Member

Hi Mark,

I don’t believe the Remote Operations API was designed to do what you’re describing, however I’ll send the lead developer (Jason) a message and see if he can offer any suggestions. I know he’s quite busy working on the next major version of s2Member, but he always gets to his emails. Thank you for your patience.

Posted: Wednesday Oct 3rd, 2012 at 11:56 pm #27387
Staff Member

Thanks for the heads up on this thread.

This is relatively easy to accomplish. The originating blog ID is established by the API endpoint URL itself. That is, the user is added to the blog the API is called from.

For example, your main site API might have the following URL:

http://example.com/?s2member_pro_remote_op=1

To add a user to child blog B, the endpoint URL needs to be pointed to that blog:

http://example.com/B/?s2member_pro_remote_op=1

If you’re running a multisite network with sub-domains instead of sub-directories, it might look like this:

http://B.example.com/?s2member_pro_remote_op=1

The shorter answer is that the user is added to the current blog (i.e. the one being referenced by the API endpoint URL itself). s2Member currently does NOT support changing this via any API parameter.

Posted: Friday Oct 12th, 2012 at 7:33 am #28212
Mark Hultgren
Username: MKWeb

Thanks Jason!
You make it so easy ;-) I guess I was overthinking it (again!)

Viewing 5 replies - 1 through 5 (of 5 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.