diff --git a/include/Contact.php b/include/Contact.php
index 956e5d0e11..a4b9cb2de5 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -695,6 +695,44 @@ function get_contact($url, $uid = 0, $no_update = false) {
 	return $contact_id;
 }
 
+/**
+ * @brief Checks if the contact is blocked
+ *
+ * @param int $cid contact id
+ *
+ * @return boolean Is the contact blocked?
+ */
+function blockedContact($cid) {
+	if ($cid == 0) {
+		return false;
+	}
+
+	$blocked = dba::select('contact', array('blocked'), array('id' => $cid), array('limit' => 1));
+	if (!dbm::is_result($blocked)) {
+		return false;
+	}
+	return (bool)$blocked['blocked'];
+}
+
+/**
+ * @brief Checks if the contact is hidden
+ *
+ * @param int $cid contact id
+ *
+ * @return boolean Is the contact hidden?
+ */
+function hiddenContact($cid) {
+	if ($cid == 0) {
+		return false;
+	}
+
+	$hidden = dba::select('contact', array('hidden'), array('id' => $cid), array('limit' => 1));
+	if (!dbm::is_result($hidden)) {
+		return false;
+	}
+	return (bool)$hidden['hidden'];
+}
+
 /**
  * @brief Returns posts from a given gcontact
  *
diff --git a/include/items.php b/include/items.php
index 6945f8894d..f19497f11e 100644
--- a/include/items.php
+++ b/include/items.php
@@ -761,10 +761,20 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
 		$arr["author-id"] = get_contact($arr["author-link"], 0);
 	}
 
+	if (blockedContact($arr["author-id"])) {
+		logger('Contact '.$arr["author-id"].' is blocked, item '.$arr["uri"].' will not be stored');
+		return 0;
+	}
+
 	if ($arr["owner-id"] == 0) {
 		$arr["owner-id"] = get_contact($arr["owner-link"], 0);
 	}
 
+	if (blockedContact($arr["owner-id"])) {
+		logger('Contact '.$arr["owner-id"].' is blocked, item '.$arr["uri"].' will not be stored');
+		return 0;
+	}
+
 	if ($arr['guid'] != "") {
 		// Checking if there is already an item with the same guid
 		logger('checking for an item for user '.$arr['uid'].' on network '.$arr['network'].' with the guid '.$arr['guid'], LOGGER_DEBUG);
diff --git a/include/threads.php b/include/threads.php
index d04ba38ef1..169a63c7ca 100644
--- a/include/threads.php
+++ b/include/threads.php
@@ -32,7 +32,7 @@ function add_thread($itemid, $onlyshadow = false) {
  * @param integer $itemid Item ID that should be added
  */
 function add_shadow_thread($itemid) {
-	$items = q("SELECT `uid`, `wall`, `private`, `moderated`, `visible`, `contact-id`, `deleted`, `network`
+	$items = q("SELECT `uid`, `wall`, `private`, `moderated`, `visible`, `contact-id`, `deleted`, `network`, `author-id`, `owner-id`
 		FROM `item` WHERE `id` = %d AND (`parent` = %d OR `parent` = 0) LIMIT 1", intval($itemid), intval($itemid));
 
 	if (!dbm::is_result($items)) {
@@ -56,6 +56,11 @@ function add_shadow_thread($itemid) {
 		return;
 	}
 
+	// Is the public contact configured as hidden?
+        if (hiddenContact($item["owner-id"]) || hiddenContact($item["author-id"])) {
+                return;
+        }
+
 	// Only do these checks if the post isn't a wall post
 	if (!$item["wall"]) {
 		// Check, if hide-friends is activated - then don't do a shadow entry