/*
Theme Name: OceanWP Child2026
Theme URI: https://oceanwp.org/
Template: oceanwp
Author: OceanWP
Author URI: https://oceanwp.org/about-oceanwp/
Description: OceanWP is the perfect theme for your project. Lightweight and highly extendable, it will enable you to create almost any type of website such a blog, portfolio, business website and WooCommerce storefront with a beautiful &amp; professional design. Very fast, responsive, RTL &amp; translation ready, best SEO practices, unique WooCommerce features to increase conversion and much more. You can even edit the settings on tablet &amp; mobile so your site looks good on every device. Work with the most popular page builders as Elementor, Beaver Builder, Brizy, Visual Composer, Divi, SiteOrigin, etc... Developers will love his extensible codebase making it a joy to customize and extend. Best friend of Elementor &amp; WooCommerce. Looking for a Multi-Purpose theme? Look no further! Check the demos to realize that it's the only theme you will ever need: https://oceanwp.org/demos/
Tags: two-columns,right-sidebar,footer-widgets,blog,news,custom-background,custom-menu,post-formats,rtl-language-support,sticky-post,editor-style,threaded-comments,translation-ready,buddypress,custom-colors,featured-images,full-width-template,theme-options,e-commerce,block-styles,wide-blocks,accessibility-ready
Version: 4.1.3.1782249417
Updated: 2026-06-23 14:16:57

*/

function custom_newcomer_login_redirect( $redirect_to, $request, $user ) {
    if ( isset( $user->roles ) && is_array( $user->roles ) ) {
        // If the user is an administrator, let them go to the default dashboard
        if ( in_array( 'administrator', $user->roles ) ) {
            return admin_url();
        } else {
            // Redirect "Newcomers" and all other roles straight to the homepage
            return home_url(); 
        }
    }
    return $redirect_to;
}
add_filter( 'login_redirect', 'custom_newcomer_login_redirect', 10, 3 );
function inject_custom_profile_banner( $user ) {
    // Only target your non-admin "Newcomers" members
    if ( ! in_array( 'administrator', $user->roles ) ) {
        echo '<div class="notice notice-info is-dismissible" style="margin-top: 15px; padding: 15px; border-left-color: #135e96;">';
        echo '<h3 style="margin-top: 0;">Welcome to Your Account Portal!</h3>';
        echo '<p style="font-size: 14px; margin-bottom: 15px;">Your login was successful. You can update your profile information below, or return to the main members dashboard immediately.</p>';
        echo '<p><a href="' . esc_url( home_url() ) . '" class="button button-primary button-large" style="background: #135e96; border-color: #135e96; text-decoration: none;">← Return to Home Page</a></p>';
        echo '</div>';
    }
}
// This hooks right below the main page title before any profile sections load
add_action( 'show_user_profile', 'inject_custom_profile_banner' );

