ID ) ) : if ( is_user_favorite( $userdata->ID, $topic_id ) ) : $topic = get_topic($topic_id); $message = __("There is a new post on: %1\$s \nReply by: %2\$s \n\n%3\$s "); mail( $userdata->user_email, bb_get_option('name') . ':' . __('Notification'), sprintf( $message, $topic->topic_title, get_user_name($bb_current_user->ID), get_topic_link($topic_id) ), 'From: ' . bb_get_option('admin_email') ); endif; endif; endforeach; } add_action('bb_new_post', 'notification_new_post'); function notification_select_all_users() { global $bbdb; $all_users = $bbdb->get_results("SELECT ID, user_email FROM $bbdb->users WHERE user_status=0"); return $all_users; } function notification_profile() { global $user_id, $bb_current_user; if ( bb_is_user_logged_in() ) : $checked = ""; if (notification_is_activated($user_id)) : $checked = "checked='checked'"; endif; echo "
\n\n"; endif; } add_action('extra_profile_info', 'notification_profile'); function notification_profile_edit() { global $user_id; bb_update_usermeta($user_id, "favorite_notification", $_POST['favorite_notification']); } add_action('profile_edited', 'notification_profile_edit'); function notification_is_activated($user_id) { $user = bb_get_user( $user_id ); if ($user->favorite_notification) : return true; else : return false; endif; } ?>