mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-24 13:11:28 +00:00
per-user preferences
This commit is contained in:
@@ -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");
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user