I'm building a community-website with wordpress 4.8 and bbPress Version 2.5.12 installed. I also installed a plugin called Paid Memberships Pro (and an extension that's made for bbPress) that handles the permissions in my forum.
What I would like to add is a redirect to a page on my site which is happening in the moment somebody without the permissions clicks on the member-area. The page that will open will speak about the benefits of joining.
Wordpress itself and the member plugin both only allow me to insert a text that is displayed in case somebody without the permissions try to enter the member-area. This text is small and doesn't contain enough information and I rather prefer to redirect to another page.
I have two problems with this.
First I am not sure if I rather change this in the wordpress settings or the plugin settings. Right now the plugin overrides the settings of wordpress (meaning if I have two different texts in wordpress and the plugin it picks the text from the plugin). So I could change it in the plugin or I change it in wordpress but have to simultaneously tell wordpress to read it's own file instead of the one in the plugins directory (I would say it makes more sense to change it in the plugin but I wanted to make sure).
Second I don't know how to change this code so that it's actually redirecting. I only got as far as breaking the site or nothing at all is happening.
If I go to the file feedback-no-access.php in the bbpress-folder it includes the following code:
<?php
/**
* No Access Feedback Part
*
* @package bbPress
* @subpackage Theme
*/
?>
<div id="forum-private" class="bbp-forum-content">
<h1 class="entry-title"><?php _e( 'Private', 'bbpress' ); ?></h1>
<div class="entry-content">
<div class="bbp-template-notice info">
<p><?php _e( 'You do not have permission to view this forum.',
'bbpress' ); ?></p>
</div>
</div>
</div><!-- #forum-private -->
In the members-plugin I find the following lines:
/**
* Error Message Option
*/
function pmprobb_option_error_message() {
$options = pmprobb_getOptions();
if(isset($options['error_message']))
$error_message = $options['error_message'];
else
$error_message = "";
?>
<input id='pmprobb_option_error_message' name='pmprobb_option_error_message' size='40' type='text' value='<?php echo esc_attr($error_message);?>' />
<small>This message is shown when users attempt to view a forum or thread they don't have access to.</small>
<?php
}
I tried to edit this second block of code so that it's not searching for this message but redirecting to an url I want to point to. But nothing really worked out and I hope that somebody can help me out with that! Thank you
I could solve it by myself without changing the code (which wasn't really possible for me as I don't have enough knowledge).
I found a plugin called redirection and it works perfectly fine. Whenever I click on a forum that I have no access to it redirects me to the page I want it to go to. I don't know if this is a good practice but it works perfectly fine!