-
Author
-
July 26, 2015 at 22:06 #70107KosiiiParticipant
Im wondering how can I not show the front page after the user has logged in.
Ive created frontpage, where I want to hide the top menu, which means users will click on the log in button. After they have done that and logged in, I want them to not see this front page anymore.Any tips about how to achieve this with out installing extra plugins as the theme is heavy enough.
July 27, 2015 at 14:20 #70193sharmstrModeratorYou can use this to redirect them wherever you want https://bphelpblog.wordpress.com/2013/06/22/buddypress-redirect-to-profile-trick-using-a-landing-page/
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
November 6, 2015 at 12:47 #85914JessicaParticipantHello! I am trying to accomplish the exact same thing with my website, but no matter what I do (please see attached image and code below for details), I’m getting redirected to the home page after logging in.
I’m testing it out with these three accounts/roles:
1. My Super Admin account (this gets redirected to the Dashboard as intended)
2. My Administrator account via Facebook login (this gets redirected to the home page, i.e. http://www.mydomain.com)
3. My Subscriber account via normal login (this also gets redirected to the home page)I might be missing something quite obvious, but I’m out of options and would like to have a fresh pair of eyes look at the problem… thank you in advance!
Code for bp-custom.php with my little notes here and there.
COPY CODE<?php /* Enable BuddyPress URL format www.localpathfinders.com/username */ define ( 'BP_ENABLE_ROOT_PROFILES', true ); /* Redirect to profile page after login */ add_filter( 'login_redirect', 'bp_login_redirect_to_profile' ); // The return parameter does not have to be named $redirect_to for this function to work! function bp_login_redirect_to_profile( $redirect_url ) { // Redirect Super Admins and Administrators to backend Dashboard // THIS WORKS! <3 if ( current_user_can( 'Super Admin' || 'Administrator' ) ) { $redirect_url = get_dashboard_url(); return $redirect_url; } // Redirect everyone else to profile page // THIS DOES NOT WORK! </3 else { $redirect_url = 'https://www.google.com'; // This does not redirect to Google, either! return $redirect_url; // List of $redirect_url that did not redirect to profile page with normal login and Facebook login: // get_option('home') . '/' . bp_core_get_username( bp_loggedin_user_id() ); // get_home_url() . '/' . bp_core_get_username( bp_loggedin_user_id() ); // home_url() . '/' . bp_core_get_username( bp_loggedin_user_id() ); // bp_loggedin_user_domain(); // bp_loggedin_user_domain($user->ID); // bp_core_get_userlink( bp_loggedin_user_id() ); // bp_loggedin_user_domain( bp_loggedin_user_id() ); } } /* Redirect to home page after logout */ add_action('wp_logout','bp_logout_redirect_to_home'); function bp_logout_redirect_to_home() { wp_redirect( home_url() ); exit(); } ?>
Attachments:
You must be logged in to view attached files.November 6, 2015 at 13:00 #85922sharmstrModeratorUse peters login redirect plugin. You can redirect based on role
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
November 6, 2015 at 13:34 #85931JessicaParticipantI prefer not to use a plugin because extra plugins tend to bog down the speed, and though I’ve tried to use a variety of caching plugins to avoid this, some are incompatible with vital features of KLEO, as I’ve mentioned in this thread regarding W3 Total Cache.
Furthermore, I do not want to clutter up the Dashboard, since it is already quite confusing with the numerous plugins that come with KLEO/otherwise necessary to manage WooCommerce/BuddyPress.
Is there perhaps an obvious error that I’m missing?
Or is this if loop too difficult to review?November 10, 2015 at 00:24 #86503KosiiiParticipantDid you solve this in a different way @localpathfinders ??
November 13, 2015 at 08:09 #87060JessicaParticipantNo, not yet. I will post again with a solution, if I find one.
In the meantime, I have not yet received a viable response from 7th Queen Support.February 29, 2016 at 00:22 #107290FDParticipantWe are using this function to redirect the users away from the front page after login.
This function also “hides” the front page while the user is logged in.COPY CODEadd_action('wp', 'check_redirect_page'); function check_redirect_page() { if (is_user_logged_in() && is_page( REPLACE_WITH_FRONTPAGE_PAGE_ID )) { wp_redirect( get_permalink( REPLACE_WITH_PAGE_ID_OF_THE_PAGE_YOU_WANT_TO_BE_REDIRECTED_TO )); exit; } }
-
AuthorPosts
The forum ‘KLEO’ is closed to new topics and replies.