Skip to:
Content
Pages
Categories
Search
Top
Bottom

My code to give access with pmp has stopped working


  • powebdesign
    Participant

    @powebdesign

    Hello, I had this code, what it does is that certain users already enter with a subscription and can use the chat without having to pay. When updating to the latest version the code no longer works. Any idea what has changed?:
    add_filter(‘bp_get_total_member_count’,’bpfr_hide_get_total_filter’);
    function kleo_pmpro_default_level($user_id) {
    global $wpdb, $bp;

    //Change this with your field name
    $field_name= “i am”;

    //Change the field value
    $value_to_match = “woman”;

    //Membership level id
    $membership_level = 4;

    //Done editing
    $field_id = $wpdb->get_var( $wpdb->prepare( “SELECT id FROM {$bp->profile->table_name_fields} WHERE name = %s”, $field_name ) );
    if ($_POST[‘field_’.$field_id] == $value_to_match) {
    pmpro_changeMembershipLevel($membership_level, $user_id);
    }
    }

    if (is_multisite()) {
    add_action( ‘wpmu_activate_user’, ‘kleo_mu_pmpro_default_level’, 10, 4);
    } else {
    add_action(‘user_register’, ‘kleo_pmpro_default_level’);
    }

    Thanks!

  • You must be logged in to reply to this topic.
Skip to toolbar