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.

Problem with jsconnect

edited February 2012 in Vanilla 2.0 - 2.8

Since i cant make proxyconnect work , (noone is replying to my thread) i decided to give jsconnect a try. But prob is that i am using Codeigniter. So my function.jsconnect.php is in views folder. How to access it in require_once path?

Answers

  • x00x00 MVP
    edited February 2012

    Why don't you place function.jsconnect.php in the same folder as the file where it is required? dirname(__FILE__) basically finds that directory, so the path would be relative to that.

    Really people should know relative and absolute paths if they are don't stuff like this. Obviously if you re developing with jsConnect, then you need basic php knowledge. We can help with vanilla specific stuff, code in general or code igniter stuff you have to learn yourself.

    grep is your friend.

  • Yup i had that initially, but it wont access the file.. Thats why i changed function.jsconnect.php to a dir outside my cideigniter app directory. But how to verify its working? It shows blank page when i click on the link directly.

    Or can you help me with proxy connect @x00 ? After logging from my login app, it redirects to my index.php and not vanila home page. !

  • x00x00 MVP
    edited February 2012

    Seriously I have no idea what it is you are tying to do or where you are calling it from. If you are a little less vague I might be able to help.

    One thing is for sure is three is no substitute for actually knowing about how a request is handled, the file that is initially run, MVC pattern, etc.

    If you don't know that then why are you dabbling in something like this?

    It is a simple include.

    grep is your friend.

  • I have my own cms, with its own table and users.
    Now i wanna integrate vanilla and my cms so that i have common users table. Thats all i am trying to do.
    I have configured proxyconnect by giving auth url/sign in url and all.
    When i try login from vanilla, it redirects me to my cms login page which is correct but then after logging in, it takes me to cms homepage and not vanilla homepage.

    I hope it helped you understand?

  • x00x00 MVP
    edited February 2012

    From code ingiter docs:
    http://codeigniter.com/user_guide/general/helpers.html

    put function.jsconnect.php in

    application/helpers/

    but rename it to

    jsconnect_helper.php

    then you should be able to load it like so

    $this->load->helper('jsconnect');

    instead of the require.

    grep is your friend.

  • edited February 2012
    <?php
    echo "333";
    $this->load->helper('jsconnect');
    echo "44";
    // 1. Get your client ID and secret here. These must match those in your jsConnect settings.
    $clientID = "1797267416";
    $secret = "e17ed14b7852af2691f9b95217e50cee";
    
    if(isset($_COOKIE["User"]))
    {
        $user = $this->input->cookie('User');
    // 2. Grab the current user from your session management system or database here.
        $signedIn = true;           // this is just a placeholder
    
    // YOUR CODE HERE.
        $query = $this->db->get_where('membership',array('username' => $user));
        foreach($query->result() as $row)
        {
    // 3. Fill in the user information in a way that Vanilla can understand.
            $user = array(
                'uniqueid' => $row->slno,
                'name' => $row->username,
                'email' => $row->email_address,
                'photourl' => ''
                );
        }
        echo $user['name'];
        echo "1111";
        /*$secure = true; 
        WriteJsConnect($user, $_GET, $clientID, $secret, $secure);*/
    }`
    
    My code snippet :
    
    As debugging I echod 333 & 444. But only 333 is displayed. Seems it doesnt execute after `$this->load->helper('jsconnect')
    
  • Well if an error has occurred it is being suppressed, you need to look at your error logs, or turn on debug.

    these are all code igniter related questions not vanilla questions.

    grep is your friend.

  • Can you tell me which file saves error log? M a newbie :(

  • these are all code igniter related questions not vanilla questions.

    grep is your friend.

  • ToddTodd Chief Product Officer Vanilla Staff
    edited February 2012

    Here are some lines of code you can put at the top of your file to show what errors are happening:

    error_reporting(E_ALL);
    ini_set('display_errors', 'on');
    ini_set('track_errors', 1);
    
Sign In or Register to comment.