Skip to main content

Add-on Plugin : Fluent Community - Custom Redirect

Hello,
I'm pleased to present an add-on I developed to improve Fluent Community. I'm sharing it for free with the community. It's called Fluent Community - Custom Redirect.

It allows you to redirect the user to another address if they aren't logged in or registered for a course. This allows you to avoid going through the Fluent Community landing page or the private registration process, which are quite rudimentary πŸ˜…

A concrete example of how I use the plugin:
All my courses are redirected to funnels (1 course = 1 funnel) where I have more freedom in creation, data retrieval, and data tracking. I can also use any design I want because I'm no longer dependent on Fluent Community. And from there, I can obviously automate and open access. The user is then redirected to the platform with their accesses open.

The plugin is very simple, and after extensive testing, I haven't encountered any bugs.

I submitted a request to the Fluent Community team, who took it into consideration. But since I don't know when the option will be available, I decided to create it for the community.

If you have any ideas for improvements or encounter any bugs, please share πŸ‘

You can download addon here : Fluent Community - Custom Redirect

See you soon.

Add-on Plugin : Fluent Community - Custom Redirect

Erin Wright

Awesome, I’ll check it out.

Tim Olukayode

Thank you for your contribution.

Tim OlukayodeΒ With pleasure

Debo Ogunrinde

Dragan STAMENKOVICΒ congrats for your plugin! Can you share more retails on the structure of your funnels? TIA.

Debo OgunrindeΒ It's a classic structure with a landing page, a sales page, a checkout page, and a thank you page. Everything is automated, both for access and the email sequence, etc.

Debo Ogunrinde

Dragan STAMENKOVICΒ Got it ...thanks for the clarifications...If you don't mind, which plugin(s) are you using for the funnel "classic structure with a landing page, a sales page, a checkout page, and a thank you page. Everything is automated, both for access and the email sequence, etc" ?

Debo OgunrindeΒ I don't think this is the place to talk about it because the topic has nothing to do with Fluent Community. Custom Redirect. Contact me privately if you want more information.

Debo Ogunrinde

Dragan STAMENKOVICΒ got it and thanks for your efforts.

Alex

Do you have the code snipet for a simple redirect of the main fluentcommunity URL - IΒ΄ve tried multiples with no joy, since the page of fluentcommunity is not created as a page itself in wordpress I have struggle to create the redirect for some specific users.

Adventurer

AlexΒ Snippet that works for me (example replacing a page on Google):

/**

  • Robust redirect after login for FluentCommunity/FluentAuth/WordPress.
  • Tries multiple hooks + supports AJAX JSON responses. Adds debug logs to debug.log.
    */

// configure your target URL here:
$fc_target_after_login_url = 'https://google.com/';

// --- helper debug logger (do debug.log) ---
if (!function_exists('fc_debug_log')) {
function fc_debug_log($msg) {
if (defined('WP_DEBUG') && WP_DEBUG) {
if (is_array($msg) || is_object($msg)) {
error_log('[FC-REDIRECT] ' . print_r($msg, true));
} else {
error_log('[FC-REDIRECT] ' . $msg);
}
}
}
}

// 1) Classic WP login_redirect filter (wysoki priorytet)
add_filter('login_redirect', function($redirect_to, $request, $user) use ($fc_target_after_login_url) {
fc_debug_log("login_redirect called; user: " . (is_object($user) ? $user->user_login : 'no-user'));
if (is_a($user, 'WP_User')) {
return $fc_target_after_login_url;
}
return $redirect_to;
}, 99999, 3);

// 2) wp_login action β€” zapis meta (fallback dla AJAX)
add_action('wp_login', function($user_login, $user) use ($fc_target_after_login_url) {
fc_debug_log("wp_login fired for user: {$user_login}");
if ($user instanceof WP_User) {
update_user_meta($user->ID, '_fc_after_login_redirect', $fc_target_after_login_url);
}
}, 10, 2);

// 3) fluent_community_after_login β€” jeΕ›li ten hook istnieje w Twojej instalacji (non-AJAX)
add_action('fluent_community_after_login', function ($user_id) use ($fc_target_after_login_url) {
fc_debug_log("fluent_community_after_login fired for user_id: {$user_id}");
if (!$user_id) return;
// jeΕ›li to nie AJAX β€” zrΓ³b redirect
if (! (defined('DOING_AJAX') && DOING_AJAX) ) {
wp_safe_redirect($fc_target_after_login_url);
exit;
}
// jeśli AJAX — spróbujemy nadpisać JSON response (patrz filter poniżej)
}, 10, 1);

// 4) fluent_community_login_response β€” modyfikuj JSON response (jeΕ›li FluentCommunity uΕΌywa tego filtra)
add_filter('fluent_community_login_response', function($response) use ($fc_target_after_login_url) {
fc_debug_log("fluent_community_login_response filter called; original response: " . json_encode($response));
if (is_array($response)) {
$response['redirect_to'] = $fc_target_after_login_url;
}
return $response;
});

// 5) Init-based redirect if user meta was set (fallback przy pierwszym peΕ‚nym ΕΌΔ…daniu)
add_action('init', function() {
if (!is_user_logged_in()) return;

$user_id = get_current_user_id();
$redirect_url = get_user_meta($user_id, '_fc_after_login_redirect', true);
if ($redirect_url) {
    // usuń meta zanim przekierujesz, żeby nie zapętlić
    delete_user_meta($user_id, '_fc_after_login_redirect');
    // unikaj przekierowania w WP adminie lub w AJAX
    if (!is_admin() && !(defined('DOING_AJAX') && DOING_AJAX)) {
        fc_debug_log("init redirecting user {$user_id} to {$redirect_url}");
        wp_safe_redirect($redirect_url);
        exit;
    }
}

});