Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8507955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:01:08+00:00 2026-06-11T03:01:08+00:00

I got a Tank Auth library installed in my Codeigniter package, the problem is

  • 0

I got a Tank Auth library installed in my Codeigniter package, the problem is that I don’t like how to is_logged_in functions need to be called because it’s simply long and not so friendly, as I need to use:

$this->tank_auth->is_logged_in()

Everytime I want to check if user is logged in…
So is there a way to make it shorter? By saying shorter I mean something like $this->logged();?

I would really appreciate if someone could help me.

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T03:01:10+00:00Added an answer on June 11, 2026 at 3:01 am

    Head into the tank_auth library and define a new public function:

    public function logged(){
        return $this->is_logged_in();
    }
    

    You can now access it with $this->tank_auth->logged();

    If you want to shorten the name of tank_auth, you’ll have to rename the class and the filename.

    UPDATE:

    The more important question is, why are you calling this so many times that it is becoming an annoyance? You should only have to write it once if your code follows the Don’t Repeat Yourself (DRY) principle.

    Have a look at Phil Sturgeon’s blog post entitled Keeping It DRY. He will show you how to write a base controller that all your controllers will inherit from. If you write the login check in the constructor of the base controller, you don’t have to write it in every controller.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a login form and I'm using Tank Auth for form validation, etc.
Got a little problem. I'd like to create an android list view activity with
Got a cxmemo1 that I need to add its contents to database. Right now
Got a problem with Apache and PHP-files of Wordpress. When I go to any
Got a seg fault from my memcpy that gdb can't give me anything else
got a problem, can't get my head around this jquery and would appreciate your
got some problems. Built an applet that has to be used step-by-step. After each
Got a problem with my add function to my database. The following code hangs
got a little problem im hoping someone can enlighten me on. Trying to serialise
Got a problem here on exiting onclick. The program uses shared preferences to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.