Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to remove Email settings from users profile setting & disable emails


  • waqastechlover
    Participant

    @waqastechlover

    Hi all!
    I want to know that how can I remove email tab from the settings page of users profile.
    I mean that when a user opens his profile and go to settings. There is an Email tab to let the user to decide which email notifications he would like to receive. I want to remove this tab completely.
    I also want to disable every email notifications for users by default.
    Please tell me how to do both of these things. I shall be very very grateful!
    Thanks a lot in advance and best Regards, Waqas Ramzan Techlover, Web Master of Blind Help Project (BHP) http://www.blindhelp.tk

    Using latest version of WordPress and BuddyPress and the latest version of responsive theam.

Viewing 2 replies - 1 through 2 (of 2 total)

  • shanebp
    Moderator

    @shanebp

    This will remove the Email tab.

    function waqas_remove_friends_activity_nav() {
    	bp_core_remove_subnav_item( 'settings', 'notifications' );
    }
    add_action( 'bp_setup_nav', 'waqas_remove_friends_activity_nav', 15 );

    This will set all the notification settings to ‘no’ for a specific user:

    function waqas_email_notifications( $user_id ) {
    	
    	$settings = bp_settings_get_registered_notification_keys(); 
    	
    	foreach ( $settings as $setting ) {
    		bp_update_user_meta( $user_id, $setting, 'no' );
    	}
    	
    }

    For new users, you could do this:

    function waqas_bp_core_activated_user(  $user_id, $key, $user ) {
         waqas_email_notifications( $user_id );
    }
    add_action( 'bp_core_activated_user', 'waqus_bp_core_activated_user', 10, 3 );

    hoodler
    Participant

    @hoodler

    Where can I put this code to remove the email tab from the settings?

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar