Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

What should I return to jsConnect when a user isn't logged in?

edited January 2012 in Vanilla 2.0 - 2.8

Hi,

Using the PHP library for jsConnect, I've managed to let authenticated users log in on the forums whenever they are logged in at the main site. However, when trying to return an array which would indicate that a visitor isn't logged in, by using this code, I still get the 'Or you can... Log in with MAINSITE' block (without an actual account to click below it) on my Vanilla login pop-up.

Is this working as intended, or am I returning the array in the wrong way?

Thanks in advance!

Tagged:

Best Answer

  • ToddTodd Vanilla Staff
    Answer ✓

    If the user isn't logged in to your main site then the link just goes to your own signin page so this should be correct. Just make sure you give the url of your site's signin page on the jsConnect page.

Answers

  • ToddTodd Vanilla Staff
    Answer ✓

    If the user isn't logged in to your main site then the link just goes to your own signin page so this should be correct. Just make sure you give the url of your site's signin page on the jsConnect page.

  • Ah, those fancy 'register' and 'sign-in' buttons never showed for me as I had indeed not provided the links to a login and registration page. Thank you very much!

  • hello friends,
    i am facing problem some what like this,
    when user log in my site forum redirect back to forum from my site login system but not display user name on forum, but user was logged in in my site.
    and at the end redirected url at forum

    http://localhost/vanilla/index.php?p=/

    code file i had put that same as library file which one i am download from document..

    <?php
    require_once dirname(__FILE__).'/functions.jsconnect.php';;
    
    // 1. Get your client ID and secret here. These must match those in your jsConnect settings.
    $clientID = "my id";
    $secret = "secret_key";
    
    // 2. Grab the current user from your session management system or database here.
    $signedIn = true; // this is just a placeholder
    
    // YOUR CODE HERE.
    
    // 3. Fill in the user information in a way that Vanilla can understand.
    $user = array();
    
    if ($signedIn) {
       // CHANGE THESE FOUR LINES.
       $user['uniqueid'] = $_SESSION['id'];
       $user['name'] = $_SESSION['unm'];
       $user['email'] = ;
       $user['photourl'] = '';
    }
    
    // 4. Generate the jsConnect string.
    
    // This should be true unless you are testing. 
    // You can also use a hash name like md5, sha1 etc which must be the name as the connection settings in Vanilla.
    $secure = true; 
    print_r($user);
    exit;
    WriteJsConnect($user, $_GET, $clientID, $secret, $secure);
    
    ?>
    

    any change needed in this code...

    what is appropriate solution for it???

Sign In or Register to comment.