Skip to content

8) Private Messages

Emre Akay edited this page Jul 4, 2014 · 1 revision

With Aauth, users can send pms to each others.

send_pm($sender_id, $receiver_id, $title, $message)

Simply sends pm.

to send pm from user with id=2 to id=3

$this->aauth->send_pm(2, 3, 'Message subject', 'Msg body')

list_pms($limit=5, $offset=0, $receiver_id = false, $sender_id=false)

Returns object which contains pms. You can limit pms by giving limit and offset.

if you want to list pms from specified sender or reciever, you have to give reciever_id or sender_id or both.

to list 50 pm

$this->aauth->list_pms(50)

to list 50 coming pms for speceified user (id=13)

$this->aauth->list_pms(50,0,13)

to list 50 sent pms for speceified user (id=13)

$this->aauth->list_pms(50,0,false,13);

to list 50 pms from id=3 to id=5

$this->aauth->list_pms(50,0,5,3)

get_pm($pm_id, $set_as_read = true)

returns pm object.
if set_as_true is true, it also checks pm as true.

to get pm with pm_id=53

$this->aauth->get_pm(53)

delete_pm($pm_id)

deletes pm

count_unread_pms($receiver_id=false)

returns unread pms as an integer. if reciever_id not specified, returns current user's unread pm number

set_as_read_pm($pm_id)

sets a pm as read
Remember! you can also do it with get_pm() function