File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
integration-compatibility Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Disable Popup Builder popups if the user has a membership level.
4+ *
5+ * Popup Builder is a plugin available in the WordPress.org Repo here:
6+ * https://wordpress.org/plugins/popup-builder/
7+ *
8+ * title: Disable Popup Builder popups if the user has a membership level.
9+ * layout: snippet
10+ * collection: integration-compatibility
11+ * category: content, popup-builder
12+ * link: https://www.paidmembershipspro.com/membership-logic-enable-disable-popups-popup-maker-popups-optinmonster/
13+ *
14+ * You can add this recipe to your site by creating a custom plugin
15+ * or using the Code Snippets plugin available for free in the WordPress repository.
16+ * Read this companion article for step-by-step directions on either method.
17+ * https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
18+ */
19+ function my_pmpro_pub_disable_popups_for_members ( $ popup ) {
20+ // Bail if the user has a membership level.
21+ if ( function_exists ( 'pmpro_hasMembershipLevel ' ) && ! pmpro_hasMembershipLevel () ) {
22+ return $ popup ;
23+ }
24+
25+ // Popups with these IDs will be disabled for members.
26+ $ non_member_popup_ids = array ( 123 , 335 );
27+
28+ // Disable popup.
29+ if ( in_array ( $ popup ['id ' ], $ non_member_popup_ids ) ) {
30+ $ popup ['status ' ] = false ;
31+ }
32+
33+ return $ popup ;
34+ }
35+ add_filter ( 'sgpbOtherConditions ' , 'my_pmpro_pub_disable_popups_for_members ' );
You can’t perform that action at this time.
0 commit comments