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

#1
[eluser]K.Brown[/eluser]
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:

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

I'm open to any suggestions!


Messages In This Thread
DX Auth/User entries' status--conditional stuff...help! - by El Forum - 07-26-2009, 07:55 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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