-
Author
-
September 3, 2016 at 16:57 #134807egabillatParticipant
Hello.
I use your « register page » as home page to login or register.
I redirect to this page when I log out.
To have a site only visible for members, I want to force for non loged in users to be redirect to home page to register.
For example if they use http://www.mysite.com/members/ they will be redirect to home page to invite them to register.
Have you an idea… ?
Thank you
Here my actual functions.php for kleo-child theme :
<?php
/**
* @package WordPress
* @subpackage Kleo
* @author SeventhQueen <themesupport@seventhqueen.com>
* @since Kleo 1.0
*/
/**
* Kleo Child Theme Functions
* Add custom code below
*/
add_action(‘wp_logout’,’redirectToHome’);
function redirectToHome(){
wp_redirect( home_url() );
exit();
}
add_action(‘bp_init’,’change_media_tab_position’, 12);
function change_media_tab_position(){
global $bp;
if( isset ($bp->bp_nav[‘media’])){
$bp->bp_nav[‘media’][‘position’] = 20;
}
}
add_filter(‘geodir_login_url’,’change_geodir_login_url’,10,3);
function change_geodir_login_url($login_url,$args,$gd_page_id){
//change the url to whatever you want.
$login_url = ‘http://localhost:8888/register/’;
return $login_url;
}
// Remove admin from the member directory
function bpdev_exclude_users($qs=false,$object=false){
$excluded_user=’347′; // Id’s to remove, separated by comma ohe 347
if($object != ‘members’ && $object != ‘friends’)// hide admin to members & friends
return $qs;
$args=wp_parse_args($qs);
if(!empty($args[‘user_id’]))
return $qs;
if(!empty($args[‘exclude’]))
$args[‘exclude’] = $args[‘exclude’].’,’.$excluded_user;
else
$args[‘exclude’] = $excluded_user;
$qs = build_query($args);
return $qs;
}
add_action(‘bp_ajax_querystring’,’bpdev_exclude_users’,20,2);
// once admin is removed, we must recount the members !
function bpfr_hide_get_total_filter($count){
return $count-1;
}
add_filter(‘bp_get_total_member_count’,’bpfr_hide_get_total_filter’);
// hide admin’s activities from all activity feeds
function bpfr_hide_admin_activity( $a, $activities ) {
// … but allow admin to see his activities!
if ( is_site_admin() )
return $activities;
foreach ( $activities->activities as $key => $activity ) {
// ID’s to exclude, separated by commas. ID 1 is always the superadmin ohe 347
if ( $activity->user_id == 347 ) {
unset( $activities->activities[$key] );
$activities->activity_count = $activities->activity_count-1;
$activities->total_activity_count = $activities->total_activity_count-1;
$activities->pag_num = $activities->pag_num -1;
}
}
// Renumber the array keys to account for missing items
$activities_new = array_values( $activities->activities );
$activities->activities = $activities_new;
return $activities;
}
add_action( ‘bp_has_activities’, ‘bpfr_hide_admin_activity’, 10, 2 );
September 5, 2016 at 09:53 #134857LauraModeratorHello, try https://es.wordpress.org/plugins/simple-members-only/ 🙂
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
September 10, 2016 at 18:05 #135700egabillatParticipantHello Laura.
Finally I found “Simple Members Only” plugin which works fine
ThanksSeptember 13, 2016 at 05:30 #135918LauraModeratorGlad to help 🙂
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
-
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.