Skip to content

Commit

Permalink
session_start wird nur noch einmal geladen
Browse files Browse the repository at this point in the history
  • Loading branch information
Dernerd committed Jun 6, 2024
1 parent c9c8025 commit e34511b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 2 additions & 0 deletions includes/admin/class-mp-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,8 @@ public function lookup_order() {
* @action wp_ajax_nopriv_mp_update_product_list, wp_ajax_mp_update_product_list
*/
public function update_product_list() {
// Start session if not already started
$this->session_start();
$page = mp_get_post_value( 'page', 1 );
$per_page = mp_get_post_value( 'per_page', 1 );
$category = mp_get_post_value( 'product_category' );
Expand Down
8 changes: 3 additions & 5 deletions includes/public/class-mp-public.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ public static function get_instance() {
* @access private
*/
private function __construct() {
// Start a session only if it's not already started
if (session_id() === '') {
session_start();
}
//$this->includes();
add_action( 'wp', array( $this, 'disable_caching' ) );

Expand Down Expand Up @@ -595,7 +591,9 @@ function maybe_serve_download() {
*/
public function maybe_session_start() {
if ( mp_is_shop_page( 'checkout' ) || mp_is_shop_page( 'cart' ) ) {
$this->session_start();
if ( session_id() === '' ) {
session_start();
}
}
}

Expand Down

0 comments on commit e34511b

Please sign in to comment.