Embedded view filtered by logged-in user on embed site

By: Jane Onorati | Asked: 10/21/2023
ForumsCategory: Code HelpEmbedded view filtered by logged-in user on embed site
Jane OnoratiJane Onorati asked 6 months ago

I would like to have my public and members-only pages on my main site, but all forms, views and entries on a subdomain site.  There are several reasons why I think this would be a good setup if I can get it to work.

I can embed my registration form on the main site that is hosted on the forms site with no problem and it seems to work well except users are created on the forms site.  I need users to be created on the main site however, as that is where the members-only pages will be.  I can do this using a plugin that will duplicate users on a different site when created on the first one.

I've run into a problem though trying to set up a profile page on the main site for users.  I created a view for the registration form on the forms site that is filtered by user ID.  But I don't know how I can pass the user ID so it can be used in the embed shortcode.  This is the format of the shortcode to embed the view:

[frm-api type="view" id="200" url="https://example.com" my_param="value"] 

Only "value" needs to be dynamically populated with the current user ID.  Fyi, both sites will have the same users, but only the forms site will have user IDs in a Formidable table.  Don't know if that is irrelevant for a solution.

There may be another way to accomplish splitting up my site this way, but I don't know of any good alternatives.  I think it makes for a poor user experience to shuttle the user back and forth between sites using redirects.


1 Answers
Victor Font answered 6 months ago

User IDs are not controlled by Formidable. Userids are owned and controlled by WordPress. You will never keep two WordPress databases in sync with regards to userids, unless they are exact duplicates of each other. I don't understand your reasoning for keeping forms in one domain and your primary pages in another. It's not a design strategy I would encourage because of all the internal linkages that occur because of user ids. Something is bound to break and you're also weakening security. You should thoroughly test site security because you may be opening the form site up to content spoofing by passing URLs to the subdomain without a nonce.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community