Jump to content

wrong syntax in line of code


Mr.Canuck

Recommended Posts

Here is the full code snippet:

<?php 

function my_password_form() {
    global $post;
    $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID );
    $o = '<form style="margin-left:265px" class="protected-post-form" action="http://example.com" '/wp-login?action=postpass' method="post">
    ' . __( "To enter AIS Cloud, please enter the username which was provided to you:" ) . '
    <label for="' . $label . '">' . __( "Username:" ) . ' </label><input name="post_password" id="' . $label . '" type="password" size="20" /><input type="submit" name="Submit" value="' . esc_attr__( "Login" ) . '" />
    </form>
    ';
    return $o;
}
add_filter( 'the_password_form', 'my_password_form' );

?>

I don't know. Honestly, I'm just trying to learn.

 

Should I remove those single quotes like this?

<?php 

function my_password_form() {
    global $post;
    $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID );
    $o = '<form style="margin-left:265px" class="protected-post-form" action="http://example.com" /wp-login?action=postpass method="post">
    ' . __( "To enter AIS Cloud, please enter the username which was provided to you:" ) . '
    <label for="' . $label . '">' . __( "Username:" ) . ' </label><input name="post_password" id="' . $label . '" type="password" size="20" /><input type="submit" name="Submit" value="' . esc_attr__( "Login" ) . '" />
    </form>
    ';
    return $o;
}
add_filter( 'the_password_form', 'my_password_form' );

?>

That should be OK syntax wise, but this doesn't look right:

action="http://example.com" /wp-login?action=postpass

Maybe:

action="http://example.com/wp-login?action=postpass"

Also: http://us2.php.net/manual/en/language.types.string.php

Thank you for your help so far.

 

This part here has to be separated from the URL, as it controls the "check for password" function:

wp-login?action=postpass

If I do this

action="http://example.com/wp-login?action=postpass"

then when clicking the login button, it just takes me to the http://example.com site without verifying the password first.

 

Is there a way to get the /wp-login?action=postpass to work?

 

NOTE: If I do the code this way:

<?php 

function my_password_form() {
    global $post;
    $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID );
    $o = '<form class="protected-post-form" action="' . get_option( 'siteurl' ) . '/wp-login.php?action=postpass" method="post">
    ' . __( "To enter our client area, please enter the password which was provided to you:" ) . '
    <label for="' . $label . '">' . __( "Password:" ) . ' </label><input name="post_password" id="' . $label . '" type="password" size="20" /><input type="submit" name="Submit" value="' . esc_attr__( "Submit" ) . '" />
    </form>
    ';
    return $o;
}
add_filter( 'the_password_form', 'my_password_form' );

?>

it works. It actually checks for the verified password like it is supposed to, but the siteurl isn't correct, as I need it to go to a specific URL like http://example.com

 

Is there a way to use this line of code how it is, but make it not pull from . get_option( 'siteurl' ) but rather to go to http://example.com ?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.