WordPress.org

Ready to get started?Download WordPress

Forums

Membership
[resolved] WP_SITEURL in form actions (5 posts)

  1. kruthar
    Member
    Posted 1 year ago #

    Hi,

    It looks like you are using the get_permalink() method for the action on your forms. This is troublesome in some cases and does not follow what I think is WordPress convention.

    get_permalink() uses the WP_HOME url to build links. But in form actions using POST you should be using WP_SITEURL so that you post to where the site files are being stored instead of the possibly superficial url the site sits behind.

    In most cases for most users WP_HOME and WP_SITEURL will be the same but if they are not the same it makes a big difference. For example, we are in the process of putting our WordPress site behind Amazon Cloudfront which is a site acceleration utility. Unfortunately, Cloudfront does not allow POST actions on any page that it is working for (WordPress and plugins like Membership use quite a few POST form actions). Fortunately, WordPress has given us WP_HOME and WP_SITEURL to get around this. From what I've seen WP_HOME by convention is used for linking to pages, whereas WP_SITEURL is used in form actions and to serve the admin pages.

    This is important for Cloudfront because it caches on a subdomain level. So, if we tell Cloudfront to serve our site at http://www.example.com and to pull from an origin of cp.example.com, we would set WP_HOME to http://www.example.com so all of our links get created with that domain and are cached with Cloudfront, and we set WP_SITEURL to cp.example.com so that all of our POST form actions and admin pages are served from the origin and thus are not subject to the limitations that Cloudfront has with POST actions.

    Long story short, is there an easier way to fix this other then editing all of the form files individually? And can we expect this to go into consideration for the next release of Membership?

    http://wordpress.org/extend/plugins/membership/

  2. kruthar
    Member
    Posted 1 year ago #

    Looking further it looks like it is a simple enough fix but still need a little assistence. On the form pages you can just replace the form action from get_permalink() to site_url('[path]'). The issue still remains on the best way to get [path] associated with the form/page you are on.

  3. Hello there @kruthar, I hope you're well today!

    I just wanted to let you know that I have notified the plugin developer about this issue.

    Cheers,
    Ari.

  4. Mike
    WPMU DEV Support Staff
    Posted 10 months ago #

    Hey there,

    We're just going over some old threads, it's been a while and the original developer of this plugin has now left the company to pursue other interests.

    I've sent a message to the developer who has taken over development of this plugin, hopefully he will comment on this ASAP.

    I apologize for the delay here, hopefully we'll have some news really soon :-)

  5. straightforward
    Member
    Posted 10 months ago #

    Hi kruthar!

    We are going to develop the new version of membership plugin and I will add what you asking for in it.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic