• Resolved proffset

    (@proffset)


    Hi,

    I have found an topic a year ago with this usage:

    if ( true === passster\PS_Conditional::is_password_valid( ‘123’ ) ) {
    the_content();
    }

    But after de newest update this doesnt seem to work anymore…

    Is something missing or do you have a new way to do this?

    / PROffset

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey @proffset,

    thanks for your message.

    It’s true, the function was modified slightly to be able to also check for cookies, user roles, user names, and so on.

    The new way to do this:

    $args = array( 'password' => 123 );
    
    if ( passster\PS_Conditional::is_valid( $args ) ) {
    	// do something.
    }

    Best regards,
    Patrick

    • This reply was modified 5 years, 11 months ago by patrickposner.
    Thread Starter proffset

    (@proffset)

    Hi @patrickposner

    The site doesnt break with the new function, but it does not show the password form either.

    Do I need to call the form or is something else missing?

    My code:
    $Pargs = array( ‘password’ => ‘Balance’ );
    if ( passster\PS_Conditional::is_valid( $Pargs ) ) {
    the_content();
    }

    / PROffset

    Hey @proffset,

    you can simply output the shortcode with your content if it’s not valid:

    $args = array( 'password' => 123 );
    
    if ( passster\PS_Conditional::is_valid( $args ) ) {
    	the_content();
    }else {
    ob_start();
    the_content();
    $content = ob_get_clean();
    $shortcode = '[passster password="your-password"]' . $content . '[/passster]';
    echo do_shortcode( $shortcode );
    }
    • This reply was modified 5 years, 11 months ago by patrickposner.
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘function in 3.1.8 – PS_Conditional::is_password_valid’ is closed to new replies.