__( 'Not logged in.', 'ai-eshop-optimizer' ) ) ); } $landing = isset( $_POST['landing_tab'] ) ? sanitize_key( wp_unslash( $_POST['landing_tab'] ) ) : ''; if ( $landing === '' ) { delete_user_meta( $uid, AIEO_DMM::LANDING_USER_META ); wp_send_json_success( array( 'message' => __( 'Reset — you’ll land on the default card.', 'ai-eshop-optimizer' ) ) ); } if ( $landing === '__resume__' ) { update_user_meta( $uid, AIEO_DMM::LANDING_USER_META, '__resume__' ); wp_send_json_success( array( 'message' => __( 'Saved — you’ll resume where you left off.', 'ai-eshop-optimizer' ) ) ); } $modules = AIEO_DMM::instance()->get_modules(); if ( ! isset( $modules[ $landing ] ) ) { wp_send_json_error( array( 'message' => __( 'That page no longer exists.', 'ai-eshop-optimizer' ) ) ); } update_user_meta( $uid, AIEO_DMM::LANDING_USER_META, $landing ); wp_send_json_success( array( 'message' => sprintf( __( 'Saved — you’ll now land on “%s”.', 'ai-eshop-optimizer' ), $modules[ $landing ]->get_label() ), ) ); } public function render_subtab() { $dmm = AIEO_DMM::instance(); $current = (string) get_user_meta( get_current_user_id(), AIEO_DMM::LANDING_USER_META, true ); $group_labels = array(); foreach ( $dmm->get_group_definitions() as $g ) { $group_labels[ $g['id'] ] = $g['label']; } $by_group = array(); foreach ( $dmm->get_subtabs() as $tab ) { $gid = ! empty( $tab['group'] ) ? $tab['group'] : ''; $by_group[ $gid ][] = array( 'id' => $tab['id'], 'label' => $tab['label'] ); } $order = array_keys( $group_labels ); $order[] = ''; ?> 'my-settings-overview', 'title' => __( 'Landing card', 'ai-eshop-optimizer' ), 'description' => __( 'Personal preferences for your account. These apply only to you — other users of the e-Shop Manager keep their own.', 'ai-eshop-optimizer' ), 'col' => 1, 'footer' => class_exists( '\Rooster\Admin\States' ) ? \Rooster\Admin\States::save_button( $form_id ) : '', 'footnote' => __( 'Tip: pick “Default” to go back to the standard first card.', 'ai-eshop-optimizer' ), ) ); echo $open; ob_start(); ?> 'aieo-my-landing', 'label' => __( 'Landing card', 'ai-eshop-optimizer' ), 'control' => (string) ob_get_clean(), 'help' => __( 'The card you see first when you open the e-Shop Manager (when the link has no specific tab). Pick any card below — grouped by its top-level tab.', 'ai-eshop-optimizer' ), ) ); echo AIEO_DMM_UI::card_form( 'aieo_dmm_save_my_settings', $this->get_id(), $form_id, '