//no account_id, first of account of user $where = array(); $where["object_class"] = " = 'CMediusers'"; $where["object_id"] = " = '{$user->_id}'"; $account_pop->loadObject($where); $where = array(); //mails $mail = new CUserMail(); switch ($mode) { case 'inbox': $nb_mails = CUserMail::countInbox($account_id); $mails = CUserMail::loadInbox($account_id, $page, $limit_list); break; case 'archived': $nb_mails = CUserMail::countArchived($account_id); $mails = CUserMail::loadArchived($account_id, $page, $limit_list); break; case 'favorites': $nb_mails = CUserMail::countFavorites($account_id); $mails = CUserMail::loadFavorites($account_id, $page, $limit_list); break; case 'sentbox': $nb_mails = CUserMail::countSent($account_id); $mails = CUserMail::loadSent($account_id, $page, $limit_list); break; case 'drafts': $nb_mails = CUserMail::countDrafted($account_id); $mails = CUserMail::loadDrafted($account_id, $page, $limit_list); break; } /** @var $mails CUserMail[] */