Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion assets/src/js/frontend/dashboard/header.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { type MutationState } from '@Core/ts/services/Query';
import { type AjaxResponse } from '@FrontendTypes/index';
import { tutorConfig } from '@TutorShared/config/config';
import { wpAjaxInstance } from '@TutorShared/utils/api';
import { convertToErrorMessage } from '@TutorShared/utils/util';

Expand All @@ -16,7 +17,7 @@ const header = () => {
onSuccess: (res: AjaxResponse) => {
window.TutorCore.toast.success(res?.message);
setTimeout(() => {
window.location.reload();
window.location.href = tutorConfig.tutor_frontend_dashboard_url;
}, 1000);
},
onError: (error: Error) => {
Expand Down
7 changes: 3 additions & 4 deletions classes/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@

namespace TUTOR;

defined( 'ABSPATH' ) || exit;

use Tutor\Helpers\HttpHelper;
use Tutor\Models\UserModel;
use Tutor\Traits\JsonResponse;

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

/**
* User class
*
Expand Down Expand Up @@ -720,6 +718,7 @@ public function ajax_switch_profile() {
}

update_user_meta( $user_id, self::VIEW_MODE_USER_META, $switch_mode );
flush_rewrite_rules();

// translators:%s for switching mode.
$this->response_success( sprintf( __( 'Profile switched to %s!', 'tutor' ), $switch_mode ) );
Expand Down
Loading