本文整理汇总了PHP中elgg_delete_river函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_delete_river函数的具体用法?PHP elgg_delete_river怎么用?PHP elgg_delete_river使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_delete_river函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteVotes
/**
* Delete all votes associated with this poll, reset vote counters and delete associated vote river items
*/
public function deleteVotes()
{
elgg_delete_river(array('view' => 'river/object/poll/vote', 'action_type' => 'vote', 'object_guid' => $this->guid));
elgg_delete_annotations(array('guid' => $this->guid, 'type' => "object", 'subtype' => "poll", 'annotation_name' => "vote"));
$this->responses_by_choice = array();
$this->response_count = 0;
}
示例2: delete
/**
* {@inheritdoc}
*/
public function delete(ParameterBag $params)
{
if (!elgg_is_admin_logged_in()) {
throw new GraphException("You are not permitted to delete river items", 403);
}
return elgg_delete_river(array('ids' => sanitize_int($params->id)));
}
示例3: deleteMember
/**
* Remove river join event on site leave
*
* @param string $event Event name
* @param string $object_type Event type
* @param ElggRelationship $object Relationship object being removed
*
* @return void
*/
public static function deleteMember($event, $object_type, $object)
{
if ($object->relationship !== 'member_of_site') {
return;
}
elgg_delete_river(['view' => 'river/relationship/member_of_site/create', 'subject_guid' => $object->guid_one, 'object_guid' => $object->guid_two]);
}
示例4: badges_userpoints
/**
* This method is called when a users points are updated.
* We check to see what the users current balance is and
* assign the appropriate badge.
*/
function badges_userpoints($hook, $type, $return, $params)
{
if ($params['entity']->badges_locked) {
return true;
}
$points = $params['entity']->userpoints_points;
$badge = get_entity($params['entity']->badges_badge);
$options = array('type' => 'object', 'subtype' => 'badge', 'limit' => false, 'order_by_metadata' => array('name' => 'badges_userpoints', 'direction' => DESC, 'as' => integer));
$options['metadata_name_value_pairs'] = array(array('name' => 'badges_userpoints', 'value' => $points, 'operand' => '<='));
$entities = elgg_get_entities_from_metadata($options);
if ((int) elgg_get_plugin_setting('lock_high', 'elggx_badges')) {
if ($badge->badges_userpoints > $entities[0]->badges_userpoints) {
return true;
}
}
if ($badge->guid != $entities[0]->guid) {
$params['entity']->badges_badge = $entities[0]->guid;
if (!elgg_trigger_plugin_hook('badges:update', 'object', array('entity' => $user), true)) {
$params['entity']->badges_badge = $badge->guid;
return false;
}
// Announce it on the river
$user_guid = $params['entity']->getGUID();
elgg_delete_river(array("view" => 'river/object/badge/assign', "subject_guid" => $user_guid, "object_guid" => $user_guid));
elgg_delete_river(array("view" => 'river/object/badge/award', "subject_guid" => $user_guid, "object_guid" => $user_guid));
elgg_create_river_item(array('view' => 'river/object/badge/award', 'action_type' => 'award', 'subject_guid' => $user_guid, 'object_guid' => $user_guid));
}
return true;
}
示例5: delete
/**
* Delete the annotation.
*
* @return bool
*/
public function delete()
{
$result = _elgg_delete_metastring_based_object_by_id($this->id, 'annotation');
if ($result) {
elgg_delete_river(array('annotation_id' => $this->id));
}
return $result;
}
示例6: testElggCreateRiverItemWorks
public function testElggCreateRiverItemWorks()
{
$entity = elgg_get_entities(array('limit' => 1));
$entity = $entity[0];
$params = array('view' => 'river/relationship/friend/create', 'action_type' => 'create', 'subject_guid' => $entity->guid, 'object_guid' => $entity->guid);
$id = elgg_create_river_item($params);
$this->assertTrue(is_int($id));
$this->assertTrue(elgg_delete_river(array('id' => $id)));
}
示例7: profile_river_updates
function profile_river_updates($event, $type, $object)
{
$user = get_entity($object->guid);
if ($user instanceof ElggUser) {
$view = 'river/user/default/profileupdate';
elgg_delete_river(array('subject_guid' => $user->guid, 'view' => $view));
elgg_create_river_item(array('view' => $view, 'action_type' => 'update', 'subject_guid' => $user->guid, 'object_guid' => $user->guid, 'access_id' => get_default_access($user)));
}
return true;
}
示例8: execute
/**
* {@inheritdoc}
*/
public function execute()
{
$relationship = check_entity_relationship($this->user->guid, 'tagged_in', $this->entity->guid);
if ($relationship instanceof \ElggRelationship) {
if ($relationship->delete()) {
elgg_delete_river(array('subject_guids' => $this->user->guid, 'object_guids' => $this->entity->guid, 'action_types' => 'tagged'));
/**
* @todo: remove from access collection?
*/
$this->result->addMessage(elgg_echo('wall:remove_tag:success'));
return;
}
}
$this->result->addError(elgg_echo('wall:remove_tag:error'));
}
示例9: daily
/**
* Publish blogs based on advanced publication options
*
* @param string $hook 'cron'
* @param string $type 'daily'
* @param string $return_value optional stdout text
* @param array $params supplied params
*
* @return void
*/
public static function daily($hook, $type, $return_value, $params)
{
// only do if this is configured
if (!blog_tools_use_advanced_publication_options()) {
return $return_value;
}
$dbprefix = elgg_get_config("dbprefix");
$publication_id = elgg_get_metastring_id("publication_date");
$expiration_id = elgg_get_metastring_id("expiration_date");
$time = elgg_extract("time", $params, time());
$publish_options = array("type" => "object", "subtype" => "blog", "limit" => false, "joins" => array("JOIN " . $dbprefix . "metadata mdtime ON e.guid = mdtime.entity_guid", "JOIN " . $dbprefix . "metastrings mstime ON mdtime.value_id = mstime.id"), "metadata_name_value_pairs" => array(array("name" => "status", "value" => "draft")), "wheres" => array("((mdtime.name_id = " . $publication_id . ") AND (DATE(mstime.string) = DATE(NOW())))"));
$unpublish_options = array("type" => "object", "subtype" => "blog", "limit" => false, "joins" => array("JOIN " . $dbprefix . "metadata mdtime ON e.guid = mdtime.entity_guid", "JOIN " . $dbprefix . "metastrings mstime ON mdtime.value_id = mstime.id"), "metadata_name_values_pairs" => array(array("name" => "status", "value" => "published")), "wheres" => array("((mdtime.name_id = " . $expiration_id . ") AND (DATE(mstime.string) = DATE(NOW())))"));
// ignore access
$ia = elgg_set_ignore_access(true);
// get unpublished blogs that need to be published
$entities = new \ElggBatch("elgg_get_entities_from_metadata", $publish_options);
foreach ($entities as $entity) {
// add river item
elgg_create_river_item(array("view" => "river/object/blog/create", "action_type" => "create", "subject_guid" => $entity->getOwnerGUID(), "object_guid" => $entity->getGUID()));
// set correct time created
$entity->time_created = $time;
// publish blog
$entity->status = "published";
// revert access
$entity->access_id = $entity->future_access;
unset($entity->future_access);
// send notifications when post published
elgg_trigger_event('publish', 'object', $entity);
// notify owner
notify_user($entity->getOwnerGUID(), $entity->site_guid, elgg_echo("blog_tools:notify:publish:subject"), elgg_echo("blog_tools:notify:publish:message", array($entity->title, $entity->getURL())));
// save everything
$entity->save();
}
// get published blogs that need to be unpublished
$entities = new \ElggBatch("elgg_get_entities_from_metadata", $unpublish_options);
foreach ($entities as $entity) {
// remove river item
elgg_delete_river(array("object_guid" => $entity->getGUID(), "action_type" => "create"));
// unpublish blog
$entity->status = "draft";
// notify owner
notify_user($entity->getOwnerGUID(), $entity->site_guid, elgg_echo("blog_tools:notify:expire:subject"), elgg_echo("blog_tools:notify:expire:message", array($entity->title, $entity->getURL())));
// save everything
$entity->save();
}
// reset access
elgg_set_ignore_access($ia);
}
示例10: unpublishBlogs
/**
* Unpublish blogs based on advanced publication settings
*
* @return void
*/
protected static function unpublishBlogs()
{
$dbprefix = elgg_get_config('dbprefix');
$expiration_id = elgg_get_metastring_id('expiration_date');
$unpublish_options = ['type' => 'object', 'subtype' => 'blog', 'limit' => false, 'joins' => ["JOIN {$dbprefix}metadata mdtime ON e.guid = mdtime.entity_guid", "JOIN {$dbprefix}metastrings mstime ON mdtime.value_id = mstime.id"], 'metadata_name_values_pairs' => [['name' => 'status', 'value' => 'published']], 'wheres' => ["((mdtime.name_id = {$expiration_id}) AND (DATE(mstime.string) = DATE(NOW())))"]];
// get published blogs that need to be unpublished
$entities = new \ElggBatch('elgg_get_entities_from_metadata', $unpublish_options);
foreach ($entities as $entity) {
// remove river item
elgg_delete_river(['object_guid' => $entity->getGUID(), 'action_type' => 'create']);
// unpublish blog
$entity->status = 'draft';
// notify owner
notify_user($entity->getOwnerGUID(), $entity->site_guid, elgg_echo('blog_tools:notify:expire:subject'), elgg_echo('blog_tools:notify:expire:message', [$entity->title, $entity->getURL()]));
// save everything
$entity->save();
}
}
示例11: tasks_2012100501
function tasks_2012100501($task)
{
require_once elgg_get_plugins_path() . 'upgrade-tools/lib/upgrade_tools.php';
if ($task->long_description) {
$task->description = $task->long_description;
$task->deleteMetadata('long_description');
$task->save();
}
if ($task->parent_guid) {
$task->list_guid = $task->parent_guid;
$task->deleteMetadata('parent_guid');
} else {
$task->list_guid = 0;
}
/* Active was set as default, so it is not indicative of which tasks are
really active */
$task->deleteMetadata('active');
if ($task->done) {
$task->status = 'done';
$task->deleteMetadata('done');
} else {
$task->status = 'new';
}
// reset priority since old system was a mess
$task->priority = 2;
upgrade_change_subtype($task, 'task');
// update river
$options = array('object_guid' => $task->guid);
$items = elgg_get_river($options);
foreach ($items as $item) {
if ($item->action_type == 'create') {
upgrade_update_river($item->id, 'river/object/task/create', $task->guid, 0);
} elseif (in_array($item->action_type, array('done', 'undone', 'subscribe', 'unsubscribe'))) {
elgg_delete_river(array('id' => $item->id));
}
}
return true;
}
示例12: get_input
$params->{$key} = get_input($key);
}
}
if (isset($params->container_guid)) {
$container = get_entity($params->container_guid);
} else {
$container = elgg_get_logged_in_user_entity();
}
if (!$container instanceof ElggEntity) {
register_error(elgg_echo('avatars:error:not_found'));
forward(REFERRER);
}
if (!$container->canEdit() || !$container->canWriteToContainer(0, 'object', hypeJunction\Images\Avatar::SUBTYPE)) {
register_error(elgg_echo('avatars:error:permission_denied'));
forward(REFERRER);
}
$avatar = avatars_create_avatar_from_upload($container, 'avatar');
if ($avatar) {
$container->icontime = $avatar->time_created;
if ($container instanceof ElggUser) {
if (elgg_trigger_event('profileiconupdate', $container->type, $container)) {
$view = 'river/user/default/profileiconupdate';
elgg_delete_river(['subject_guid' => $container->guid, 'view' => $view]);
elgg_create_river_item(['view' => $view, 'action_type' => 'update', 'subject_guid' => $container->guid, 'object_guid' => $avatar->guid]);
}
}
system_message(elgg_echo('avatar:upload:success'));
} else {
register_error(elgg_echo('avatar:upload:fail'));
}
forward(REFERRER);
示例13: get_input
// Get the GUID of the user to friend
$friend_guid = (int) get_input("friend");
$errors = false;
// Get the user
if ($friend = get_user($friend_guid)) {
$user = elgg_get_logged_in_user_entity();
try {
$user->removeFriend($friend->getGUID());
// remove river items
elgg_delete_river(array("view" => "river/relationship/friend/create", "subject_guid" => $user->getGUID(), "object_guid" => $friend->getGUID()));
try {
//V1.1 - Old relationships might not have the 2 as friends...
$friend->removeFriend($user->getGUID());
// remove river items
elgg_delete_river(array("view" => "river/relationship/friend/create", "subject_guid" => $friend->getGUID(), "object_guid" => $user->getGUID()));
} catch (Exception $e) {
// do nothing
}
} catch (Exception $e) {
register_error(elgg_echo("friends:remove:failure", array($friend->name)));
$errors = true;
}
} else {
register_error(elgg_echo("friends:remove:failure", array($friend_guid)));
$errors = true;
}
if (!$errors) {
system_message(elgg_echo("friends:remove:successful", array($friend->name)));
}
forward(REFERER);
示例14: delete_entity
/**
* Delete an entity.
*
* Removes an entity and its metadata, annotations, relationships, river entries,
* and private data.
*
* Optionally can remove entities contained and owned by $guid.
*
* @tip Use ElggEntity::delete() instead.
*
* @warning If deleting recursively, this bypasses ownership of items contained by
* the entity. That means that if the container_guid = $guid, the item will be deleted
* regardless of who owns it.
*
* @param int $guid The guid of the entity to delete
* @param bool $recursive If true (default) then all entities which are
* owned or contained by $guid will also be deleted.
*
* @return bool
* @access private
*/
function delete_entity($guid, $recursive = true)
{
global $CONFIG, $ENTITY_CACHE;
$guid = (int) $guid;
if ($entity = get_entity($guid)) {
if (elgg_trigger_event('delete', $entity->type, $entity)) {
if ($entity->canEdit()) {
// delete cache
if (isset($ENTITY_CACHE[$guid])) {
invalidate_cache_for_entity($guid);
}
// If memcache is available then delete this entry from the cache
static $newentity_cache;
if (!$newentity_cache && is_memcache_available()) {
$newentity_cache = new ElggMemcache('new_entity_cache');
}
if ($newentity_cache) {
$newentity_cache->delete($guid);
}
// Delete contained owned and otherwise releated objects (depth first)
if ($recursive) {
// Temporary token overriding access controls
// @todo Do this better.
static $__RECURSIVE_DELETE_TOKEN;
// Make it slightly harder to guess
$__RECURSIVE_DELETE_TOKEN = md5(elgg_get_logged_in_user_guid());
$entity_disable_override = access_get_show_hidden_status();
access_show_hidden_entities(true);
$ia = elgg_set_ignore_access(true);
$sub_entities = get_data("SELECT * from {$CONFIG->dbprefix}entities\n\t\t\t\t\t\tWHERE container_guid={$guid}\n\t\t\t\t\t\t\tor owner_guid={$guid}\n\t\t\t\t\t\t\tor site_guid={$guid}", 'entity_row_to_elggstar');
if ($sub_entities) {
foreach ($sub_entities as $e) {
// check for equality so that an entity that is its own
// owner or container does not cause infinite loop
if ($e->guid != $guid) {
$e->delete(true);
}
}
}
access_show_hidden_entities($entity_disable_override);
$__RECURSIVE_DELETE_TOKEN = null;
elgg_set_ignore_access($ia);
}
// Now delete the entity itself
$entity->deleteMetadata();
$entity->deleteOwnedMetadata();
$entity->deleteAnnotations();
$entity->deleteOwnedAnnotations();
$entity->deleteRelationships();
elgg_delete_river(array('subject_guid' => $guid));
elgg_delete_river(array('object_guid' => $guid));
remove_all_private_settings($guid);
$res = delete_data("DELETE from {$CONFIG->dbprefix}entities where guid={$guid}");
if ($res) {
$sub_table = "";
// Where appropriate delete the sub table
switch ($entity->type) {
case 'object':
$sub_table = $CONFIG->dbprefix . 'objects_entity';
break;
case 'user':
$sub_table = $CONFIG->dbprefix . 'users_entity';
break;
case 'group':
$sub_table = $CONFIG->dbprefix . 'groups_entity';
break;
case 'site':
$sub_table = $CONFIG->dbprefix . 'sites_entity';
break;
}
if ($sub_table) {
delete_data("DELETE from {$sub_table} where guid={$guid}");
}
}
return $res;
}
}
}
return false;
//.........这里部分代码省略.........
示例15: system_message
system_message(elgg_echo('blog:message:saved'));
$status = $blog->status;
// add to river if changing status or published, regardless of new post
// because we remove it for drafts.
if (($new_post || $old_status == 'draft') && $status == 'published') {
add_to_river('river/object/blog/create', 'create', $blog->owner_guid, $blog->getGUID());
// we only want notifications sent when post published
register_notification_object('object', 'blog', elgg_echo('blog:newpost'));
elgg_trigger_event('publish', 'object', $blog);
// reset the creation time for posts that move from draft to published
if ($guid) {
$blog->time_created = time();
$blog->save();
}
} elseif ($old_status == 'published' && $status == 'draft') {
elgg_delete_river(array('object_guid' => $blog->guid, 'action_type' => 'create'));
}
//Khang Added
forward(REFERER);
if ($blog->status == 'published' || $save == false) {
forward($blog->getURL());
} else {
forward("blog/edit/{$blog->guid}");
}
} else {
register_error(elgg_echo('blog:error:cannot_save'));
forward($error_forward_url);
}
} else {
register_error($error);
forward($error_forward_url);