function word_filter_get_by_uid($uid) { if (!is_numeric($uid)) { return false; } if (!($user_prefs = user_get_prefs($uid))) { return false; } static $word_filter_array = array(); if (!isset($word_filter_array[$uid])) { $word_filter_array[$uid] = array(); if (isset($user_prefs['USE_ADMIN_FILTER']) && $user_prefs['USE_ADMIN_FILTER'] == 'Y' || forum_get_setting('force_word_filter', 'Y')) { word_filter_get(0, $word_filter_array[$uid]); } if (isset($user_prefs['USE_WORD_FILTER']) && $user_prefs['USE_WORD_FILTER'] == 'Y') { word_filter_get($uid, $word_filter_array[$uid]); } } return word_filter_prepare($word_filter_array[$uid]); }
require_once BH_INCLUDE_PATH . 'form.inc.php'; require_once BH_INCLUDE_PATH . 'format.inc.php'; require_once BH_INCLUDE_PATH . 'forum.inc.php'; require_once BH_INCLUDE_PATH . 'header.inc.php'; require_once BH_INCLUDE_PATH . 'html.inc.php'; require_once BH_INCLUDE_PATH . 'session.inc.php'; require_once BH_INCLUDE_PATH . 'user.inc.php'; // End Required includes // Check we're logged in correctly if (!session::logged_in()) { html_guest_error(); } // Array to hold error messages $error_msg_array = array(); // Get User Prefs $user_prefs = user_get_prefs($_SESSION['UID']); // Submit code if (isset($_POST['save'])) { $user_prefs_global = array(); if (isset($_POST['allow_email']) && $_POST['allow_email'] == "Y") { $user_prefs['ALLOW_EMAIL'] = "Y"; } else { $user_prefs['ALLOW_EMAIL'] = "N"; } if (isset($_POST['use_email_addr']) && $_POST['use_email_addr'] == "Y") { $user_prefs['USE_EMAIL_ADDR'] = "Y"; } else { $user_prefs['USE_EMAIL_ADDR'] = "N"; } if (isset($_POST['allow_pm']) && $_POST['allow_pm'] == "Y") { $user_prefs['ALLOW_PM'] = "Y";
require_once BH_INCLUDE_PATH . 'logon.inc.php'; require_once BH_INCLUDE_PATH . 'post.inc.php'; require_once BH_INCLUDE_PATH . 'session.inc.php'; require_once BH_INCLUDE_PATH . 'styles.inc.php'; require_once BH_INCLUDE_PATH . 'timezone.inc.php'; require_once BH_INCLUDE_PATH . 'user.inc.php'; // Check we're logged in correctly if (!session::logged_in()) { html_guest_error(); } // Array to hold error messages. $error_msg_array = array(); // User UID $uid = session::get_value('UID'); // Get User Prefs $user_prefs = user_get_prefs($uid); // Submit code starts here. if (isset($_POST['save'])) { if (isset($_POST['pm_notify']) && $_POST['pm_notify'] == "Y") { $user_prefs['PM_NOTIFY'] = "Y"; } else { $user_prefs['PM_NOTIFY'] = "N"; } if (isset($_POST['pm_save_sent_items']) && $_POST['pm_save_sent_items'] == "Y") { $user_prefs['PM_SAVE_SENT_ITEM'] = "Y"; } else { $user_prefs['PM_SAVE_SENT_ITEM'] = "N"; } if (isset($_POST['pm_include_reply']) && $_POST['pm_include_reply'] == "Y") { $user_prefs['PM_INCLUDE_REPLY'] = "Y"; } else {
public static function start($uid) { if (!($forum_fid = get_forum_fid())) { $forum_fid = 0; } if (!($user = user_get($uid))) { $user = array('UID' => 0, 'LOGON' => 'GUEST', 'NICKNAME' => 'Guest', 'EMAIL' => ''); } unset($user['IPADDRESS'], $user['PASSWD'], $user['REFERER'], $user['PEER_NICKNAME']); $_SESSION = array_merge($_SESSION, $user); $_SESSION['FID'] = $forum_fid; $_SESSION['IPADDRESS'] = get_ip_address(); if (session::logged_in() && ($user_prefs = user_get_prefs($uid))) { $_SESSION = array_merge($_SESSION, $user_prefs); } else { $_SESSION = array_merge($_SESSION, user_get_pref_names(array('STYLE'))); } if ($user_perms = session::get_perm_array($uid, $forum_fid)) { $_SESSION['PERMS'] = $user_perms; } if (!isset($_SESSION['RAND_HASH'])) { $_SESSION['RAND_HASH'] = md5(uniqid(mt_rand())); } if ($uid > 0 && !forum_get_last_visit($uid) && ($gid = perm_get_default_group())) { perm_add_user_to_group($uid, $gid); } }
function user_get_profile($uid) { if (!($db = db::get())) { return false; } if (!is_numeric($uid)) { return false; } $peer_uid = session::get_value('UID'); if (!($table_prefix = get_table_prefix())) { return false; } if (!($forum_fid = get_forum_fid())) { return false; } $user_groups_array = array(); $user_prefs = user_get_prefs($uid); $session_gc_maxlifetime = ini_get('session.gc_maxlifetime'); $session_cutoff_datetime = date(MYSQL_DATETIME, time() - $session_gc_maxlifetime); $sql = "SELECT USER.UID, USER.LOGON, USER.NICKNAME, USER_PEER.PEER_NICKNAME, "; $sql .= "UNIX_TIMESTAMP(USER_FORUM.LAST_VISIT) AS LAST_VISIT, "; $sql .= "UNIX_TIMESTAMP(USER.REGISTERED) AS REGISTERED, "; $sql .= "UNIX_TIMESTAMP(USER_TRACK.USER_TIME_BEST) AS USER_TIME_BEST, "; $sql .= "UNIX_TIMESTAMP(USER_TRACK.USER_TIME_TOTAL) AS USER_TIME_TOTAL, "; $sql .= "USER_PEER.RELATIONSHIP, SESSIONS.ID FROM USER USER "; $sql .= "LEFT JOIN USER_PREFS USER_PREFS_GLOBAL ON (USER_PREFS_GLOBAL.UID = USER.UID) "; $sql .= "LEFT JOIN `{$table_prefix}USER_PREFS` USER_PREFS_FORUM "; $sql .= "ON (USER_PREFS_FORUM.UID = USER.UID) "; $sql .= "LEFT JOIN `{$table_prefix}USER_PEER` USER_PEER "; $sql .= "ON (USER_PEER.PEER_UID = USER.UID AND USER_PEER.UID = '{$peer_uid}') "; $sql .= "LEFT JOIN USER_FORUM USER_FORUM ON (USER_FORUM.UID = USER.UID "; $sql .= "AND USER_FORUM.FID = '{$forum_fid}') "; $sql .= "LEFT JOIN `{$table_prefix}USER_TRACK` USER_TRACK "; $sql .= "ON (USER_TRACK.UID = USER.UID) "; $sql .= "LEFT JOIN SESSIONS ON (SESSIONS.UID = USER.UID "; $sql .= "AND SESSIONS.TIME >= CAST('{$session_cutoff_datetime}' AS DATETIME)) "; $sql .= "WHERE USER.UID = '{$uid}' "; $sql .= "GROUP BY USER.UID"; if (!($result = $db->query($sql))) { return false; } if ($result->num_rows == 0) { return false; } $user_profile = $result->fetch_assoc(); if (isset($user_prefs['ANON_LOGON']) && $user_prefs['ANON_LOGON'] > USER_ANON_DISABLED) { $anon_logon = $user_prefs['ANON_LOGON']; } else { $anon_logon = USER_ANON_DISABLED; } if ($anon_logon == USER_ANON_DISABLED && isset($user_profile['LAST_VISIT']) && $user_profile['LAST_VISIT'] > 0) { $user_profile['LAST_LOGON'] = format_time($user_profile['LAST_VISIT']); } else { $user_profile['LAST_LOGON'] = gettext("Unknown"); } if (isset($user_profile['REGISTERED']) && $user_profile['REGISTERED'] > 0) { $user_profile['REGISTERED'] = format_date($user_profile['REGISTERED']); } else { $user_profile['REGISTERED'] = gettext("Unknown"); } if (isset($user_profile['USER_TIME_BEST']) && $user_profile['USER_TIME_BEST'] > 0) { $user_profile['USER_TIME_BEST'] = format_time_display($user_profile['USER_TIME_BEST']); } else { $user_profile['USER_TIME_BEST'] = gettext("Unknown"); } if (isset($user_profile['USER_TIME_TOTAL']) && $user_profile['USER_TIME_TOTAL'] > 0) { $user_profile['USER_TIME_TOTAL'] = format_time_display($user_profile['USER_TIME_TOTAL']); } else { $user_profile['USER_TIME_TOTAL'] = gettext("Unknown"); } if (isset($user_prefs['DOB_DISPLAY']) && !empty($user_prefs['DOB']) && $user_prefs['DOB'] != "0000-00-00") { if ($user_prefs['DOB_DISPLAY'] == USER_DOB_DISPLAY_BOTH) { $user_profile['DOB'] = format_birthday($user_prefs['DOB']); $user_profile['AGE'] = format_age($user_prefs['DOB']); } else { if ($user_prefs['DOB_DISPLAY'] == USER_DOB_DISPLAY_DATE) { $user_profile['DOB'] = format_birthday($user_prefs['DOB']); } else { if ($user_prefs['DOB_DISPLAY'] == USER_DOB_DISPLAY_AGE) { $user_profile['AGE'] = format_age($user_prefs['DOB']); } } } } if (isset($user_prefs['PIC_URL']) && strlen($user_prefs['PIC_URL']) > 0) { $user_profile['PIC_URL'] = $user_prefs['PIC_URL']; } if (isset($user_prefs['PIC_AID']) && is_md5($user_prefs['PIC_AID'])) { $user_profile['PIC_AID'] = $user_prefs['PIC_AID']; } if (isset($user_prefs['AVATAR_URL']) && strlen($user_prefs['AVATAR_URL']) > 0) { $user_profile['AVATAR_URL'] = $user_prefs['AVATAR_URL']; } if (isset($user_prefs['AVATAR_AID']) && is_md5($user_prefs['AVATAR_AID'])) { $user_profile['AVATAR_AID'] = $user_prefs['AVATAR_AID']; } if (isset($user_prefs['HOMEPAGE_URL']) && strlen($user_prefs['HOMEPAGE_URL']) > 0) { $user_profile['HOMEPAGE_URL'] = $user_prefs['HOMEPAGE_URL']; } if (!isset($user_profile['RELATIONSHIP'])) { $user_profile['RELATIONSHIP'] = 0; } if (isset($user_profile['PEER_NICKNAME'])) { if (!is_null($user_profile['PEER_NICKNAME']) && strlen($user_profile['PEER_NICKNAME']) > 0) { $user_profile['NICKNAME'] = $user_profile['PEER_NICKNAME']; } } if ($anon_logon == USER_ANON_DISABLED) { if (isset($user_profile['ID'])) { $user_profile['STATUS'] = gettext("Online"); } else { $user_profile['STATUS'] = gettext("Inactive / Offline"); } } else { $user_profile['STATUS'] = gettext("Unknown"); } if ($user_post_count = user_get_post_count($uid)) { $user_profile['POST_COUNT'] = $user_post_count; } else { $user_profile['POST_COUNT'] = 0; } if ($user_local_time = user_format_local_time($user_prefs)) { $user_profile['LOCAL_TIME'] = $user_local_time; } if (user_is_banned($uid)) { $user_profile['USER_GROUPS'] = gettext("Banned"); } else { perm_user_get_group_names($uid, $user_groups_array); if (sizeof($user_groups_array) > 0) { $user_profile['USER_GROUPS'] = implode(', ', $user_groups_array); } else { $user_profile['USER_GROUPS'] = gettext("Registered"); } } return $user_profile; }
function email_send_pm_notification($tuid, $mid, $fuid) { // Validate function arguments if (!is_numeric($tuid)) { return false; } if (!is_numeric($mid)) { return false; } if (!is_numeric($fuid)) { return false; } // Check the PM exists. if (!($pm_subject = pm_get_subject($mid, $tuid))) { return false; } // Get the Swift Mailer Transport if (!($transport = Swift_TransportFactory::get())) { return false; } //Create the Mailer using the returned Transport $mailer = Swift_Mailer::newInstance($transport); // Create a new message $message = Swift_MessageBeehive::newInstance(); // Get Forum webtag $webtag = get_webtag(); // Get the to user details if (!($to_user = user_get($tuid))) { return false; } // Get the from user details if (!($from_user = user_get($fuid))) { return false; } // Get the to user preferences if (!($to_user_prefs = user_get_prefs($tuid))) { return false; } // Get the relationship between the to and from user $user_rel = user_get_relationship($to_user['UID'], $from_user['UID']); // If the recipient is ignoring the sender bail out. if ($user_rel & USER_IGNORED_COMPLETELY) { return false; } // Validate the email address before we continue. if (!email_address_valid($to_user['EMAIL'])) { return false; } // Does the recipient want to receive email notifcations? if (!isset($to_user_prefs['PM_NOTIFY_EMAIL']) | $to_user_prefs['PM_NOTIFY_EMAIL'] != 'Y') { return false; } // Get the forum name, subject, recipient, author, thread title and generate // the messages link. Pass all of them through the recipient's word filter. $forum_name = word_filter_apply(forum_get_setting('forum_name', null, 'A Beehive Forum'), $tuid, true); $subject = word_filter_apply(sprintf(gettext("PM Notification from %s"), $forum_name), $tuid, true); $recipient = word_filter_apply(format_user_name($to_user['LOGON'], $to_user['NICKNAME']), $tuid, true); $message_author = word_filter_apply(format_user_name($from_user['LOGON'], $from_user['NICKNAME']), $tuid, true); $message_subject = word_filter_apply($pm_subject, $tuid, true); // Generate link to the forum itself $forum_link = html_get_forum_uri("index.php?webtag={$webtag}"); // Generate the message link. $message_link = html_get_forum_uri("index.php?webtag={$webtag}&pmid={$mid}"); // Generate the message body. $message_body = wordwrap(sprintf(gettext("Hello %s,\r\n\r\n%s posted a PM to you on %s.\r\n\r\nThe subject is: %s.\r\n\r\nTo read the message go to:\r\n%s\r\n\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nNote: If you do not wish to receive email notifications of new PM messages posted to you, go to: %s click My Controls then Email and Privacy, unselect the PM Notification checkbox and press Submit."), $recipient, $message_author, $forum_name, $message_subject, $message_link, $forum_link)); // Add the recipient $message->setTo($to_user['EMAIL'], $recipient); // Set the subject $message->setSubject($subject); // Set the message body $message->setBody($message_body); // Send the email return $mailer->send($message) > 0; }
function user_get_profile($uid) { if (!($db = db::get())) { return false; } if (!is_numeric($uid)) { return false; } if (!isset($_SESSION['UID']) || !is_numeric($_SESSION['UID'])) { return false; } if (!($table_prefix = get_table_prefix())) { return false; } if (!($forum_fid = get_forum_fid())) { return false; } $user_prefs = user_get_prefs($uid); $session_gc_maxlifetime = ini_get('session.gc_maxlifetime'); $session_cutoff_datetime = date(MYSQL_DATETIME, time() - $session_gc_maxlifetime); $sql = "SELECT USER.UID, USER.LOGON, USER.NICKNAME, USER_PEER.PEER_NICKNAME, USER_PEER.RELATIONSHIP, "; $sql .= "SESSIONS.ID, UNIX_TIMESTAMP(USER_FORUM.LAST_VISIT) AS LAST_VISIT, UNIX_TIMESTAMP(USER.REGISTERED) AS REGISTERED, "; $sql .= "COALESCE(USER_POST_RATING.RATING, 0) AS POST_RATING, COUNT(POST_USER_RATING.RATING) AS POST_VOTE_TOTAL, "; $sql .= "COALESCE(SUM(IF(POST_USER_RATING.RATING > 0, 1, 0)), 0) AS POST_VOTE_UP, "; $sql .= "COALESCE(SUM(IF(POST_USER_RATING.RATING < 0, 1, 0)), 0) AS POST_VOTE_DOWN FROM USER USER "; $sql .= "LEFT JOIN USER_PREFS USER_PREFS_GLOBAL ON (USER_PREFS_GLOBAL.UID = USER.UID) "; $sql .= "LEFT JOIN `{$table_prefix}USER_PREFS` USER_PREFS_FORUM ON (USER_PREFS_FORUM.UID = USER.UID) "; $sql .= "LEFT JOIN `{$table_prefix}USER_PEER` USER_PEER ON (USER_PEER.PEER_UID = USER.UID AND USER_PEER.UID = '{$_SESSION['UID']}') "; $sql .= "LEFT JOIN USER_FORUM USER_FORUM ON (USER_FORUM.UID = USER.UID AND USER_FORUM.FID = '{$forum_fid}') "; $sql .= "LEFT JOIN SESSIONS ON (SESSIONS.UID = USER.UID AND SESSIONS.TIME >= CAST('{$session_cutoff_datetime}' AS DATETIME)) "; $sql .= "LEFT JOIN `{$table_prefix}POST_RATING` POST_USER_RATING ON (POST_USER_RATING.UID = USER.UID AND POST_USER_RATING.RATING IN (-1, 1)) "; $sql .= "LEFT JOIN (SELECT POST.FROM_UID AS UID, SUM(POST_RATING.RATING) AS RATING FROM `{$table_prefix}POST` POST "; $sql .= "INNER JOIN `{$table_prefix}POST_RATING` POST_RATING ON (POST_RATING.TID = POST.TID AND POST_RATING.PID = POST.PID) "; $sql .= "WHERE POST.FROM_UID = '{$uid}' GROUP BY POST.FROM_UID) AS USER_POST_RATING ON (USER_POST_RATING.UID = USER.UID) "; $sql .= "WHERE USER.UID = '{$uid}' GROUP BY USER.UID"; if (!($result = $db->query($sql))) { return false; } if ($result->num_rows == 0) { return false; } $user_profile = $result->fetch_assoc(); if (isset($user_prefs['ANON_LOGON']) && $user_prefs['ANON_LOGON'] > USER_ANON_DISABLED) { $anon_logon = $user_prefs['ANON_LOGON']; } else { $anon_logon = USER_ANON_DISABLED; } if ($anon_logon == USER_ANON_DISABLED && isset($user_profile['LAST_VISIT']) && $user_profile['LAST_VISIT'] > 0) { $user_profile['LAST_LOGON'] = format_date_time($user_profile['LAST_VISIT']); } else { $user_profile['LAST_LOGON'] = gettext("Unknown"); } if (isset($user_profile['REGISTERED']) && $user_profile['REGISTERED'] > 0) { $user_profile['REGISTERED'] = format_date_time($user_profile['REGISTERED']); } else { $user_profile['REGISTERED'] = gettext("Unknown"); } if (isset($user_prefs['DOB_DISPLAY']) && !empty($user_prefs['DOB']) && $user_prefs['DOB'] != "0000-00-00") { if ($user_prefs['DOB_DISPLAY'] == USER_DOB_DISPLAY_BOTH) { $user_profile['DOB'] = format_birthday($user_prefs['DOB']); $user_profile['AGE'] = format_age($user_prefs['DOB']); } else { if ($user_prefs['DOB_DISPLAY'] == USER_DOB_DISPLAY_DATE) { $user_profile['DOB'] = format_birthday($user_prefs['DOB']); } else { if ($user_prefs['DOB_DISPLAY'] == USER_DOB_DISPLAY_AGE) { $user_profile['AGE'] = format_age($user_prefs['DOB']); } } } } if (isset($user_prefs['PIC_URL']) && filter_var($user_prefs['PIC_URL'], FILTER_VALIDATE_URL)) { $user_profile['PIC_URL'] = $user_prefs['PIC_URL']; } if (isset($user_prefs['PIC_AID']) && is_numeric($user_prefs['PIC_AID'])) { $user_profile['PIC_AID'] = $user_prefs['PIC_AID']; } if (isset($user_prefs['AVATAR_URL']) && filter_var($user_prefs['AVATAR_URL'], FILTER_VALIDATE_URL)) { $user_profile['AVATAR_URL'] = $user_prefs['AVATAR_URL']; } if (isset($user_prefs['AVATAR_AID']) && is_numeric($user_prefs['AVATAR_AID'])) { $user_profile['AVATAR_AID'] = $user_prefs['AVATAR_AID']; } if (isset($user_prefs['HOMEPAGE_URL']) && filter_var($user_prefs['HOMEPAGE_URL'], FILTER_VALIDATE_URL)) { $user_profile['HOMEPAGE_URL'] = $user_prefs['HOMEPAGE_URL']; } if (!isset($user_profile['RELATIONSHIP'])) { $user_profile['RELATIONSHIP'] = 0; } if (isset($user_profile['PEER_NICKNAME'])) { if (!is_null($user_profile['PEER_NICKNAME']) && strlen($user_profile['PEER_NICKNAME']) > 0) { $user_profile['NICKNAME'] = $user_profile['PEER_NICKNAME']; } } if ($anon_logon == USER_ANON_DISABLED) { if (isset($user_profile['ID'])) { $user_profile['STATUS'] = gettext("Online"); } else { $user_profile['STATUS'] = gettext("Inactive / Offline"); } } else { $user_profile['STATUS'] = gettext("Unknown"); } if (($user_post_count = user_get_post_count($uid)) !== false) { $user_profile['POST_COUNT'] = $user_post_count; } else { $user_profile['POST_COUNT'] = 0; } if (($user_local_time = user_format_local_time($user_prefs)) !== false) { $user_profile['LOCAL_TIME'] = $user_local_time; } if (user_is_banned($uid)) { $user_profile['GROUPS'] = gettext("Banned"); } else { if ($user_groups_array = perm_user_get_group_names($uid)) { $user_profile['GROUPS'] = implode(', ', $user_groups_array); } else { $user_profile['GROUPS'] = gettext("Registered"); } } return $user_profile; }
function pm_auto_prune_enabled() { if (!isset($_SESSION['UID']) || !is_numeric($_SESSION['UID'])) { return false; } $user_prefs = user_get_prefs($_SESSION['UID']); if (isset($user_prefs['PM_AUTO_PRUNE']) && intval($user_prefs['PM_AUTO_PRUNE']) > 0) { return true; } $pm_prune_length = intval(forum_get_setting('pm_auto_prune', null, 0)); return $pm_prune_length > 0; }
public static function refresh($uid) { $ip_address = get_ip_address(); $http_referer = session::get_http_referer(); if (!($forum_fid = get_forum_fid())) { $forum_fid = 0; } if (!($user = user_get($uid))) { $user = array('UID' => 0, 'LOGON' => 'GUEST', 'NICKNAME' => 'Guest', 'EMAIL' => ''); } unset($user['IPADDRESS'], $user['PASSWD'], $user['REFERER']); $_SESSION = array_merge($_SESSION, $user); $_SESSION['FID'] = $forum_fid; $_SESSION['IPADDRESS'] = get_ip_address(); if (session::logged_in() && ($user_prefs = user_get_prefs($uid))) { $_SESSION = array_merge($_SESSION, $user_prefs); } if ($user_perms = session::get_perm_array($uid, $forum_fid)) { $_SESSION['PERMS'] = $user_perms; } if (!isset($_SESSION['REFERER'])) { $_SESSION['REFERER'] = session::get_http_referer(); } if (!isset($_SESSION['RAND_HASH'])) { $_SESSION['RAND_HASH'] = md5(uniqid(mt_rand())); } if (isset($user_prefs['STYLE'])) { html_set_cookie("forum_style", $user_prefs['STYLE'], time() + YEAR_IN_SECONDS); } }
} else { if (isset($_POST['profile_uid'])) { if (is_numeric($_POST['profile_uid'])) { $profile_uid = $_POST['profile_uid']; $admin_edit = true; } else { html_draw_error(gettext("No user specified.")); } } } } if (!session::check_perm(USER_PERM_ADMIN_TOOLS, 0) && $profile_uid != $_SESSION['UID']) { html_draw_error(gettext("You do not have permission to use this section.")); } // Get User Prefs $user_prefs = user_get_prefs($profile_uid); // Get user information $user_info = user_get($profile_uid); // Array to hold error messages $error_msg_array = array(); // List of allowed image types $allowed_image_types_array = array('jpg', 'jpeg', 'png', 'gif'); $allowed_image_types = "*." . implode(", *.", $allowed_image_types_array); $user_prefs_global = array(); $attachment_details = null; $attachment_dir = null; if (isset($_POST['save'])) { $valid = true; // Duplicate the user_info array. $user_info_new = $user_info; // Required Fields
function pm_auto_prune_enabled() { if (($uid = session::get_value('UID')) === false) { return false; } $user_prefs = user_get_prefs($uid); if (isset($user_prefs['PM_AUTO_PRUNE']) && intval($user_prefs['PM_AUTO_PRUNE']) > 0) { return true; } $pm_prune_length = intval(forum_get_setting('pm_auto_prune', null, 0)); return $pm_prune_length > 0; }