]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Profile.php
Merge branch 'nightly' of gitorious.org:social/mainline into nightly
[quix0rs-gnu-social.git] / classes / Profile.php
index 00a457a5c9c2062aa9163373fddb4bc170fe65e3..8352861fe63089cb187f92d1cbf3bf67b1baeaee 100644 (file)
@@ -1565,8 +1565,17 @@ class Profile extends Managed_DataObject
         return $this->getUser()->shortenLinks($text, $always);
     }
 
+    public function delPref($namespace, $topic) {
+        return Profile_prefs::setData($this, $namespace, $topic, null);
+    }
+
     public function getPref($namespace, $topic, $default=null) {
-        return Profile_prefs::getData($this, $namespace, $topic, $default);
+        // If you want an exception to be thrown, call Profile_prefs::getData directly
+        try {
+            return Profile_prefs::getData($this, $namespace, $topic, $default);
+        } catch (NoResultException $e) {
+            return null;
+        }
     }
 
     public function setPref($namespace, $topic, $data) {