summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/functions.php b/functions.php
index 8b6bc6620..d07ce024f 100644
--- a/functions.php
+++ b/functions.php
@@ -484,4 +484,36 @@
}
}
+ function initialize_user_prefs($link, $uid) {
+
+ $uid = db_escape_string($uid);
+
+ db_query($link, "BEGIN");
+
+ $result = db_query($link, "SELECT pref_name,def_value FROM ttrss_prefs");
+
+ $u_result = db_query($link, "SELECT pref_name
+ FROM ttrss_user_prefs WHERE owner_uid = '$uid'");
+
+ $active_prefs = array();
+
+ while ($line = db_fetch_assoc($u_result)) {
+ array_push($active_prefs, $line["pref_name"]);
+ }
+
+ while ($line = db_fetch_assoc($result)) {
+ if (array_search($line["pref_name"], $active_prefs) === FALSE) {
+// print "adding " . $line["pref_name"] . "<br>";
+
+ db_query($link, "INSERT INTO ttrss_user_prefs
+ (owner_uid,pref_name,value) VALUES
+ ('$uid', '".$line["pref_name"]."','".$line["def_value"]."')");
+
+ }
+ }
+
+ db_query($link, "COMMIT");
+
+ }
+
?>