How to implement Tank_Auth in my site

edited June 2012 in News & Announcements
Hi again,

In my auth controller I added this in the login function:
//$this->load->view('auth/login_form', $data); $page_init = array('location' => 'auth/login'); $this->load->module_library(FUEL_FOLDER, 'fuel_page', $page_init); $fuel_page->add_variables($vars); $fuel_page->render();

In my header_block I have these links:
<div style="float: left; width: 40%; padding: 0 5px;"><a href="auth/login">Sign In</a></div> <div style="float: left; width: 40%; padding: 0 5px 0 10px;"><a href="auth/register">Register</a></div>

When I go to auth/login I get this error:

Severity: Notice
Message: Undefined variable: fuel_page
Filename: controllers/auth.php
Line Number: 98

Fatal error: Call to a member function add_variables() on a non-object in C:\wamp\www\clarensads\fuel\application\controllers\auth.php on line 98

What am I doing wrong now?

Thank you

Comments

  • edited 10:56AM
    Another problem I have:

    I have a view that needs to be accessed only by logged in users.

    In my controller I put this code:
    function index() { $this->load->library('Tank_auth'); if($this->tank_auth->is_logged_in()): ... }

    When I browse the page I get this error:

    Severity: Notice

    Message: Undefined index: Tank_auth

    Filename: fuel/Loader.php

    Line Number: 206

    Fatal error: Cannot access empty property in C:\wamp\www\clarensads\fuel\application\third_party\fuel\Loader.php on line 215

    Can someone please give me an example of how to implement Tank_auth with fuel cms?

    Thank you
  • edited 10:56AM
    Ok, here the problem was I need to load the library like this:
    $this->load->library('tank_auth') And not Tank_auth

    Now how do I call the login_form within the main layout.

    Why is it loading the file without the header and footer blocks?
  • edited 10:56AM
    Managed to install tank_auth correctly with the help of this post:
    http://www.getfuelcms.com/forums/discussion/comment/2120/#Comment_2120

    Thank you
  • edited 10:56AM
    Ok, have another question here.

    The tank_auth is working, but when a controller of mine redirects to the login form it does not get the main layout.

    I have added this fuel_set_var('layout', 'main') to the login_form file but still, no layout.

    How do I add the main layout to all the tank_auth views?

    Thank you.
Sign In or Register to comment.