PluginProbe
StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More / 2.0.0
StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More v2.0.0
2.3.0 2.2.0 2.1.1 2.1.0 2.0.0 1.10.0 1.9.1 1.9.0 1.2.1 1.2.2 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.0 All 59 releases
storeengine / includes / shortcode / login.php

login.php in StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More 2.0.0, at includes/shortcode/login.php

54 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace StoreEngine\Shortcode;
4
5 if ( ! defined( 'ABSPATH' ) ) {
6 exit;
7 }
8
9 use StoreEngine\Utils\Helper;
10 use StoreEngine\Utils\Template;
11
12 class Login {
13
14
15 public function __construct() {
16 add_shortcode( 'storeengine_login_form', array( $this, 'login_form' ) );
17 }
18
19 public function login_form( $atts ) {
20 $attributes = shortcode_atts( [
21 'form_title' => __( 'Log In into your Account', 'storeengine' ),
22 'username_label' => __( 'Username or Email Address', 'storeengine' ),
23 'username_placeholder' => __( 'Username or Email Address', 'storeengine' ),
24 'password_label' => __( 'Password', 'storeengine' ),
25 'password_placeholder' => __( 'Password', 'storeengine' ),
26 'remember_label' => __( 'Remember me', 'storeengine' ),
27 'login_button_label' => __( 'Log in Now', 'storeengine' ),
28 'reset_password_label' => __( 'Reset password', 'storeengine' ),
29 'show_logged_in_message' => true,
30 // Link directly to our in-dashboard register endpoint rather than
31 // going through wp_registration_url() (which returns wp-login.php).
32 // We intentionally don't filter `register_url` globally — only the
33 // StoreEngine login template should route to the branded form.
34 'register_url' => Helper::get_account_endpoint_url( 'register' ),
35 'login_redirect_url' => Helper::get_page_permalink( 'dashboard_page' ),
36 'logout_redirect_url' => get_the_permalink(),
37 ], $atts );
38
39 ob_start();
40
41 if ( apply_filters( 'storeengine/shortcode/login_form_is_user_logged_in', is_user_logged_in() ) ) {
42 if ( filter_var( $attributes['show_logged_in_message'], FILTER_VALIDATE_BOOLEAN ) ) {
43 Template::get_template( 'shortcode/logged-in-user.php', [
44 'logout_redirect_url' => $attributes['logout_redirect_url'],
45 ] );
46 }
47 } else {
48 Template::get_template( 'shortcode/login.php', $attributes );
49 }
50
51 return apply_filters( 'storeengine/templates/shortcode/login', ob_get_clean() );
52 }
53 }
54