• Dashboard
    • Submit Ticket
    • Licenses
    • Login
  • Our Products
    • BuddyBuilder
    • Kleo
    • Typer
    • Seeko
    • SweetDate
    • BuddyApp
  • Services
    • VIP Support
    • WordPress Theme Installation Service
  1. Home
  2. SweetDate
  3. Free Females Only or Free Males Only Membership Paid Memberships Pro

Free Females Only or Free Males Only Membership Paid Memberships Pro

NOTICE: This post is outdated and it is possible not to work as expected.

NOTE: If you are using a different field for gender, change “I am a” with the name of your gender field

To assign a free membership to female users once they register, add the following code to your functions.php at child theme

COPY CODE
/**
* When registering, add the member to a specific membership level
* based on the field value he has selected
*
* @global object $wpdb
* @global object $bp
* @param integer $user_id
*/
function kleo_pmpro_default_level($user_id) {
    global $wpdb, $bp;
 
    //Change this with your field name
    $field_name= "I am a";
 
    //Change the field value
    $value_to_match = "Woman";
 
    //Membership level id
    $membership_level = 1;
 
    //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);
    }
}
 
function kleo_mu_pmpro_default_level($user_id, $password, $meta) {
    global $bp, $wpdb;
 
    //Change this with your field name
    $field_name= "I am a";
 
    //Change the field value
    $value_to_match = "Woman";
 
    //Membership level id
    $membership_level = 1;
 
    
    //Done editing
    $field_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_fields} WHERE name = %s", $field_name ) );
    $field_value = $meta['field_'.$field_id];
    if ( $field_value == $value_to_match ) {
        pmpro_changeMembershipLevel($membership_level, $user_id);
    }
}
 
if (is_multisite()) {
    add_action( 'wpmu_activate_user', 'kleo_mu_pmpro_default_level', 10, 3);
} else {
    add_action('user_register', 'kleo_pmpro_default_level');
}

To assign a free membership to male users once they register, add the following code to your functions.php at child theme

COPY CODE
/**
* When registering, add the member to a specific membership level
* based on the field value he has selected
*
* @global object $wpdb
* @global object $bp
* @param integer $user_id
*/
function kleo_pmpro_default_level($user_id) {
    global $wpdb, $bp;
 
    //Change this with your field name
    $field_name= "I am a";
 
    //Change the field value
    $value_to_match = "Woman";
 
    //Membership level id
    $membership_level = 1;
 
    //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);
    }
}
 
function kleo_mu_pmpro_default_level($user_id, $password, $meta) {
    global $bp, $wpdb;
 
    //Change this with your field name
    $field_name= "I am a";
 
    //Change the field value
    $value_to_match = "Man";
 
    //Membership level id
    $membership_level = 1;
 
    
    //Done editing
    $field_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_fields} WHERE name = %s", $field_name ) );
    $field_value = $meta['field_'.$field_id];
    if ( $field_value == $value_to_match ) {
        pmpro_changeMembershipLevel($membership_level, $user_id);
    }
}
 
if (is_multisite()) {
    add_action( 'wpmu_activate_user', 'kleo_mu_pmpro_default_level', 10, 3);
} else {
    add_action('user_register', 'kleo_pmpro_default_level');
}

Blazing Fast Site Hosting & Maintenance

  • Welcome to SweetDate!
  • Theme Requirements
  • WordPress Installation
  • Install Theme & Setup
  • Search Form Setup for 3.0
  • Updating to SweetDate 3.4
  • Verify server configuration and theme requirements
  • How to manually update the theme
  • Theme Automatic Updates
  • BuddyPress overview
  • Elementor overview
  • bbPress overview
  • Memberships
  • Membership overview
  • rtMedia overview
  • Restrict website for non logged in members
  • Extended features
  • Paid Memberships Pro
  • Revolution Slider plugin
  • Woocommerce
  • Enabling BuddyPress Groups
  • GEO My WP + Sweetdate: Add a map search and location
  • Add link to element or button in Revolution Slider 6.x
  • Introduction to the child theme
  • How to Change the Search and Register Form Colors
  • Contact Page
  • Pages and Menu
  • Overriding a file with the child theme
  • How to add Members Stats Section using Elementor
  • Theme options overview
  • Import / Export Options
  • Contact and social settings
  • Buddypress settings
  • Styling options
  • Layout Settings
  • General Settings
  • Footer structure and widgets
  • Widgets and sidebar
  • Page Templates
  • Find Theme Purchase Code
  • Translate theme with Loco Translate
  • Multilingual setup using WPML plugin
  • Image Slider Shortcode
  • Icons Shortcode
  • Layout shortcodes
  • Recent groups Shortcode
  • Top members Shortcode
  • Member Statistics Shortcode
  • Buddypress User Data Shortcodes
  • Homepage status icon shortcode
  • Restrict content shortcode
  • Blog Articles Shortcode
  • Headings shortcodes
  • Video button shortcode
  • Posts carousel Shortcode
  • Pricing Table Shortcode
  • Panel Shortcode
  • Accordion Shortcode
  • Tabs Shortcode
  • Progress Bar Shortcode
  • Alert Shortcode
  • Buttons Shortcode
  • Missing Post Update Button on Buddypress ( Activity and Groups )
  • Changelog
  • Javascript Files
  • CSS Files and Structure
  • HTML Structure
  • Testimonials
  • My site is slow. How to speed up my website?
  • Included PSD Files
  • Post formats
  • Accordion Shortcode
  • RESPONSIVE guidelines
  • Theme Folder structure
  • GeoNames integration - City Autocomplete
  • How to add a Populated Country List XPROFILE
  • More Visible Discount Code Text (PMPRO Checkout)
  • How to Customize Women Online and Men Online Counters - WITHOUT ELEMENTOR
  • Full Width Profile Fields
  • How to move Search form to the right side of the screen
  • How to Delete the Link from the Website Logo
  • Search Results Show Wrong Gender - SOLUTION
  • Free Females Only or Free Males Only Membership Paid Memberships Pro
  • How to add Profile Fields under Member Name at Members Directory
  • Error 404 - Page not found
  • Change "SIGN UP" URL at Modal Popup
  • Troubleshooting an issue
BuddyBuilder is out. Total freedom to build online communities
SeventhQueen  - 2021 - Privacy Policy

Welcome to SeventhQueen Portal


Lost your password?

Don't have an account? Register now!

Forgot your details?



Wait, I remember now. Log In

Register your account

Sign up with Email
I have an account. Log In

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.