Skip to content
WordPress → FMS Membership/wp-admin/admin.php?page=fms-member-gate5 min

Connect to FMS ​

You'll need

  • A service key from the FMS admin portal. Get it at Service keys before you start, because it is shown only once.
  • Someone who can edit wp-config.php on the WordPress server.
  1. Add the key to wp-config.php. The exact line is below.
  2. Fill in the FMS connection section.
    ScreenshotScreenshot, enlarged

    Click anywhere, or press Esc, to close.

  3. Save, then press Test FMS connection (1).
    ScreenshotScreenshot, enlarged

    Click anywhere, or press Esc, to close.

  4. Read the message that comes back.
    ScreenshotScreenshot, enlarged

    Click anywhere, or press Esc, to close.

What goes in each field ​

FieldWhat to put
API URLWhere this server reaches FMS, server to server. When WordPress and FMS run on the same host, use the internal address http://fms-app:8080.
Public URLWhere a browser reaches FMS. This is what pricing links point at.
Service keyNothing. There is no box to type in. It shows the key from wp-config.php, mostly hidden.
Cache TTLHow long WordPress remembers a member's access. 300 seconds is right.
Default fallback messageWhat non-members see on locked content.
Accent colourThe colour of the locked-content button.
DonationsTicked shows the donation links. Untick to hide them. See Donations on or off.

Add the key to wp-config.php ​

The key must go in wp-config.php. The plugin never saves it in the database.

Add this line to wp-config.php, above the line That's all, stop editing!:

php
define('FMS_SERVICE_KEY', 'fms_sk_…');

Replace fms_sk_… with the real key. Then reload FMS Membership. The Service key field says Set via wp-config.php. That is the sign it worked.

If it says the constant is defined but empty, wp-config.php reads the key from the server's environment and that variable is not set. Set it where the server is configured (on a Docker host, in its environment file), restart, and reload. A second define() line would be ignored.

Why not in the settings screen

The key lets the website act as any member. Anyone who can read the database could do the same with a copy stored there. So the plugin keeps it out of the database.

A key is still stored in the database ​

Sites set up before plugin version 0.47.0 may still have the key saved in the database. It keeps working for now. Every admin page shows a warning until it is gone.

  1. Add the key to wp-config.php, as above.
  2. Reload FMS Membership. The Service key field says an old copy is still stored.
  3. Press Forget stored key.
  4. Press Test FMS connection. It should say FMS accepted the service key.

Forget the key only after wp-config.php has it

Until then the stored copy is the only one. Forgetting it disconnects the site from FMS. The button asks before it does that.

What the test can say ​

MessageWhat it meansWhat to do
FMS accepted the service keyEverything is wired up.Nothing.
Not configuredThe URL or the key is missing.Fill in the API URL and add the key to wp-config.php.
Could not reach FMSNo reply, or a page that is not FMS.Check the API URL, and that FMS is running. If the URL is the public one, try the internal address.
FMS does not recognise this service keyUnknown or revoked.Generate a new one in FMS.
FMS knows this key but refused the requestThe key is fine, this server's IP is not on the allow-list.Add the address in FMS, or clear the list.
Something in front of FMS answered insteadA CDN or firewall intercepted the call. Cloudflare's bot check does this to server-to-server calls.Point the API URL straight at FMS, bypassing the CDN. On our host that is http://fms-app:8080.
Unexpected response from FMSIt arrived but failed.Check the FMS logs.

Which FMS environment the site is on ​

The key decides which copy of FMS the site talks to: production, or a sandbox. After a successful test, the settings page says which, under the test button.

LineMeans
Environment: ProductionThe real system.
Environment: sandbox … — test data; links the website makes carry itA test copy. Every link to FMS carries env= and the sandbox's name.
Environment: not checked yetPress Test FMS connection.

While it is a sandbox, the plugin's admin screens show a yellow notice. A test site needs a key generated in its own sandbox. See Service keys.

Next: choose the member pages.

Internal staff guide. Screenshots come from the rehearsal rig and never show real members. Project status (for developers and admins).