This topic has 10 replies, 2 voices, and was last updated 11 years by sharmstr.

  • Author
  • #39642
     lovewp
    Participant

    @Abe Question, where would I find “childs function.php file” so I can input the following code from @sharmstr

    function kleo_ajax_login()
    {
    // Check the nonce, if it fails the function will break
    check_ajax_referer( ‘kleo-ajax-login-nonce’, ‘security’ );

    // Nonce is checked, get the POST data and sign in user
    $info = array();
    $info[‘user_login’] = $_POST[‘log’];
    $info[‘user_password’] = $_POST[‘pwd’];
    $info[‘remember’] = (isset( $_POST[‘remember’] ) && $_POST[‘remember’] === true) ? true : false ;

    $info = apply_filters(‘kleo_ajaxlogin_atts’, $info);

    $user_signon = wp_signon( $info, false );
    if ( is_wp_error($user_signon) ){
    echo json_encode(array( ‘loggedin’ => false, ‘message’ => ‘<span class=”wrong-response”><i class=”icon icon-attention”></i> ‘ . __( ‘Wrong username or password. Please try again.’, ‘kleo_framework’ ) . ‘</span>’ ));
    } else {
    if ( sq_option( ‘login_redirect’ , ‘default’ ) == ‘reload’ ) {
    $redirecturl = apply_filters( ‘login_redirect’, ‘/activity’, ”, $user_signon );;
    }
    else {
    $redirecturl = apply_filters( ‘login_redirect’, ”, ”, $user_signon );
    }

    echo json_encode(array(‘loggedin’=>true, ‘redirecturl’ => $redirecturl, ‘message’=> ‘<span class=”good-response”><i class=”icon icon-ok-circled”></i> ‘ . __( ‘Login successful, redirecting…’,’kleo_framework’ ) . ‘</span>’ ));
    }

    die();
    }

    #39651
     sharmstr
    Moderator

    themes/kleo-child/functions.php

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #40763
     lovewp
    Participant

    @sharmstr I don’t have that directory structure? Do I need to create it?

    #40764
     lovewp
    Participant

    @Abe Can you please tell me how to get your child theme to work, I have the folder inside of themes, it contains your functions and style files, I’m doing something wrong, I cannot get the above code to function, I don’t think it’s even being seen, please help me out.

    Thanks.

    #40765
     lovewp
    Participant

    Parse error: syntax error, unexpected T_CLASS, expecting ‘)’ in /functions.php on line 21

    #40780
     sharmstr
    Moderator

    If you just copied the code from above it wont work. There are are left and right single quote characters. You need to change all of those to regular quote characters.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #40809
     lovewp
    Participant

    This thread isn’t closed? @sharmstr I fixed the characters, still no luck, my question is this, I don’t think it’s reading the functions.php file in the child theme at all, I don’t know how to set-up the child theme, I tried but kept getting errors.

    #40810
     lovewp
    Participant

    This is the error I get.

    Parse error: syntax error, unexpected T_STRING in /home/zeroni6/public_html/pdxhuddle.com/dev/wp-content/themes/pdxhuddle_child/functions.php on line 30

    #40812
     sharmstr
    Moderator

    Delete the code in your childs function file

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #40814
     lovewp
    Participant

    @sharmstr Delete your code? I’m trying to get it working, why would I delete it?

    function kleo_ajax_login()
    {
    // Check the nonce, if it fails the function will break
    check_ajax_referer( ‘kleo-ajax-login-nonce’, ‘security’ );

    // Nonce is checked, get the POST data and sign in user
    $info = array();
    $info[‘user_login’] = $_POST[‘log’];
    $info[‘user_password’] = $_POST[‘pwd’];
    $info[‘remember’] = (isset( $_POST[‘remember’] ) && $_POST[‘remember’] === true) ? true : false ;

    $info = apply_filters(‘kleo_ajaxlogin_atts’, $info);

    $user_signon = wp_signon( $info, false );
    if ( is_wp_error($user_signon) ){
    echo json_encode(array( ‘loggedin’ => false, ‘message’ => ‘<span class=”wrong-response”><i class=”icon icon-attention”></i> ‘ . __( ‘Wrong username or password. Please try again.’, ‘kleo_framework’ ) . ‘</span>’ ));
    } else {
    if ( sq_option( ‘login_redirect’ , ‘default’ ) == ‘reload’ ) {
    $redirecturl = apply_filters( ‘login_redirect’, ‘/activity’, ”, $user_signon );;
    }
    else {
    $redirecturl = apply_filters( ‘login_redirect’, ”, ”, $user_signon );
    }

    echo json_encode(array(‘loggedin’=>true, ‘redirecturl’ => $redirecturl, ‘message’=> ‘<span class=”good-response”><i class=”icon icon-ok-circled”></i> ‘ . __( ‘Login successful, redirecting
’,’kleo_framework’ ) . ‘</span>’ ));
    }

    die();
    }

    #41032
     sharmstr
    Moderator

    “Why would I delete it?” Because you said you didnt think it was reading your childs function.php file. If you delete it and dont get the error, then you would have proven to yourself that it was reading that file. We already knew it was, I was trying to get you to believe that.

    Now, for the code you have pasted in here, please re-paste with with pre tags around it so it doesnt covert the single quotes to fancy quotes.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 11 posts - 1 through 11 (of 11 total)

The forum ‘KLEO’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?