BuddyDev

Search

Replies

  • Keymaster
    (BuddyDev Team)
    Posts: 25206

    Hi Soren,
    Thank you for the question.

    Please use Group Tabs Creator to do that. You already purchased it couple of months ago.

    Let me know if you face any issue.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25206
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 25206
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 25206
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 25206

    Hi Nifty,
    I am sorry for the inconvenience.

    We introduced a new settings panel and it seems that it did not work properly. Can you please update the settings from the new panel and see if that works?

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25206
    Brajesh Singh on in reply to: Members filters #47879
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 25206

    You are welcome 🙂

  • Keymaster
    (BuddyDev Team)
    Posts: 25206

    Hi,
    You are accessing the formatted value for display.

    Please use the raw value using

    
    
    $values = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $field_id, $user_id ) );
    
    

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25206
    Brajesh Singh on in reply to: [Resolved] BuddyPress Registration Control #47876

    Hi Tosin,
    The problem with above code is the option group name and section name.

    Please find it updated here.

    
    <?php
    /*
    * Plugin Name: BuddyPress Registration Control
    * Description: Allows administrators to enable or disable user registration and select a URL to redirect to when registration is disabled.
    * Version: 1.0
    */
    
    // Register the new setting in the BuddyPress options group
    function custom_bp_register_settings() {
    	register_setting( 'buddypress', 'bp-disable-site-registration', 'sanitize_text_field' );
    	register_setting( 'buddypress', 'bp-disable-site-registration-redirection-url', 'sanitize_text_field' );
    }
    add_action( 'bp_register_admin_settings', 'custom_bp_register_settings' );
    
    // Add the new setting to the BuddyPress options page
    function custom_bp_add_settings_field() {
    	add_settings_field(
    		'bp-disable-site-registration',
    		__( 'Registration', 'buddypress' ),
    		'custom_bp_settings_field_html',
    		'buddypress',
    		'bp_main',
    		array(
    			'label_for' => 'bp-disable-site-registration',
    		)
    	);
    	add_settings_field(
    		'bp-disable-site-registration-redirection-url',
    		__( 'Redirection URL', 'buddypress' ),
    		'custom_bp_settings_redirection_url_html',
    		'buddypress',
    		'bp_main',
    		array(
    			'label_for' => 'bp-disable-site-registration-redirection-url',
    		)
    	);
    }
    add_action( 'bp_register_admin_settings', 'custom_bp_add_settings_field', 10, 1 );
    
    // Output the HTML for the setting field
    function custom_bp_settings_field_html() {
    	$value = get_option( 'bp-disable-site-registration', 'open' );
    	?>
    	<select name="bp-disable-site-registration" id="bp-disable-site-registration">
    		<option value="open" <?php selected( $value, 'open' ); ?>><?php _e( 'Open', 'buddypress' ); ?></option>
    		<option value="closed" <?php selected( $value, 'closed' ); ?>><?php _e( 'Closed', 'buddypress' ); ?></option>
    	</select>
    	<?php
    }
    
    // Output the HTML for the redirection URL field
    function custom_bp_settings_redirection_url_html() {
    	$value = get_option( 'bp-disable-site-registration-redirection-url' );
    	?>
    	<input type="text" name="bp-disable-site-registration-redirection-url" id="bp-disable-site-registration-redirection-url" value="<?php echo esc_attr( $value ); ?>" />
    	<?php
    }
    
    // Redirect users if registration is closed
    function custom_bp_redirect_registration() {
    	if ( get_option( 'bp-disable-site-registration' ) === 'closed' ) {
    		wp_redirect( get_option( 'bp-disable-site-registration-redirection-url' ) );
    		exit;
    	}
    }
    add_action( 'bp_screens', 'custom_bp_redirect_registration' );
    
    

    I did not go through other sections of your code. In case you need assistance there, I can look into that.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25206
    This reply has been marked as private.