Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/paid-memberships-pro/preheaders/account.php

Keine Baseline-Datei – Diff nur gegen leer.
Zur Liste
1 -
1 + <?php
2 + global $current_user, $pmpro_msg, $pmpro_msgt, $pmpro_pages;
3 +
4 + // Redirect to login.
5 + if ( ! is_user_logged_in() ) {
6 + $redirect = apply_filters( 'pmpro_account_preheader_redirect', pmpro_login_url( get_permalink( $pmpro_pages['account'] ) ) );
7 + if ( $redirect ) {
8 + wp_redirect( $redirect );
9 + exit;
10 + }
11 + }
12 +
13 + /**
14 + * Check if the current logged in user has a membership level.
15 + * If not, and the site is using the pmpro_account_preheader_redirect
16 + * filter, redirect to that page.
17 + */
18 + if ( ! empty( $current_user->ID ) && empty( $current_user->membership_level->ID ) ) {
19 + $redirect = apply_filters( 'pmpro_account_preheader_redirect', false );
20 + if ( $redirect ) {
21 + wp_redirect( $redirect );
22 + exit;
23 + }
24 + }
25 +
26 + // Preventing conflicts with old account page templates and custom code that depend on the $pmpro_level global being set.
27 + pmpro_getAllLevels();