BuddyDev

Search

Replies

  • Participant
    Level: Enlightened
    Posts: 118
    chris on in reply to: [Resolved] Link Page to Groups #17717
    This reply has been marked as private.
  • Participant
    Level: Enlightened
    Posts: 118
    chris on in reply to: Make one page public on site #17699

    Thanks!

  • Participant
    Level: Enlightened
    Posts: 118
    chris on in reply to: Make one page public on site #17690

    Can you let me know it is possible to protect virtual/dynamic content> which I believe thats what wp-content/uploads is?
    If it is possible, where might i look.

    You say that it will create a bottle neck if I use the code that I shared. thoughts on who I might reach out to

  • Participant
    Level: Enlightened
    Posts: 118
    chris on in reply to: Make one page public on site #17688
    This reply has been marked as private.
  • Participant
    Level: Enlightened
    Posts: 118
    chris on in reply to: Make one page public on site #17685
    This reply has been marked as private.
  • Participant
    Level: Enlightened
    Posts: 118
    chris on in reply to: Make one page public on site #17680

    One more update. I used the following code and deactivated the force login plugin. The use case scenario that I have identified in my prior note now seems to work.

    Here is the code. Can you tell me if its ok based on what I have shared above. Also, per my last message, is it possible to hide the WP-content/uploads folder. I know that you said it does not scale. Not sure what that means. I found this: https://www.getastra.com/blog/cms/wordpress-security/hide-wp-includes-wp-content-uploads-from-your-wordpress-site/

    
    <?php
    /**
     * Make a WordPress site Private, works with/Without BuddyPress
     *
     * @author sbrajesh
     * @global string $pagenow
     *
     */
    function buddydev_private_site() {
    
    	//do not restrict logged in users
    	if ( is_user_logged_in() ) {
    		return ;
    	}
    	//first exclude the wp-login.php
    	//register
    	//activate
    	global $pagenow;
    
    	//if we are here, the user is not logged in, so let us check for exclusion
    	//we selectively exclude pages from the list
    
    	//are we on login page?
    	if ( $pagenow == 'wp-login.php' ) {
    		return ;
    	}
    
    	// Exclude some page.
    	$excluded_pages = array( 'privacy-policy' ); //add all your pages that you want to exclude.
    
    	if ( is_page( $excluded_pages ) ) {
    		return;
    	}
    
    	//handle Special case of BuddyPress registration/Login
    	if ( function_exists( 'is_buddypress' ) && is_buddypress() ) {
    
    		if ( bp_is_activation_page() || bp_is_register_page() ) {
    			return ;
    		}
    	}
    
    	$redirect_url = wp_login_url( site_url('/') );//get login url,
    
    	wp_safe_redirect( $redirect_url );
    	exit( 0 );
    }
    
    add_action( 'template_redirect', 'buddydev_private_site', 0 );
    
  • Participant
    Level: Enlightened
    Posts: 118
    chris on in reply to: Make one page public on site #17677
    This reply has been marked as private.
  • Participant
    Level: Enlightened
    Posts: 118
    chris on in reply to: Make one page public on site #17676

    Do i need to use the plugin force login then? Essentially what we want to have happen is that when someone visits https://narrativeatlas.org&#8230;.if directs them to https://narrativeatlas.org/wp-admin&#8230;..our login page? Looks like your code does that already?

  • Participant
    Level: Enlightened
    Posts: 118
    chris on in reply to: Make one page public on site #17675

    Awesome!Thx

    If I wanted to add multiple pages, how would i do that?

  • Participant
    Level: Enlightened
    Posts: 118
    chris on in reply to: Make one page public on site #17658
    This reply has been marked as private.