• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DX Auth/User entries' status--conditional stuff...help!

I don't know what to call it, really--I'm a CI noob!

I'm using DX Auth, and making a simple posting system.

Here's how I'd like it to work:

1. Site lists entries of various users.
2. Entries that have been submitted by users first have a status "pending" (to be reviewed).
3. When a user is logged in they can see their entry with the text beside saying "Pending Approval"
4. If the user is an admin, they can see all the posts--no matter what the status is.
5. If the user is an admin, they can click a button beside the list that says "Approve" and it will change the status to "open" via ajax!

This is my current model:

function getLivePosts($limit){
    $data = array();
    $this->db->where('status', 'open');
    $Q = $this->db->get('posts');
    if ($Q->num_rows() > 0){
      foreach ($Q->result_array() as $row){
        $data[] = $row;
    return $data;
  function getPost($id){
  $data = array();
  $Q = $this->db->get('posts');
  if ($Q->num_rows() > 0){
    $data = $Q->row_array();
  return $data;

I'm open to any suggestions!

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

Users browsing this thread:
1 Guest(s)

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.