Skip to content

Instantly share code, notes, and snippets.

View ThemeGravity's full-sized avatar

Jarek ThemeGravity

View GitHub Profile
@ThemeGravity
ThemeGravity / memberpress-if-menu-custom-rule.php
Last active October 29, 2019 10:38
If Menu custom rule for MemberPress
<?php
function mepr_custom_rule_menu_condition( $conditions ) {
$conditions[] = array(
'id' => 'memberpress-rule-50', // unique ID for the rule
'name' => __( 'Memberpress access rule 50', 'i18n-domain' ), // name of the rule
'condition' => function( $item ) { // callback - must return Boolean
return current_user_can( 'mepr-active','membership: 50' ); // paste MemberPress condition here and returns it
}
);
@ThemeGravity
ThemeGravity / render_file_links.php
Last active March 4, 2020 10:14
Add multiply categories, tags and relation
@ThemeGravity
ThemeGravity / sub_trial_reminder.php
Last active October 7, 2024 14:38
Disable Before Subscription Trial Ends reminder for canceled membership
<?php
add_filter('mepr-sub-trial-ends-reminder-disable', function($disable_email, $reminder, $usr, $prd, $event) {
global $wpdb;
// Membership ID with trial
$trial_membership_id = 2973;
$active_subs = $usr->active_product_subscriptions();
// User is not active on any membership - so let's not send the reminder