WordPress.org

Ready to get started?Download WordPress

Forums

Subscribe2
W3c validation error (8 posts)

  1. carinato
    Member
    Posted 2 years ago #

    When I try to validate my site in w3c validator (http://validator.w3.org/) the only error is on subscribe2 widget: the form tag cannot have empty action.
    I suggest to modify this code in http://plugins.svn.wordpress.org/subscribe2/trunk/classes/class-s2-frontend.php (lines 33-35):

    Original code:
    if ( $id ) {
    $url = get_permalink( $id );
    }

    Suggested code:
    if ( $id ) {
    $url = get_permalink( $id );
    } else {
    $url = $_SERVER['PHP_SELF'];
    }

    Thanks
    Franco Carinato

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

  2. mattyrob
    Member
    Plugin Contributor

    Posted 2 years ago #

    @Franco,

    Thanks for the report and fix. Can you tell me the document type for your site. I am using XHTML 1.0 Transitional and this validates fine with action="". Are you using HTML5?

  3. carinato
    Member
    Posted 2 years ago #

    Yes, I'm using a twentyeleven child theme in HTML5

  4. mattyrob
    Member
    Plugin Contributor

    Posted 2 years ago #

    @Franco,

    That would explain why you get the error and I don't.

    In your patch I think we'll need to use
    $url = get_site_url();
    in your else to account for sub-domain installs and multisite users. Can you check this works for you?

  5. carinato
    Member
    Posted 2 years ago #

    Using get_site_url() or $_SERVER['PHP_SELF'], when i make a subscription from a subpage, after the form submission, I go always on home page.
    I tried also this code:
    $url = get_permalink();
    and it seems to work better.
    can it be ?

  6. mattyrob
    Member
    Plugin Contributor

    Posted 2 years ago #

    @Franco,

    get_permalink() will fails on sites where the_loop() is closed before the sidebar code is called.

    Both get_site_url() and $_SERVER['PHP_SELF'] will always return you to the root of your site domain. get_site_url() might be better as it gives the full URL instead of a relative one.

    There may still be a better way though to preserve subpages.

  7. carinato
    Member
    Posted 2 years ago #

    You are right
    ok for get_site_url()

    or this ?
    get_site_url() . esc_url( $_SERVER['REQUEST_URI'] )

  8. mattyrob
    Member
    Plugin Contributor

    Posted 2 years ago #

    @Franco,

    I think get_site_url() might be the route to take because $_SERVER['REQUEST_URI'] is not supported on IIS servers. It's fine on Apache but not IIS. :(

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags