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

  • Home
  • SEARCH
  • 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 7050877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:11:50+00:00 2026-05-28T03:11:50+00:00

I’m developing an app in CodeIgniter and MySQL. The app include user profiles; am

  • 0

I’m developing an app in CodeIgniter and MySQL. The app include user profiles; am using Tank Auth to register and authenticate users.

I’ve setup a couple of users and now want to view each user’s profile. I need to know:

1 – How to add custom session data into Tank Auth. I have an idea of how the code should look (http://codeigniter.com/user_guide/libraries/sessions.html), but am not sure where the code should go in the auth controller, which is rather extensive – https://github.com/ilkon/Tank-Auth/blob/master/application/controllers/auth.php.

2 – How to pass user data through to a view. I’ve setup a function to retrieve user data (see below) and want to pass it through to my profile view–I’m thinking that userdata (in the code) will represent the custom session data, which will include the user’s id and username, one of which I’ll need for the URL.

3 – URLs I want the URLs to look like this: http://example.com/users/3394 or http://example.com/users/fooy_foo. I know I need to do something with CI URI routing, but am not certain how to tie it in with the results I get from the query.

Here’s the code from the User controller {

function index()
    {    
    $id = $this->tank_auth->is_logged_in('id');

    $this->db->where('id', $id);
    $q = $this->db->get('user');
    $data['userdata']=$q;

    $this->load->view('user_view', $data);
    }
}
  • 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-05-28T03:11:50+00:00Added an answer on May 28, 2026 at 3:11 am
    1. I’m not familiar with Tank Auth, but I’d advice you to check out the official page for Tank Auth. Maybe you’ll get a better understanding from reading about the library. Here’s a tutorial that shows how to set up Tank Auth with CodeIgniter.

    2. By looking at your code, from the user controller, I see that you’re passing data the correct way. You’re passing it into the view as an array. In your view the array element will be available as a variable. So to use the data in the view you simply use the variable $userdata. If you’d like to add more data to include in the view, you simply add another element to the $data array!

    3. If you create a controller named users you will be able to reach it at www.example.com/users. You can then edit your index function to include a parameter $uid which will generate your desired url: www.example.com/users/3394.

    Example on #3:

    Lets say you have created the users controller. This would then be your index() function:

    function index($userid) {
      // You should probably have a model here that retrieves information
      // about the user based on the userid
      $data['user'] = $this->User_model->getUserInformation($userid);
      $this->load->view('users', $data);
    }
    

    That’s one way you could set up your index function. The $userid variable is defined by the url http://www.example.com/users/1234. That’s the way urls work in codeigniter. You can read more about it here.

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

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I am using Paperclip to handle profile photo uploads in my app. They upload
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have thousands of HTML files to process using Groovy/Java and I need to
I am writing an app with both english and french support. The app requests

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.