Skip to content

Commit

Permalink
Add filter to modify logged in message
Browse files Browse the repository at this point in the history
  • Loading branch information
tdrayson committed Nov 15, 2024
1 parent f00249e commit 7044d2e
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions app/Hooks/Handlers/CustomAuthHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ public function loginForm($attributes, $headerContent = '')
}

if (get_current_user_id()) {
return '<p>' . sprintf(__('You are already logged in. <a href="%s">Go to Home Page</a>', 'fluent-security'), site_url()) . '</p>';
$message = apply_filters('fluent_auth/already_logged_in_message',
sprintf(__('You are already logged in. <a href="%s">Go to Home Page</a>', 'fluent-security'), site_url())
);
return '<p>' . $message . '</p>';
}

$this->loadAssets();
Expand Down Expand Up @@ -148,7 +151,10 @@ public function registrationForm($attributes, $headerContent = '')
}

if (get_current_user_id()) {
return '<p>' . sprintf(__('You are already logged in. <a href="%s">Go to Home Page</a>', 'fluent-security'), esc_url(site_url())) . '</p>';
$message = apply_filters('fluent_auth/already_logged_in_message',
sprintf(__('You are already logged in. <a href="%s">Go to Home Page</a>', 'fluent-security'), site_url())
);
return '<p>' . $message . '</p>';
}

$attributes = $this->getShortcodes($attributes);
Expand Down Expand Up @@ -206,7 +212,10 @@ public function restPasswordForm($attributes, $headerContent = '')
}

if (get_current_user_id()) {
return '<p>' . sprintf(__('You are already logged in. <a href="%s">Go to Home Page</a>', 'fluent-security'), esc_url(site_url())) . '</p>';
$message = apply_filters('fluent_auth/already_logged_in_message',
sprintf(__('You are already logged in. <a href="%s">Go to Home Page</a>', 'fluent-security'), site_url())
);
return '<p>' . $message . '</p>';
}

$attributes = $this->getShortcodes($attributes);
Expand Down Expand Up @@ -258,9 +267,11 @@ public function authForm($attributes)
}

if (get_current_user_id()) {
return '<p>' . sprintf(__('You are already logged in. <a href="%s">Go to Home Page</a>', 'fluent-security'), site_url()) . '</p>';
$message = apply_filters('fluent_auth/already_logged_in_message',
sprintf(__('You are already logged in. <a href="%s">Go to Home Page</a>', 'fluent-security'), site_url())
);
return '<p>' . $message . '</p>';
}

$atts = $this->getShortcodes($attributes);

$authForm = '<div class="fls_auth_wrapper">';
Expand All @@ -286,7 +297,10 @@ public function magicLoginForm($attributes, $content = '')
}

if (get_current_user_id()) {
return '<p>' . sprintf(__('You are already logged in. <a href="%s">Go to Home Page</a>', 'fluent-security'), site_url()) . '</p>';
$message = apply_filters('fluent_auth/already_logged_in_message',
sprintf(__('You are already logged in. <a href="%s">Go to Home Page</a>', 'fluent-security'), site_url())
);
return '<p>' . $message . '</p>';
}

$atts = $this->getShortcodes($attributes);
Expand Down

0 comments on commit 7044d2e

Please sign in to comment.