| @@ -36,9 +36,9 @@ | ||
| 36 | 36 | public function registerPage() { |
| 37 | 37 | $this->hook_suffix = add_menu_page( |
| 38 | 38 | __('Depicter', 'depicter'), |
| 39 | 39 | __('Depicter', 'depicter'), |
| 40 | - 'manage_options', | |
| 40 | + 'access_depicter', | |
| 41 | 41 | self::PAGE_ID, |
| 42 | 42 | [ $this, 'render' ], // called to output the content for this page |
| 43 | 43 | \Depicter::core()->assets()->getUrl() . '/resources/images/svg/wp-logo.svg' |
| 44 | 44 | ); |
| @@ -46,9 +46,9 @@ | ||
| 46 | 46 | add_submenu_page( |
| 47 | 47 | self::PAGE_ID, |
| 48 | 48 | __( 'Dashboard', 'depicter' ), |
| 49 | 49 | __( 'Dashboard', 'depicter' ), |
| 50 | - 'manage_options', | |
| 50 | + 'access_depicter', | |
| 51 | 51 | self::PAGE_ID |
| 52 | 52 | ); |
| 53 | 53 | |
| 54 | 54 | add_submenu_page( |
| @@ -54,9 +54,9 @@ | ||
| 54 | 54 | add_submenu_page( |
| 55 | 55 | self::PAGE_ID, |
| 56 | 56 | __( 'Add New', 'depicter' ), |
| 57 | 57 | __( 'Add New', 'depicter' ), |
| 58 | - 'manage_options', | |
| 58 | + 'create_depicter', | |
| 59 | 59 | self::PAGE_ID . '-create-slider', |
| 60 | 60 | [ $this, 'externalPageRedirect' ] |
| 61 | 61 | ); |
| 62 | 62 | |
| @@ -63,9 +63,9 @@ | ||
| 63 | 63 | add_submenu_page( |
| 64 | 64 | self::PAGE_ID, |
| 65 | 65 | __( 'Support', 'depicter' ), |
| 66 | 66 | __( 'Support', 'depicter' ), |
| 67 | - 'manage_options', | |
| 67 | + 'access_depicter', | |
| 68 | 68 | self::PAGE_ID . '-goto-support', |
| 69 | 69 | [ $this, 'externalPageRedirect' ] |
| 70 | 70 | ); |
| 71 | 71 | |
| @@ -167,18 +167,13 @@ | ||
| 167 | 167 | { |
| 168 | 168 | global $wp_version; |
| 169 | 169 | $currentUser = wp_get_current_user(); |
| 170 | 170 | |
| 171 | - // get subscription activation status | |
| 172 | - $activationStatus = \Depicter::options()->get('subscription_status', 'not-activated'); | |
| 173 | - $activationError = \Depicter::options()->get('activation_error_message', ''); | |
| 174 | - $activationStatus = ( 'activated' !== $activationStatus ) && ! empty( $activationError ) ? 'error': $activationStatus; | |
| 175 | - | |
| 176 | 171 | wp_add_inline_script('depicter--dashboard', 'window.depicterEnv = '. JSON::encode( |
| 177 | 172 | [ |
| 178 | 173 | 'wpVersion' => $wp_version, |
| 179 | 174 | "scriptsPath" => \Depicter::core()->assets()->getUrl(). '/resources/scripts/dashboard/', |
| 180 | - 'clientKey' => \Depicter::options()->get( 'client_key', 'anon' ), | |
| 175 | + 'clientKey' => \Depicter::auth()->getClientKey(), | |
| 181 | 176 | 'csrfToken' => \Depicter::csrf()->getToken( CSRF::DASHBOARD_ACTION ), |
| 182 | 177 | 'updateInfo' => [ |
| 183 | 178 | 'from' => \Depicter::options()->get('version_previous') ?: null, |
| 184 | 179 | 'to' => \Depicter::options()->get('version') |
| @@ -188,22 +183,25 @@ | ||
| 188 | 183 | "pluginAPI" => admin_url( 'admin-ajax.php' ), |
| 189 | 184 | "editorPath" => \Depicter::editor()->getEditUrl( '__id__' ), |
| 190 | 185 | "documentPreviewPath" => \Depicter::editor()->getEditUrl( '__id__' ), |
| 191 | 186 | 'user' => [ |
| 192 | - 'tier' => \Depicter::options()->get('user_tier', 'free-user') ?: 'free-user', | |
| 187 | + 'tier' => \Depicter::auth()->getTier(), | |
| 193 | 188 | 'name' => Escape::html( $currentUser->display_name ), |
| 194 | 189 | 'email' => Escape::html( $currentUser->user_email ), |
| 195 | 190 | 'joinedNewsletter' => !! \Depicter::options()->get('has_subscribed') |
| 196 | 191 | ], |
| 197 | 192 | 'activation' => [ |
| 198 | - 'status' => $activationStatus, | |
| 199 | - 'errorMessage' => $activationError, | |
| 193 | + 'status' => \Depicter::auth()->getActivationStatus(), | |
| 194 | + 'errorMessage' => \Depicter::options()->get('activation_error_message', ''), | |
| 200 | 195 | 'expiresAt' => \Depicter::options()->get('subscription_expires_at' , ''), |
| 201 | 196 | 'isNew' => isset( $_GET['depicter_upgraded'] ) |
| 202 | 197 | ], |
| 203 | 198 | 'integrations' => [ |
| 204 | 199 | 'woocommerce' => Plugin::isActive( 'woocommerce/woocommerce.php' ) |
| 205 | - ] | |
| 200 | + ], | |
| 201 | + 'AIWizard' => [ | |
| 202 | + 'introVideoSrc' => 'https://www.youtube.com/embed/kdR9Jw0yWjU?rel=0' | |
| 203 | + ] | |
| 206 | 204 | ] |
| 207 | 205 | ), 'before' ); |
| 208 | 206 | |
| 209 | 207 | } |