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.
Awesome, Iβll check it out.
Thank you for your contribution.
Tim OlukayodeΒ With pleasure
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.
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.
Dragan STAMENKOVICΒ got it and thanks for your efforts.
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.
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;
}
}
});