inc/class-Iac_Profile_Settings.php
public function save_user_settings( $user_id, $inform_about_posts = NULL, $inform_about_comments = NULL ) {

		if ( ! current_user_can( 'edit_user', $user_id ) )
			return FALSE;

		/**
		 * TRUE: everyone is subscribed by default
		 * FALSE: no one is subscribed by default
		 * @link https://github.com/inpsyde/Inform-about-Content/issues/23
		 */
		$subscribed_by_default      = apply_filters( 'iac_default_opt_in', FALSE );
		$prev_inform_about_posts    = get_user_meta( $user_id, 'post_subscription', TRUE );
		$prev_inform_about_comments = get_user_meta( $user_id, 'comment_subscription', TRUE );

		if ( ! $subscribed_by_default ) {
			if ( is_null( $inform_about_posts ) && '' === $prev_inform_about_posts ) {
				#nothing to do, user didn't changed the default behaviour
				$inform_about_posts = NULL;
			} elseif ( is_null( $inform_about_posts ) ) {
				$inform_about_posts = '0';
			} else {
				$inform_about_posts = '1';
			}

			if ( is_null( $inform_about_comments ) && '' === $prev_inform_about_comments ) {
				$inform_about_comments = NULL;
			} elseif ( is_null( $inform_about_comments ) ) {
				$inform_about_comments = '0';
			} else {
				$inform_about_comments = '1';
			}
		} else {
			if ( ! is_null( $inform_about_posts ) && '' === $prev_inform_about_posts ) {
				// nothing to do, the user didn't changed the default behavior
				$inform_about_posts = NULL;
			} elseif ( ! is_null( $inform_about_posts ) ) {
				$inform_about_posts = '1';
			} else {
				$inform_about_posts = '0';
			}

			if ( ! is_null( $inform_about_comments ) && '' === $prev_inform_about_comments ) {
				$inform_about_comments = NULL;
			} elseif ( ! is_null( $inform_about_comments ) ) {
				$inform_about_comments = '1';
			} else {
				$inform_about_comments = '0';
			}
		}

		if ( isset( $inform_about_posts ) )
			update_user_meta( $user_id, 'post_subscription', $inform_about_posts );

		if ( isset( $inform_about_comments ) )
			update_user_meta( $user_id, 'comment_subscription', $inform_about_comments );

		return TRUE;
	}
public function save_user_settings( $user_id, $inform_about_posts = NULL, $inform_about_comments = NULL ) {

		if ( ! current_user_can( 'edit_user', $user_id ) )
			return FALSE;

		/**
		 * TRUE: everyone is subscribed by default
		 * FALSE: no one is subscribed by default
		 * @link https://github.com/inpsyde/Inform-about-Content/issues/23
		 */
		$subscribed_by_default      = apply_filters( 'iac_default_opt_in', FALSE );
		$prev_inform_about_posts    = get_user_meta( $user_id, 'post_subscription', TRUE );
		$prev_inform_about_comments = get_user_meta( $user_id, 'comment_subscription', TRUE );

		if ( ! $subscribed_by_default ) {
			if ( is_null( $inform_about_posts ) && '' === $prev_inform_about_posts ) {
				#nothing to do, user didn't changed the default behaviour
				$inform_about_posts = NULL;
			} elseif ( is_null( $inform_about_posts ) ) {
				$inform_about_posts = '0';
			} else {
				$inform_about_posts = '1';
			}

			if ( is_null( $inform_about_comments ) && '' === $prev_inform_about_comments ) {
				$inform_about_comments = NULL;
			} elseif ( is_null( $inform_about_comments ) ) {
				$inform_about_comments = '0';
			} else {
				$inform_about_comments = '1';
			}
		} else {
			if ( ! is_null( $inform_about_posts ) && '' === $prev_inform_about_posts ) {
				// nothing to do, the user didn't changed the default behavior
				$inform_about_posts = NULL;
			} elseif ( ! is_null( $inform_about_posts ) ) {
				$inform_about_posts = '1';
			} else {
				$inform_about_posts = '0';
			}

			if ( ! is_null( $inform_about_comments ) && '' === $prev_inform_about_comments ) {
				$inform_about_comments = NULL;
			} elseif ( ! is_null( $inform_about_comments ) ) {
				$inform_about_comments = '1';
			} else {
				$inform_about_comments = '0';
			}
		}

		if ( isset( $inform_about_posts ) )
			update_user_meta( $user_id, 'post_subscription', $inform_about_posts );

		if ( isset( $inform_about_comments ) )
			update_user_meta( $user_id, 'comment_subscription', $inform_about_comments );

		return TRUE;
	}
public function save_user_settings ( $ user_id , $ inform_about_posts = NULL , $ inform_about_comments = NULL ) { if ( ! current_user_can ( 'edit_user' , $ user_id ) ) return FALSE ; /**
		 * TRUE: everyone is subscribed by default
		 * FALSE: no one is subscribed by default
		 * @link https://github.com/inpsyde/Inform-about-Content/issues/23
		 */ $ subscribed_by_default = apply_filters ( 'iac_default_opt_in' , FALSE ) ; $ prev_inform_about_posts = get_user_meta ( $ user_id , 'post_subscription' , TRUE ) ; $ prev_inform_about_comments = get_user_meta ( $ user_id , 'comment_subscription' , TRUE ) ; if ( ! $ subscribed_by_default ) { if ( is_null ( $ inform_about_posts ) && '' === $ prev_inform_about_posts ) { #nothing to do, user didn't changed the default behaviour $ inform_about_posts = NULL ; } elseif ( is_null ( $ inform_about_posts ) ) { $ inform_about_posts = '0' ; } else { $ inform_about_posts = '1' ; } if ( is_null ( $ inform_about_comments ) && '' === $ prev_inform_about_comments ) { $ inform_about_comments = NULL ; } elseif ( is_null ( $ inform_about_comments ) ) { $ inform_about_comments = '0' ; } else { $ inform_about_comments = '1' ; } } else { if ( ! is_null ( $ inform_about_posts ) && '' === $ prev_inform_about_posts ) { // nothing to do, the user didn't changed the default behavior $ inform_about_posts = NULL ; } elseif ( ! is_null ( $ inform_about_posts ) ) { $ inform_about_posts = '1' ; } else { $ inform_about_posts = '0' ; } if ( ! is_null ( $ inform_about_comments ) && '' === $ prev_inform_about_comments ) { $ inform_about_comments = NULL ; } elseif ( ! is_null ( $ inform_about_comments ) ) { $ inform_about_comments = '1' ; } else { $ inform_about_comments = '0' ; } } if ( isset ( $ inform_about_posts ) ) update_user_meta ( $ user_id , 'post_subscription' , $ inform_about_posts ) ; if ( isset ( $ inform_about_comments ) ) update_user_meta ( $ user_id , 'comment_subscription' , $ inform_about_comments ) ; return TRUE ; }
save user data passed to this function
applied to the action 'iac_save_user_settings'
so you can add user-settings forms to your theme/frontend or anywhere

it's intended to change the behaviour (mail-notification) for each user
who didn't ever touch these settings, when the default behaviour (opt-in/opt-out)
changes.

@param int $user_id
@param string $inform_about_posts
@param string $inform_about_comments

@return bool
save user data passed to this function applied to the action iac_save_user_settings so you can add user - settings forms to your theme / frontend or anywhere