Skip to content

Commit

Permalink
Merge pull request #148 from paulcanning/master
Browse files Browse the repository at this point in the history
PM fixes
  • Loading branch information
REJack committed Jun 1, 2016
2 parents a55f9c3 + b422027 commit 26ea41d
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions application/libraries/Aauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -1992,7 +1992,20 @@ public function list_pms($limit=5, $offset=0, $receiver_id=NULL, $sender_id=NULL

$query = $this->aauth_db->order_by('id','DESC');
$query = $this->aauth_db->get( $this->config_vars['pms'], $limit, $offset);
return $query->result();

$result = $query->result();

if ($this->config_vars['pm_encryption']){
$this->CI->load->library('encrypt');

foreach ($result as $k => $r)
{
$result[$k]->title = $this->CI->encrypt->decode($r->title);
$result[$k]->message = $this->CI->encrypt->decode($r->message);
}
}

return $result;
}

//tested
Expand All @@ -2015,7 +2028,7 @@ public function get_pm($pm_id, $user_id = NULL, $set_as_read = TRUE){

$query = $this->aauth_db->where('id', $pm_id);
$query = $this->aauth_db->where('receiver_id', $user_id);
$query = $this->aauth_db->or_where('sender_id', $user_id);
//$query = $this->aauth_db->or_where('sender_id', $user_id);
$query = $this->aauth_db->get( $this->config_vars['pms'] );

if ($query->num_rows() < 1) {
Expand Down

0 comments on commit 26ea41d

Please sign in to comment.