Giter Site home page Giter Site logo

strangerstudios / pmpro-bbpress Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 17.0 740 KB

Restrict access to bbPress for free or premium members by integrating bbPress with the top WordPress membership plugin Paid Memberships Pro.

Home Page: https://www.paidmembershipspro.com/add-ons/pmpro-bbpress/

PHP 86.00% Shell 14.00%
bbpress paid-memberships-pro strangerstudios-product wordpress wordpress-plugin

pmpro-bbpress's People

Contributors

andrewlimaza avatar dparker1005 avatar eighty20results avatar femiyb avatar github-actions[bot] avatar greathmaster avatar ideadude avatar jarrydlong avatar kimcoleman avatar mauteri avatar messica avatar michaelbeil avatar positivejam avatar rafiahmedd avatar scottsousa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pmpro-bbpress's Issues

Feature Requests from Forum

The new plugin allows you to specify if a plan/membership can have private & public messaging.

- It is very much needed to have the ability to say how many messages in a day.

This allows you to give limited use to free users and charge for higher usage/membership plan. (Also allows you to prevent large amounts of spam from free/bogus users yet still stimulating community growth by allow free users to send messages.)

- Allowing & limiting the ability to private/public message “multiple people” at one time.

3.9.1 Compatibility Issue?

Testing in WP 3.9.1 with only bbPress, PMP Pro and PMP Pro bbPress activated, on a new WP install (just a week or so old) -

Setup 2 sample levels in PMP Pro, 3 sample forums with one child forum. Set both top-level forums to the first level (free), set the child forum to the second level (paid).

When I set my membership level to free I'm unable to view any forum (including the top-level forums and forum index), and presented with the notice that the forum is restricted to those with xyz level membership.

If I set my membership level to paid I'm obviously able to view all forums.

Happy to provide further information, etc if it will help debug an issue. :)

Call to undefined function when Paid Memberships Pro is deactivated

We should do a pass on this add on to ensure that all functions are properly checked so that errors aren't triggered when Paid Memberships Pro is deactivated. Currently throwing an error on line 189:

Call to undefined function pmpro_getMembershipLevelForUser() in pmpro-bbpress.php on line 189

Disable forum post update emails for non-members

Is your feature request related to a problem? Please describe.
Non-members and users without a bbPress forum role, e.g. spectator role, receive forum update emails for topics they've subscribed to previously.

Describe the solution you'd like
Non-members and users without a spectator role should not get forum emails for subscribed topics.

Describe alternatives you've considered
The user that requested this feature reported tweaking code from the bbPress Toolkit that seems abandoned as there has not been an update for this in the past 5 years.

Here's the example shared by them:

// Spectator users should NOT get an email to subscribed topics
// Waiting for https://bbpress.trac.wordpress.org/ticket/3046
function bbptoolkit_fltr_get_forum_subscribers( $user_ids ) {
	if ( ! empty( $user_ids ) ) {
		$new_user_ids = array();
		foreach ( $user_ids as $uid ) {
			if ( bbp_get_user_role( $uid ) != ‘bbp_spectator’ ) {
				$new_user_ids[] = $uid;
			}
		}
		return $new_user_ids;
	} else {
		return $user_ids;
	}
};
// add the filter
add_filter( ‘bbp_forum_subscription_user_ids’, ‘bbptoolkit_fltr_get_forum_subscribers’, 10, 1 );

Additional context
Moderators: #502396

Fatal error: Uncaught Error: Call to a member function get()

Prerequisites

  • [X ] I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • [X ] The issue still exists against the latest dev branch of Paid Memberships Pro on Github (this is not the same version as on WordPress.org!)
  • [X ] I have attempted to find the simplest possible steps to reproduce the issue

Steps to reproduce the issue

  1. pmpro-bbpress error when accessing existing WP Forms

Expected/actual behavior

When I follow those steps, I see...

Fatal error: Uncaught Error: Call to a member function get() on null in /var/www/wp-includes/query.php:28 Stack trace: #0 /var/www/wp-content/plugins/bbpress/includes/common/template.php(2165): get_query_var('_bbp_query_name') #1 /var/www/wp-content/plugins/bbpress/includes/common/template.php(2154): bbp_get_query_name() #2 /var/www/wp-content/plugins/bbpress/includes/common/template.php(922): bbp_is_query_name('bbp_search_resu...') #3 /var/www/wp-content/plugins/pmpro-bbpress/pmpro-bbpress.php(63): bbp_is_search_results() #4 /var/www/wp-includes/class-wp-hook.php(287): pmprobb_filter_forum_search_results(Object(WP_Query)) #5 /var/www/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(Object(WP_Query), Array) #6 /var/www/wp-includes/plugin.php(544): WP_Hook->do_action(Array) #7 /var/www/wp-includes/class-wp-query.php(1779): do_action_ref_array('pre_get_posts', Array) #8 /var/www/wp-includes/class-wp-query.php(3448): WP_Query->get_posts() #9 /var/www/wp-includes/post.php(2053): WP_Query->query(Array) #10 /var/www/w in /var/www/wp-includes/query.php on line 28

I was expecting to see...

Existing WP Forms

Isolating the problem

  • [X ] This bug happens with only Paid Memberships Pro plugin active
  • This bug happens with a default WordPress theme active, or Memberlite
  • [X ] I can reproduce this bug consistently using the steps above

WordPress Environment

``` Please share non-sensitive information about your hosting environment such as WordPress version, PHP version, Paid Memberships Pro and any related plugins versions. ```

Administrators cannot access the forums

I installed this but as an administrator I cannot access them. Either all administrators should get access regardless of membership plans, or there is an option to allow administrators.

New Feature request

Hi,
We are trying to have a bbpress with paid membership pro site where we would like the non members to see the forum and the topics.
BUT only paid members would see the reply

So it would be nice to control membership access to all or certain topics and same with replies. so that all replies are auto set for members.

I could even see letting non paid members post a question but have to register to see the answer.

Feature request from forum

Two great features seem to be missing. Hope you will add soon…

- Ability to ad membership badge under avatar saying person is a paid member. i.e. “Pro” or “Basic” for example.

- Ability to add user forum signature to certain membership levels. This is a great feature to generate membership sales on a site.

Needs more customization of error message

The error message when visiting a restricted forum ("This forum is for members only.") needs more customization ability. Right now the text gets slapped onto the top of the page and in my case is appended to the breadcrumb trail. It's very hard to see and also looks bad.

The ability to add a few html tags like div or p or br, or the ability ot adjust text size or weight would go a long way to help make the error message more visible.

Forum role per membership level not set

When the bbPress default forum role is set as "Participant" and setting a different forum role, e.g. "Spectator", on a membership level configuration page the user is still assigned the default bbPress "Participant" forum role after checkout instead of the forum role set for the membership level.

As a temporary workaround, adding this code to a customization plugin assigns the forum role set per level.
https://gist.github.com/pbrocks/36b3d84c075ec6d8a0a6b6f6edd15c00

Maybe need a conditional to check if bbPress plugin is installed and active?

Fatal error: Call to undefined function bbp_get_forum_id() in /home/vmk/public_html/wp-content/plugins/pmpro-bbpress/pmpro-bbpress.php on line 113

Not a big problem because the cause is obvious... but something like this I use in our Child Themes to check for WooCommerce might work?

/-----------------------------------------------------------------------------------/
/* Step Two) Check whether WooCommerce is installed - dismissible nag notice etc.----/
/
-----------------------------------------------------------------------------------*/

if (!class_exists('woocommerce')) {
/* Display a notice that can be dismissed /
add_action('admin_notices', 'lab_woocommerce_admin_notice');
function lab_woocommerce_admin_notice() {
if ( current_user_can( 'edit_theme_options' ) );
global $current_user ;
$user_id = $current_user->ID;
/
Check that the user hasn't already clicked to ignore the message */
if ( ! get_user_meta($user_id, 'lab_woocommerce_ignore_notice') ) {
echo '

';
printf(__('We recommend you install and activate the WooCommerce plugin for all of this theme's functionality to work | Hide Notice'), '?lab_woocommerce_nag_ignore=0');
echo "

";
}
}

add_action('admin_init', 'lab_woocommerce_nag_ignore');
function lab_woocommerce_nag_ignore() {
if ( current_user_can( 'edit_theme_options' ) );
global $current_user;
$user_id = $current_user->ID;
/* If user clicks to ignore the notice, add that to their user meta */
if ( isset($_GET['lab_woocommerce_nag_ignore']) && '0' == $_GET['lab_woocommerce_nag_ignore'] ) {
add_user_meta($user_id, 'lab_woocommerce_ignore_notice', 'true', true);
}
}
} // End class_exists('woocommerce') (line 31 )

/**

  • Check if WooCommerce is active
    **/
    if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {

// Set path to WooFramework and theme specific functions
$woocommerce_path = get_stylesheet_directory() . '/woocommerce/';

// WooCommerce
require_once ($woocommerce_path . 'theme-install.php' ); // WooCommerce Install
require_once ($woocommerce_path . 'woocommerce-layout.php' ); // WooCommerce Layout
require_once ($woocommerce_path . 'woocommerce-functions.php' ); // WooCommerce Functions

} // End woocommerce.php check (line 63 )

CSS Class set to only one level.

The CSS class is setting user's to only one membership level and not adjusting dynamically, causing the BBPress role background color to not work as intended.

Reenabling the pmpro_search_filter causes issues if that setting is off.

If you turn off the pmpro search filter on the PMPro advanced levels page, but do have the PMPro bbPress setting to hide forums from members, PMPro bbPress will turn the filter back on for all post types.

The core PMPro search filter seems to need a refactoring.

But in the meantime, we can potentially only enable the forum filter on the forum archive. Would look like this:

/**

  • Init
    */
    function pmprobb_init() {
    $options = pmprobb_getOptions();
    if(!empty($options['hide_member_forums']) && function_exists('bbp_is_forum_archive') && bbp_is_forum_archive() ) {
    add_filter( 'pre_get_posts', 'pmpro_search_filter' );
    add_filter( 'pmpro_search_filter_post_types', 'pmprobb_pmpro_search_filter_post_types' );
    }
    }
    add_action('init', 'pmprobb_init');

Move this code to the top of the pmpro-bbpress.php page and add the bbp_is_forum_archive check as we do here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.