• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP notify_user函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中notify_user函数的典型用法代码示例。如果您正苦于以下问题:PHP notify_user函数的具体用法?PHP notify_user怎么用?PHP notify_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了notify_user函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: daily

 /**
  * Add menu items to the filter menu
  *
  * @param string $hook         'cron'
  * @param string $type         'daily'
  * @param string $return_value optional output
  * @param array  $params       supplied params
  *
  * @return void
  */
 public static function daily($hook, $type, $return_value, $params)
 {
     if (!static_out_of_date_enabled()) {
         return;
     }
     $time = elgg_extract('time', $params, time());
     $days = (int) elgg_get_plugin_setting('out_of_date_days', 'static');
     $site = elgg_get_site_entity();
     $options = ['type' => 'object', 'subtype' => \StaticPage::SUBTYPE, 'limit' => false, 'modified_time_upper' => $time - $days * 24 * 60 * 60, 'modified_time_lower' => $time - ($days + 1) * 24 * 60 * 60, 'order_by' => 'e.time_updated DESC'];
     // ignore access
     $ia = elgg_set_ignore_access(true);
     $batch = new \ElggBatch('elgg_get_entities', $options);
     $users = [];
     foreach ($batch as $entity) {
         $last_editors = $entity->getAnnotations(['annotation_name' => 'static_revision', 'limit' => 1, 'order_by' => 'n_table.time_created DESC']);
         if (empty($last_editors)) {
             continue;
         }
         $users[$last_editors[0]->getOwnerGUID()] = $last_editors[0]->getOwnerEntity();
     }
     // restore access
     elgg_set_ignore_access($ia);
     if (empty($users)) {
         return;
     }
     foreach ($users as $user) {
         $subject = elgg_echo('static:out_of_date:notification:subject');
         $message = elgg_echo('static:out_of_date:notification:message', [$user->name, elgg_normalize_url('static/out_of_date/' . $user->username)]);
         notify_user($user->getGUID(), $site->getGUID(), $subject, $message, [], 'email');
     }
 }
开发者ID:coldtrick,项目名称:static,代码行数:41,代码来源:Cron.php


示例2: triggerMentionNotificationEvent

 /**
  * This functions performs actions when a wire post is created
  *
  * @param string     $event  'create'
  * @param string     $type   'object'
  * @param \ElggObject $object the ElggObject created
  *
  * @return void
  */
 public static function triggerMentionNotificationEvent($event, $type, \ElggObject $object)
 {
     if (!elgg_instanceof($object, 'object', 'thewire')) {
         return;
     }
     // @todo replace with decent Elgg 2.0 notification event handling
     //send out notification to users mentioned in a wire post
     $usernames = [];
     preg_match_all("/\\@([A-Za-z0-9\\_\\.\\-]+)/i", $object->description, $usernames);
     if (empty($usernames)) {
         return;
     }
     $usernames = array_unique($usernames[0]);
     $params = ['object' => $object, 'action' => 'mention'];
     foreach ($usernames as $username) {
         $username = str_ireplace('@', '', $username);
         $user = get_user_by_username($username);
         if (empty($user) || $user->getGUID() == $object->getOwnerGUID()) {
             continue;
         }
         $setting = thewire_tools_get_notification_settings($user->getGUID());
         if (empty($setting)) {
             continue;
         }
         $subject = elgg_echo('thewire_tools:notify:mention:subject');
         $message = elgg_echo('thewire_tools:notify:mention:message', [$user->name, $object->getOwnerEntity()->name, elgg_normalize_url("thewire/search/@{$user->username}")]);
         notify_user($user->getGUID(), $object->getOwnerGUID(), $subject, $message, $params, $setting);
     }
 }
开发者ID:coldtrick,项目名称:thewire_tools,代码行数:38,代码来源:Notifications.php


示例3: post

 /**
  * {@inheritdoc}
  */
 public function post(ParameterBag $params)
 {
     $user = elgg_get_logged_in_user_entity();
     $object = get_entity($params->guid);
     if (!$object || !$object->canWriteToContainer(0, 'object', 'comment')) {
         throw new GraphException("You are not allowed to comment on this object", 403);
     }
     $comment_text = $params->comment;
     $comment = new ElggComment();
     $comment->owner_guid = $user->guid;
     $comment->container_guid = $object->guid;
     $comment->description = $comment_text;
     $comment->access_id = $object->access_id;
     if (!$comment->save()) {
         throw new GraphException(elgg_echo("generic_comment:failure"));
     }
     // Notify if poster wasn't owner
     if ($object->owner_guid != $user->guid) {
         $owner = $object->getOwnerEntity();
         notify_user($owner->guid, $user->guid, elgg_echo('generic_comment:email:subject', array(), $owner->language), elgg_echo('generic_comment:email:body', array($object->title, $user->name, $comment->description, $comment->getURL(), $user->name, $user->getURL()), $owner->language), array('object' => $comment, 'action' => 'create'));
     }
     $return = array('nodes' => array('comment' => $comment));
     // Add to river
     $river_id = elgg_create_river_item(array('view' => 'river/object/comment/create', 'action_type' => 'comment', 'subject_guid' => $user->guid, 'object_guid' => $comment->guid, 'target_guid' => $object->guid));
     if ($river_id) {
         $river = elgg_get_river(array('ids' => $river_id));
         $return['nodes']['activity'] = $river ? $river[0] : $river_id;
     }
     return $return;
 }
开发者ID:hypejunction,项目名称:hypegraph,代码行数:33,代码来源:ObjectComments.php


示例4: deleteRequest

 /**
  * Listen to the delete of a membership request
  *
  * @param stirng            $event        the name of the event
  * @param stirng            $type         the type of the event
  * @param \ElggRelationship $relationship the relationship
  *
  * @return void
  */
 public static function deleteRequest($event, $type, $relationship)
 {
     if (!$relationship instanceof \ElggRelationship) {
         return;
     }
     if ($relationship->relationship !== 'membership_request') {
         // not a membership request
         return;
     }
     $action_pattern = '/action\\/groups\\/killrequest/i';
     if (!preg_match($action_pattern, current_page_url())) {
         // not in the action, so do nothing
         return;
     }
     $group = get_entity($relationship->guid_two);
     $user = get_user($relationship->guid_one);
     if (empty($user) || !$group instanceof \ElggGroup) {
         return;
     }
     if ($user->getGUID() === elgg_get_logged_in_user_guid()) {
         // user kills own request
         return;
     }
     $reason = get_input('reason');
     if (empty($reason)) {
         $body = elgg_echo('group_tools:notify:membership:declined:message', array($user->name, $group->name, $group->getURL()));
     } else {
         $body = elgg_echo('group_tools:notify:membership:declined:message:reason', array($user->name, $group->name, $reason, $group->getURL()));
     }
     $subject = elgg_echo('group_tools:notify:membership:declined:subject', array($group->name));
     $params = array('object' => $group, 'action' => 'delete');
     notify_user($user->getGUID(), $group->getGUID(), $subject, $body, $params);
 }
开发者ID:lorea,项目名称:Hydra-dev,代码行数:42,代码来源:Membership.php


示例5: au_landing_page_update

function au_landing_page_update($event, $type, $object)
{
    if (!elgg_instanceof($object, 'page') && elgg_instanceof($object, 'page_top')) {
        return true;
    }
    // only process this event once
    if (elgg_get_config('page_update_notify_sent_' . $object->guid)) {
        return true;
    }
    elgg_set_config('page_update_notify_sent_' . $object->guid, true);
    // get revision history for the page
    $revisions = $object->getAnnotations(array('annotation_name' => 'page', 'limit' => false));
    // create an array of unique users to notify, excluding the current user
    // and the object owner (as core notifies them)
    $users = array();
    foreach ($revisions as $revision) {
        if ($revision->owner_guid != $object->owner_guid && $revision->owner_guid != elgg_get_logged_in_user_guid()) {
            $users[] = $revision->owner_guid;
        }
    }
    $users = array_unique($users);
    // notify the users
    if (count($users)) {
        notify_user($users, elgg_get_logged_in_user_guid(), elgg_echo('au_landing:page:update:subject', array($object->title)), elgg_echo('au_landing:page:update:message', array($object->title, elgg_get_logged_in_user_entity()->name, $object->getURL())));
    }
}
开发者ID:AU-Landing-Project,项目名称:au_landing,代码行数:26,代码来源:events.php


示例6: hj_forum_notify_subscribed_users

/**
 * Notify subscribed users
 * @param int $guid
 */
function hj_forum_notify_subscribed_users($guid)
{
    $entity = get_entity($guid);
    //$parentEntity = get_entity($entity->container_guid);
    $subscribers = $entity->getSubscribedUsers();
    $to = array();
    foreach ($subscribers as $subscribed) {
        $to[] = $subscribed->guid;
    }
    $subtype = $entity->getSubtype();
    $from = elgg_get_site_entity()->guid;
    $subject = elgg_echo("hj:forum:new:{$subtype}");
    $subject_link = elgg_view('framework/bootstrap/user/elements/name', array('entity' => $entity->getOwnerEntity()));
    $object_link = elgg_view('framework/bootstrap/object/elements/title', array('entity' => $entity));
    $breadcrumbs = elgg_view('framework/bootstrap/object/elements/breadcrumbs', array('entity' => $entity));
    if (!empty($breadcrumbs)) {
        $breadcrumbs_link = elgg_echo('river:in:forum', array($breadcrumbs));
    }
    $key = "river:create:object:{$subtype}";
    $summary = elgg_echo($key, array($subject_link, $object_link)) . $breadcrumbs_link;
    $body = elgg_view('framework/bootstrap/object/elements/description', array('entity' => $entity));
    $link = elgg_view('output/url', array('text' => elgg_echo('hj:framework:notification:link'), 'href' => $entity->getURL(), 'is_trusted' => true));
    $footer = elgg_echo('hj:framework:notification:full_link', array($link));
    $message = "<p>{$summary}</p><p>{$body}</p><p>{$footer}</p>";
    notify_user($to, $from, $subject, $message);
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:30,代码来源:base.php


示例7: post

 /**
  * {@inheritdoc}
  */
 public function post(ParameterBag $params)
 {
     $user = elgg_get_logged_in_user_entity();
     $group = get_entity($params->guid);
     // join or request
     $join = false;
     if ($group->isPublicMembership() || $group->canEdit($user->guid)) {
         // anyone can join public groups and admins can join any group
         $join = true;
     } else {
         if (check_entity_relationship($group->guid, 'invited', $user->guid)) {
             // user has invite to closed group
             $join = true;
         }
     }
     if ($join) {
         if (groups_join_group($group, $user)) {
             $msg = elgg_echo("groups:joined");
         } else {
             throw new GraphException(elgg_echo("groups:cantjoin"));
         }
     } else {
         if (!add_entity_relationship($user->guid, 'membership_request', $group->guid)) {
             throw new GraphException(elgg_echo("groups:joinrequestnotmade"));
         }
         $owner = $group->getOwnerEntity();
         $url = elgg_normalize_url("groups/requests/{$group->guid}");
         $subject = elgg_echo('groups:request:subject', array($user->name, $group->name), $owner->language);
         $body = elgg_echo('groups:request:body', array($group->getOwnerEntity()->name, $user->name, $group->name, $user->getURL(), $url), $owner->language);
         // Notify group owner
         notify_user($owner->guid, $user->getGUID(), $subject, $body);
         $msg = elgg_echo("groups:joinrequestmade");
     }
     return array('nodes' => array('member' => check_entity_relationship($user->guid, 'member', $group->guid), 'invited' => check_entity_relationship($group->guid, 'invited', $user->guid), 'membership_request' => check_entity_relationship($user->guid, 'membership_request', $group->guid)));
 }
开发者ID:hypejunction,项目名称:hypegraph,代码行数:38,代码来源:GroupMembers.php


示例8: thewire_tools_create_object_event_handler

/**
 * This functions performs actions when a wire post is created
 *
 * @param string     $event  'create'
 * @param string     $type   'object'
 * @param ElggObject $object the ElggObject created
 *
 * @return void
 */
function thewire_tools_create_object_event_handler($event, $type, ElggObject $object)
{
    if (empty($object) || !elgg_instanceof($object, "object", "thewire")) {
        return;
    }
    //send out notification to users mentioned in a wire post
    $usernames = array();
    preg_match_all("/\\@([A-Za-z0-9\\_\\.\\-]+)/i", $object->description, $usernames);
    if (empty($usernames)) {
        return;
    }
    $usernames = array_unique($usernames[0]);
    $params = array("object" => $object, "action" => "mention");
    foreach ($usernames as $username) {
        $username = str_ireplace("@", "", $username);
        $user = get_user_by_username($username);
        if (empty($user) || $user->getGUID() == $object->getOwnerGUID()) {
            continue;
        }
        $setting = thewire_tools_get_notification_settings($user->getGUID());
        if (empty($setting)) {
            continue;
        }
        $subject = elgg_echo("thewire_tools:notify:mention:subject");
        $message = elgg_echo("thewire_tools:notify:mention:message", array($user->name, $object->getOwnerEntity()->name, elgg_normalize_url("thewire/search/@" . $user->username)));
        notify_user($user->getGUID(), $object->getOwnerGUID(), $subject, $message, $params, $setting);
    }
}
开发者ID:Twizanex,项目名称:thewire_tools,代码行数:37,代码来源:events.php


示例9: security_tools_usersettings_save_handler

/**
 * Listen to the usersettings save hook for some notifications to the user
 *
 * @param string $hook         usersettings:save
 * @param string $type         user
 * @param bool   $return_value not supplied for this hook
 * @param null   $params       not supplied for this hook
 *
 * @return void
 */
function security_tools_usersettings_save_handler($hook, $type, $return_value, $params)
{
    $user_guid = (int) get_input("guid");
    if (empty($user_guid)) {
        $user_guid = elgg_get_logged_in_user_guid();
    }
    if (empty($user_guid)) {
        return $return_value;
    }
    $user = get_user($user_guid);
    if (empty($user) || !$user->canEdit()) {
        return $return_value;
    }
    // passwords are different
    if (_elgg_set_user_password() === true) {
        // do we need to notify the user about a password change
        $setting = elgg_get_plugin_setting("mails_password_change", "security_tools");
        if ($setting != "no") {
            $site = elgg_get_site_entity();
            $subject = elgg_echo("security_tools:notify_user:password:subject");
            $message = elgg_echo("security_tools:notify_user:password:message", array($user->name, $site->name, $site->url));
            notify_user($user->getGUID(), $site->getGUID(), $subject, $message, null, "email");
        }
    }
    // email are also different
    $setting = elgg_get_plugin_setting("mails_verify_email_change", "security_tools");
    if ($setting != "no" && $user->getGUID() == elgg_get_logged_in_user_guid()) {
        // verify new email address
        security_tools_prepare_email_change();
    } else {
        // old way, or admin changes your email
        _elgg_set_user_email();
    }
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:44,代码来源:hooks.php


示例10: membershipRequest

 /**
  * Notify the group admins about a membership request
  *
  * @param string            $event        create
  * @param string            $type         membership_request
  * @param \ElggRelationship $relationship the created membership request relation
  *
  * @return void
  */
 public static function membershipRequest($event, $type, $relationship)
 {
     if (!$relationship instanceof \ElggRelationship) {
         return;
     }
     if ($relationship->relationship !== 'membership_request') {
         return;
     }
     // only send a message if group admins are allowed
     if (!group_tools_multiple_admin_enabled()) {
         return;
     }
     $user = get_user($relationship->guid_one);
     $group = get_entity($relationship->guid_two);
     if (empty($user) || !$group instanceof \ElggGroup) {
         return;
     }
     // Notify group admins
     $options = ['relationship' => 'group_admin', 'relationship_guid' => $group->getGUID(), 'inverse_relationship' => true, 'type' => 'user', 'limit' => false, 'wheres' => ["e.guid <> {$group->getOwnerGUID()}"]];
     $url = elgg_normalize_url("groups/requests/{$group->getGUID()}");
     $subject = elgg_echo('groups:request:subject', [$user->name, $group->name]);
     $admins = new \ElggBatch('elgg_get_entities_from_relationship', $options);
     foreach ($admins as $a) {
         $body = elgg_echo('groups:request:body', [$a->name, $user->name, $group->name, $user->getURL(), $url]);
         notify_user($a->getGUID(), $user->getGUID(), $subject, $body);
     }
 }
开发者ID:coldtrick,项目名称:group_tools,代码行数:36,代码来源:GroupAdmins.php


示例11: notifyLastEditor

 /**
  * Make sure the last editor of a static page gets notified about a comment
  *
  * @param string     $event  'create'
  * @param string     $type   'object'
  * @param \ElggObject $object the object that was just created
  *
  * @return void
  */
 public static function notifyLastEditor($event, $type, \ElggObject $object)
 {
     // check of this is a comment
     if (empty($object) || !elgg_instanceof($object, 'object', 'comment')) {
         return;
     }
     // is it a comment on a static page
     $container = $object->getContainerEntity();
     if (empty($container) || !elgg_instanceof($container, 'object', 'static')) {
         return;
     }
     $comment_owner = $object->getOwnerEntity();
     // get last revisor
     $ia = elgg_set_ignore_access(true);
     $revisions = $container->getAnnotations(['annotation_name' => 'static_revision', 'limit' => 1, 'reverse_order_by' => true]);
     $static_owner = $revisions[0]->getOwnerEntity();
     elgg_set_ignore_access($ia);
     // don't notify yourself
     if ($static_owner->getGUID() == $comment_owner->getGUID()) {
         return;
     }
     // @see actions/comment/save
     $subject = elgg_echo('generic_comment:email:subject');
     $message = elgg_echo('generic_comment:email:body', [$container->title, $comment_owner->name, $object->description, $container->getURL(), $comment_owner->name, $comment_owner->getURL()]);
     $params = ['object' => $object, 'action' => 'create'];
     notify_user($static_owner->getGUID(), $comment_owner->getGUID(), $subject, $message, $params);
 }
开发者ID:coldtrick,项目名称:static,代码行数:36,代码来源:Notifications.php


示例12: sendUserNotifications

 public function sendUserNotifications()
 {
     if (is_array($this->calloutUsers)) {
         foreach ($this->calloutUsers as $calloutUserGuid) {
             notify_user($calloutUserGuid, $this->fromUser->guid, $this->fromUser->name . " mentioned you in " . $this->context, "You have been mentioned in " . $this->context . ". View it here: " . $this->url);
         }
     } else {
         notify_user($this->calloutUsers, $this->fromUser->guid, $this->fromUser->name . " mentioned you in " . $this->context, "You have been mentioned in " . $this->context . ". View it here: " . $this->url);
     }
 }
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:10,代码来源:UserCallout.php


示例13: friend_collection_message_shutdown_tasks

/**
 * send the message in the vroom shutdown stage
 */
function friend_collection_message_shutdown_tasks()
{
    $id = elgg_get_config('friend_collection_message_id');
    $recipients = elgg_get_config('friend_collection_message_recipients');
    $subject = elgg_get_config('friend_collection_message_subject');
    $message = elgg_get_config('friend_collection_message_message');
    $members = get_members_of_access_collection($id, true);
    $guids = array_intersect($recipients, $members);
    notify_user($guids, elgg_get_logged_in_user_guid(), $subject, $message);
}
开发者ID:arckinteractive,项目名称:friend_collections_message,代码行数:13,代码来源:start.php


示例14: send_validation_reminder_mail

/**
 * Send validation reminder to a specified user with
 * some parameters.
 *
 * @param ElggUser $user User to send the reminder to
 * @param int $enddate The end date in a unix timestamp
 * @param int $pastdays The days we've passed since the validation
 */
function send_validation_reminder_mail($user, $enddate, $pastdays)
{
    $daysleft = $enddate - $pastdays;
    $site = elgg_get_site_entity();
    $code = uservalidationbyemail_generate_code($user->getGUID(), $user->email);
    $link = $site->url . 'uservalidationbyemail/confirm?u=' . $user->getGUID() . '&c=' . $code;
    $subject = elgg_echo('validation_reminder:validate:token:subject', array($user->name, $site->name), $user->language);
    $body = elgg_echo('validation_reminder:validate:token:body', array($user->name, $pastdays, $site->name, $user->token, $link, $daysleft, $site->name, $site->url), $user->language);
    // Send validation email
    notify_user($user->guid, $site->guid, $subject, $body, array(), 'email');
}
开发者ID:centillien,项目名称:validation_reminder,代码行数:19,代码来源:start.php


示例15: account_removal_send_thank_notification

/**
 * Send a thank you notification after account removal
 *
 * @param string $type      what kind of removal
 * @param int    $user_guid the user_guid to send the notification to
 *
 * @return bool
 */
function account_removal_send_thank_notification($type, $user_guid)
{
    $result = false;
    $site = elgg_get_site_entity();
    if (!empty($user_guid) && ($user = get_user($user_guid)) && in_array($type, array("remove", "disable"))) {
        $subject = elgg_echo("account_removal:message:thank_you:" . $type . ":subject", array($site->name));
        $message = elgg_echo("account_removal:message:thank_you:" . $type . ":body", array($user->name, $site->name));
        notify_user($user_guid, $site->getGUID(), $subject, $message, null, "email");
        $result = true;
    }
    return $result;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:20,代码来源:functions.php


示例16: friend_request_event_create_friendrequest

function friend_request_event_create_friendrequest($event, $object_type, $object)
{
    if ($object instanceof ElggRelationship) {
        $user_one = get_user($object->guid_one);
        $user_two = get_user($object->guid_two);
        $view_friends_url = elgg_get_site_url() . "friend_request/" . $user_two->username;
        // Notify target user
        $subject = elgg_echo('friend_request:newfriend:subject', array($user_one->name));
        $message = elgg_echo("friend_request:newfriend:body", array($user_one->name, $view_friends_url));
        return notify_user($object->guid_two, $object->guid_one, $subject, $message);
    }
}
开发者ID:duanhv,项目名称:mdg-social,代码行数:12,代码来源:events.php


示例17: deliver_request

/**
 * Deliver a request
 * @param integer $requestid
 * @return true if the request status was updated successfully, false otherwise
 */
function deliver_request($requestid)
{
    global $DB;
    // Update the request status to 1, meaning it has been delivered.
    if (!$DB->update_record('block_ps_selfstudy_request', array('id' => $requestid, 'request_status' => '1'))) {
        return false;
    }
    // Notify the user that his/her course has been delivered.
    $sql = "SELECT  course_name AS coursename,\n                    course_code AS coursecode,\n                    request.student_id AS student_id,\n                    firstname,\n                    lastname,\n                    email\n              FROM  {block_ps_selfstudy_request} request\n              JOIN  {block_ps_selfstudy_course} course ON course.id = request.course_id\n              JOIN  {user} u ON u.id = student_id\n             WHERE  request.id = ?";
    $requestinfo = $DB->get_record_sql($sql, array($requestid));
    notify_user($requestinfo);
    return true;
}
开发者ID:andrewmrg,项目名称:ps_selfstudy,代码行数:18,代码来源:locallib.php


示例18: rp_send_username

function rp_send_username($user_guid)
{
    global $CONFIG;
    $user_guid = (int) $user_guid;
    $user = get_entity($user_guid);
    $username = $user->username;
    if ($user) {
        // generate email
        $email = sprintf(elgg_echo('email:requsername:body'), $user->name, $user->username);
        return notify_user($user->guid, $CONFIG->site->guid, elgg_echo('email:requsername:subject'), $email, NULL, 'email');
    }
    return false;
}
开发者ID:CashElgg,项目名称:request_password,代码行数:13,代码来源:requestusername.php


示例19: addMember

 /**
  * Add user as member of the chat.
  *
  * @param int $user_guid
  */
 public function addMember($user_guid)
 {
     $success = add_entity_relationship($user_guid, 'member', $this->getGUID());
     // Send notifications
     if ($success) {
         $user = elgg_get_logged_in_user_entity();
         if ($user->guid !== $user_guid) {
             $subject = elgg_echo('chat:notification:subject:newchat');
             $body = elgg_echo('chat:notification:newchat', array($user->name, $this->title, $this->getURL()));
             notify_user($user_guid, elgg_get_site_entity()->getGUID(), $subject, $body);
         }
     }
     return $success;
 }
开发者ID:juho-jaakkola,项目名称:elgg-chat,代码行数:19,代码来源:ElggChat.php


示例20: 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);
 }
开发者ID:lorea,项目名称:Hydra-dev,代码行数:58,代码来源:Cron.php



注:本文中的notify_user函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP now函数代码示例发布时间:2022-05-15
下一篇:
PHP notify_login_failures函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap