function inbox($atts) { $a = wp_parse_args($atts, array('nav_view' => 'both')); if (!is_user_logged_in()) { do_action('mmg_before_load_login_form'); mmg()->load_script('login'); return $this->render('shortcode/login', array('show_nav' => $this->can_show_nav($a['nav_view'])), false); } mmg()->load_script('inbox'); add_action('wp_footer', array(&$this, 'render_compose_form')); //$a = shortcode_atts($atts, array()); $type = mmg()->get('box', 'inbox'); if (isset($_GET['query']) && !empty($_GET['query'])) { $type = 'search'; } $total_pages = 0; switch ($type) { case 'inbox': $models = MM_Conversation_Model::get_conversation(); $total_pages = mmg()->global['conversation_total_pages']; break; case 'unread': $models = MM_Conversation_Model::get_unread(); $total_pages = mmg()->global['conversation_total_pages']; break; case 'read': $models = MM_Conversation_Model::get_read(); $total_pages = mmg()->global['conversation_total_pages']; break; case 'sent': $models = MM_Conversation_Model::get_sent(); $total_pages = mmg()->global['conversation_total_pages']; break; case 'archive': $models = MM_Conversation_Model::get_archive(); $total_pages = mmg()->global['conversation_total_pages']; break; case 'setting': return $this->render('shortcode/setting', array('show_nav' => $this->can_show_nav($a['nav_view'])), false); break; case 'search': $models = MM_Conversation_Model::search(mmg()->get('query')); $total_pages = mmg()->global['conversation_total_pages']; break; } return $this->render('shortcode/inbox', array('models' => $models, 'total_pages' => $total_pages, 'paged' => mmg()->get('mpaged', 'int', 1), 'show_nav' => $this->can_show_nav($a['nav_view'])), false); }