Shape the future of Social networking with WordPress: Join Project Midnight Sun! The next generation platform for community building with WordPress!

BuddyDev

Search

Replies

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

    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: 25486
    Brajesh Singh on in reply to: Members filters #47879
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 25486

    You are welcome 🙂

  • Keymaster
    (BuddyDev Team)
    Posts: 25486

    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: 25486
    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: 25486
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 25486

    Hi,
    It seems your subscription for the Moderation tools expired. That’s why you were unable to download it.

    I have shared a copy via google drive. If it asks for login, Please use the link from my next reply. I will be marking the link private after next 24 hours.

    Regards
    Brajesh