/** * Display a message immediately with out push into queue * * @param $message * @param string $type */ function learn_press_display_message($message, $type = 'success') { // get all notices added into queue $notices = LP_Session::get('notices'); LP_Session::set('notices', null); // add new notice and display learn_press_add_notice($message, $type); echo learn_press_get_notices(true); // store back notices LP_Session::set('notices', $notices); }
function get_cart_from_session() { $this->_cart_content = LP_Session::get('cart'); do_action('learn_press_get_cart_from_session'); }
/** * Display all notices from queue and clear queue if required * * @param bool|true $clear */ function learn_press_print_notices($clear = true) { if ($notices = LP_Session::get('notices')) { // Allow to reorder the position of notices $notice_types = apply_filters('learn_press_notice_types', array('error', 'success', 'notice')); foreach ($notice_types as $notice_type) { if (!empty($notices[$notice_type])) { learn_press_get_template("notices/{$notice_type}.php", array('messages' => $notices[$notice_type])); } } // clear queue if required if ($clear) { learn_press_clear_notices(); } } }