Files
leon_pharmacy/inc/site_member.php
Prospect Ogujiuba 7464e10f35 first commit
2024-07-02 11:00:03 -04:00

115 lines
3.2 KiB
PHP

<?php
// Redirect subscriber accounts out of admin and onto homepage
add_action('admin_init', 'redirectSubsToFrontend');
function redirectSubsToFrontend()
{
$ourCurrentUser = wp_get_current_user();
if (count($ourCurrentUser->roles) == 1 and $ourCurrentUser->roles[0] == 'subscriber') {
wp_redirect(site_url('/'));
exit;
}
}
// ------------------------------------------------------------------------------------------
// Remove Admin Bar For Subs
add_action('wp_loaded', 'noSubsAdminBar');
function noSubsAdminBar()
{
$ourCurrentUser = wp_get_current_user();
if (count($ourCurrentUser->roles) == 1 and $ourCurrentUser->roles[0] == 'subscriber') {
show_admin_bar(false);
}
}
// ------------------------------------------------------------------------------------------
// Customize Login Screen
add_filter('login_headerurl', 'ourHeaderUrl');
function ourHeaderUrl()
{
return esc_url(site_url('/'));
}
add_action('login_enqueue_scripts', 'ourLoginCSS');
function ourLoginCSS()
{
wp_enqueue_style('login styles', get_theme_file_uri('/assets/css/styles.css'));
}
add_filter('login_headertitle', 'ourLoginTitle');
function ourLoginTitle()
{
return get_bloginfo('name');
}
// Logout Without Confirmation
function getLogoutUrl($redirectUrl = '')
{
if (!$redirectUrl) $redirectUrl = site_url();
$return = str_replace("&amp;", '&', wp_logout_url($redirectUrl));
return $return;
}
// ------------------------------------------------------------------------------------------
/**
* Bypass logout confirmation on nonce verification failure
*/
function logout_without_confirmation($action, $result)
{
if (!$result && ($action == 'log-out')) {
wp_safe_redirect(getLogoutUrl());
exit();
}
}
add_action('check_admin_referer', 'logout_without_confirmation', 1, 2);
// ------------------------------------------------------------------------------------------
// Change Registration Message
function change_reg_message($message)
{
// change messages that contain 'Register'
if (strpos($message, 'Register') !== FALSE) {
$newMessage = "Register with " . get_bloginfo('name');
return '<p class="message register">' . $newMessage . '</p>';
} else {
return $message;
}
}
// add our new function to the login_message hook
add_action('login_message', 'change_reg_message');
// ------------------------------------------------------------------------------------------
// function custom_wp_new_user_notification_email($wp_new_user_notification_email, $user, $blogname)
// {
// // Customize the email subject
// $wp_new_user_notification_email['subject'] = 'Solr Lights Media';
// // Customize the email message
// $wp_new_user_notification_email['message'] = "Dear {$user->display_name},
// Thank you for your interest in registering with Solr Lights Media.
// Please visit the following url to download, fill out and complete the registration form
// https://google.com";
// // Return the modified email
// return $wp_new_user_notification_email;
// }
// add_filter('wp_new_user_notification_email', 'custom_wp_new_user_notification_email', 10, 3);