PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 3.16.2
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v3.16.2
4.0.2 4.0.1 4.0.0 3.16.6 3.16.5 3.16.4 3.16.3 3.16.2 3.16.1 3.16.0 3.15.9 3.9.9 3.9.5 3.9.6 3.9.7 3.9.8 1.1.7 1.1.8 1.1.9 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 All 340 releases
profile-builder / front-end / logout.php

logout.php in User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor 3.16.2, at front-end/logout.php

53 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
4 /*
5 * Function that returns a front-end logout message from the wppb-logout shortcode
6 *
7 * @param $atts The shortcode attributes
8 */
9 function wppb_front_end_logout( $atts ) {
10
11 if( !is_user_logged_in() )
12 return;
13
14 $current_user = get_userdata( get_current_user_id() );
15
16 $wppb_generalSettings = get_option( 'wppb_general_settings' );
17
18 if( !empty( $wppb_generalSettings['loginWith'] ) && $wppb_generalSettings['loginWith'] == 'email' ) {
19 $display_username_email = $current_user->user_email;
20 }
21 else {
22 $display_username_email = $current_user->user_login;
23 }
24
25 $atts = shortcode_atts( array(
26 'text' => sprintf(__('You are currently logged in as %s. ', 'profile-builder'), $display_username_email),
27 'redirect' => '',
28 'redirect_url' => wppb_curpageurl(),
29 'redirect_priority' => 'normal',
30 'link_text' => __('Log out &raquo;', 'profile-builder'),
31 'url_only' => '',
32 ), $atts, 'wppb-logout' );
33
34 if( ! empty( $atts['redirect'] ) ) {
35 $atts['redirect_url'] = $atts['redirect'];
36 }
37
38 // CHECK FOR REDIRECT
39 $redirect_url = wppb_get_redirect_url( $atts['redirect_priority'], 'after_logout', esc_url_raw( $atts['redirect_url'] ), $current_user );
40 $redirect_url = apply_filters( 'wppb_after_logout_redirect_url', $redirect_url );
41
42 if( isset( $atts['url_only'] ) && $atts['url_only'] == 'yes' )
43 return wp_logout_url( $redirect_url );
44
45 $logout_link = '<a href="' . esc_url( wp_logout_url( $redirect_url ) ) . '" class="wppb-logout-url" title="' . esc_attr__( 'Log out of this account', 'profile-builder' ) . '">' . esc_html( $atts['link_text'] ) . '</a>';
46
47 $meta_tags = apply_filters( 'wppb_front_end_logout_meta_tags', array( '{{meta_user_name}}', '{{meta_first_name}}', '{{meta_last_name}}', '{{meta_display_name}}' ) );
48 $meta_tags_values = apply_filters( 'wppb_front_end_logout_meta_tags_values', array( $current_user->user_login, $current_user->first_name, $current_user->last_name, $current_user->display_name ) );
49
50 $text = apply_filters( 'wppb_front_end_logout_text', str_replace( $meta_tags, $meta_tags_values, $atts['text'] ), $current_user );
51
52 return apply_filters( 'wppb_logout_message', '<p class="wppb-front-end-logout"><span>' . esc_html( $text ) . '</span>' . $logout_link . '</p>' );
53 }