/** * Delete profile photo/cover wall post * * @param int $fileguid Profile/Cover file id * @return bool */ public function deletePhotoWallPost($fileguid) { if (empty($fileguid)) { return false; } //prepare a query to get post guid $statement = "SELECT * FROM ossn_entities, ossn_entities_metadata WHERE(\n\t\t\t\t \t ossn_entities_metadata.guid = ossn_entities.guid \n\t\t\t\t AND ossn_entities.subtype='item_guid'\n\t\t\t\t AND ossn_entities.type = 'object'\n\t\t\t\t AND ossn_entities_metadata.value = '{$fileguid}'\n\t\t\t\t );"; $this->statement($statement); $this->execute(); $entity = $this->fetch(); //check if post exists or not if ($entity) { //get object $object = ossn_get_object($entity->owner_guid); if ($object && $object->subtype == 'wall') { $wall = new OssnWall(); //delete wall post if ($wall->deletePost($object->guid)) { return true; } } } return false; }
/** * Delete user wall posts * * @param string $callback Name of callback * @param string $type Callback type * @param array $params Arrays or Objects * * @return mixed data * @access private */ function ossn_user_posts_delete($callback, $type, $params) { $wall = new OssnWall(); $posts = $wall->getUserGroupPostsGuids($params['entity']->guid); if ($posts) { foreach ($posts as $post) { //$post is here int $wall->deletePost($post); } } }
} if ($post->type == 'group' && !ossn_isAdminLoggedin()) { $group = new OssnGroup(); $group = $group->getGroup($post->owner_guid); //lastchange group admins are unable to delete member posting on group wall #171 // change or operator to and if ($post->poster_guid !== ossn_loggedin_user()->guid && ossn_loggedin_user()->guid !== $group->owner_guid) { if (!ossn_is_xhr()) { ossn_trigger_message(ossn_print('post:delete:fail'), 'error'); redirect(REF); } else { echo 0; exit; } } } if ($ossnwall->deletePost($id)) { if (ossn_is_xhr()) { echo 1; } else { ossn_trigger_message(ossn_print('post:delete:success'), 'success'); redirect(REF); } } else { if (ossn_is_xhr()) { echo 0; } else { ossn_trigger_message(ossn_print('post:delete:fail'), 'error'); redirect(REF); } }