Support » Plugin: BuddyPress Group Email Subscription » Digest links to private group content: some 404, some do not

  • Hello,
    I’m having trouble with digest emails sent to a private BuddyPress group. Forum topic links drop users on the 404 page if they are not logged in. However, the “View” links at the end of each item in the email redirect non-logged users to the login page (desired behavior).

    My users are very easily intimidated and have given up clicking on the digest links altogether after landing on the 404 page. How can I make it so all private group digest links will redirect non-logged in users to the login page? The “View” links contain a redirect string to the login page. Can I edit the forum topic links somehow to include the same redirect?

    Thanks for any help you can give. I’ve been fighting with this for months now. I thought I hit the jackpot when I found this BuddyPress issue but found it had long since been fixed.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Sorry, I should have included information about what’s running on my website:
    WordPress 5.1
    BuddyPress 4.2.0
    bbPress 2.5.14
    BuddyPress Group Email Subscription 3.8.2
    17 other plugins
    Socialize theme

    I’m unable to solve this problem with the email digest links so I turned to a much broader fix. I found the following code at https://wordpress.stackexchange.com/questions/16004/redirect-user-to-original-url-after-login and added it to functions.php in my child theme.

    function restrict_access_if_logged_out(){
        if (!is_user_logged_in() && !is_home()){
            $redirect = home_url() . '/wp-login.php?redirect_to=' . urlencode( $_SERVER['REQUEST_URI'] );
            wp_redirect( $redirect );
            exit;
        }
    }
    add_action( 'wp', 'restrict_access_if_logged_out', 3 );

    Now when someone tries to follow a link to private content without being logged in, they will be routed to the login form, and then once they have logged in they will be redirected to the original URL they were attempting to reach.

    Yikes!!! Please disregard the earlier code. I can’t seem to delete it. Apparently it was directing all traffic to my website to the login page. Guess I should stop messing around in code I don’t completely understand!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Digest links to private group content: some 404, some do not’ is closed to new replies.