Tagged: guests, lightbox, mediapress
Hi Richard,
Please put the following code in your bp-custom.php/** * Redirect to login page on accessing single media for non logged. */ function mpp_custom_single_media_access_restriction() { if ( ! function_exists( 'mpp_is_single_media' ) || ! mpp_is_single_media() || is_user_logged_in() ) { return; } // Redirect to login page. bp_core_redirect( wp_login_url() ); } add_action( 'bp_template_redirect', 'mpp_custom_single_media_access_restriction' ); /** * Do not load lightbox for non logged users. * * @param array $settings settings. * * @return array */ function mpp_custom_filter_lightbox_options( $settings ) { if ( ! did_action( 'init' ) || is_user_logged_in() ) { return $settings; } // if we are here, user is not logged and it is after init action. $settings['load_lightbox'] = 0; return $settings; } add_filter( 'mpp_settings', 'mpp_custom_filter_lightbox_options' );
Currently, we don’t have filter for individual option, so we had to filter the settings array. In future, I will add a way to filter individual option too.
Please do let me know if the code works for you or not?
Regards
Brajeshhi Brajesh,
this is really helpful. Given that I have some other redirects going on (not directly related to this), I’m going to have to work through them all one at a time to make sure I’m not going into an endless (or pointless) loop anywhere. This might take me a little while, so it will probably be tomorrow before I can offer any proper feedback.
At first sight this looke like either one or the other of these suggestions will do the job nicely. Many, many, thanks for your assistance!
R.
Hi Richard,
Thank you.
No problem with the delay. I am looking forward to your feedback.Best regards
Brajeshhi Brajesh,
this is functioning as expected. It took me a while to work out why it wasn’t at first, and it turned out I had another “feature” enabled which rerouted around the request, once I’d found that and fixed it everything behaved correctly.
I do realize this is somewhat outside your remit of support for your own plugins, so an extra many thanks again for your assistance with this!
R.
Hi Richard,
Thank you for the details.
I am glad it is resolved. Always happy to assist 🙂Regards
Brajesh
The topic ‘ [Resolved] Assist with lightbox display for guests’ is closed to new replies.