Last active
August 29, 2015 13:57
-
-
Save imath/9663354 to your computer and use it in GitHub Desktop.
Faire en sorte que les pages BuddyPress ne soient accessibles qu'aux membres connectés.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
Seulement visible pour les utilisateurs connectés | |
Portion de code à mettre dans bp-custom.php | |
Voir le codex: http://codex.buddypress.org/plugindev/bp-custom-php/ | |
**/ | |
function check_is_user_logged_in() { | |
if ( ! is_buddypress() ) | |
return; | |
// Il faut permettre l'inscription !! | |
if ( bp_is_register_page() || bp_is_activation_page() ) | |
return; | |
if ( ! is_user_logged_in() ) { | |
/** | |
* Redirection vers la page d'accueil du blog sur lequel est actif BuddyPress | |
* Tu peux changer par l'url de ton choix | |
*/ | |
$url = trailingslashit( get_home_url( bp_get_root_blog_id() ) ); | |
bp_core_redirect( $url ); | |
} | |
} | |
add_action( 'bp_actions', 'check_is_user_logged_in', 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My Pleasure to write you,
My name is Favor Williams,
My email address is
( Favor24@live.com)
Am interested to know
more about you,
Contact me for my
photo and other
important issue via,
Favor24@live.com