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

PHP get_user_notification_settings函数代码示例

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

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



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

示例1: adminApprovalSubs

 /**
  * Get the subscribers for a new group which needs admin approval
  *
  * @param string $hook         the name of the hook
  * @param string $type         the type of the hook
  * @param array  $return_value current return value
  * @param array  $params       supplied params
  *
  * @return void|array
  */
 public static function adminApprovalSubs($hook, $type, $return_value, $params)
 {
     $event = elgg_extract('event', $params);
     if (!$event instanceof \Elgg\Notifications\Event) {
         return;
     }
     $group = $event->getObject();
     if (!$group instanceof \ElggGroup) {
         return;
     }
     $action = $event->getAction();
     if ($action !== 'admin_approval') {
         return;
     }
     // get all admins
     $dbprefix = elgg_get_config('dbprefix');
     $batch = new \ElggBatch('elgg_get_entities', ['type' => 'user', 'joins' => ["JOIN {$dbprefix}users_entity ue ON e.guid = ue.guid"], 'wheres' => ['ue.admin = "yes"']]);
     /* @var $user \ElggUser */
     foreach ($batch as $user) {
         $notification_settings = get_user_notification_settings($user->getGUID());
         if (empty($notification_settings)) {
             continue;
         }
         $return_value[$user->getGUID()] = [];
         foreach ($notification_settings as $method => $active) {
             if (!$active) {
                 continue;
             }
             $return_value[$user->getGUID()][] = $method;
         }
     }
     return $return_value;
 }
开发者ID:coldtrick,项目名称:group_tools,代码行数:43,代码来源:Notifications.php


示例2: notify_user

/**
 * Notify a user via their preferences.
 *
 * @param mixed $to Either a guid or an array of guid's to notify.
 * @param int $from GUID of the sender, which may be a user, site or object.
 * @param string $subject Message subject.
 * @param string $message Message body.
 * @param array $params Misc additional parameters specific to various methods.
 * @param mixed $methods_override A string, or an array of strings specifying the delivery methods to use - or leave blank
 * 				for delivery using the user's chosen delivery methods.
 * @return array Compound array of each delivery user/delivery method's success or failure.
 * @throws NotificationException
 */
function notify_user($to, $from, $subject, $message, array $params = NULL, $methods_override = "")
{
    global $NOTIFICATION_HANDLERS, $CONFIG;
    // Sanitise
    if (!is_array($to)) {
        $to = array((int) $to);
    }
    $from = (int) $from;
    //$subject = sanitise_string($subject);
    // Get notification methods
    if ($methods_override && !is_array($methods_override)) {
        $methods_override = array($methods_override);
    }
    $result = array();
    foreach ($to as $guid) {
        // Results for a user are...
        $result[$guid] = array();
        if ($guid) {
            // Is the guid > 0?
            // Are we overriding delivery?
            $methods = $methods_override;
            if (!$methods) {
                $tmp = (array) get_user_notification_settings($guid);
                $methods = array();
                foreach ($tmp as $k => $v) {
                    if ($v) {
                        $methods[] = $k;
                    }
                }
                // Add method if method is turned on for user!
            }
            if ($methods) {
                // Deliver
                foreach ($methods as $method) {
                    // Extract method details from list
                    $details = $NOTIFICATION_HANDLERS[$method];
                    $handler = $details->handler;
                    if (!$NOTIFICATION_HANDLERS[$method] || !$handler) {
                        error_log(sprintf(elgg_echo('NotificationException:NoHandlerFound'), $method));
                    }
                    if ($CONFIG->debug) {
                        error_log("Sending message to {$guid} using {$method}");
                    }
                    // Trigger handler and retrieve result.
                    try {
                        $result[$guid][$method] = $handler($from ? get_entity($from) : NULL, get_entity($guid), $subject, $message, $params);
                    } catch (Exception $e) {
                        error_log($e->getMessage());
                    }
                }
            }
        }
    }
    return $result;
}
开发者ID:eokyere,项目名称:elgg,代码行数:68,代码来源:notification.php


示例3: addDiscussionOwner

 /**
  * Add a discussion owner to the notified users
  *
  * @param string $hook         the name of the hook
  * @param stirng $type         the type of the hook
  * @param array  $return_value the current return value
  * @param array  $params       supplied values
  *
  * @return void|array
  */
 public static function addDiscussionOwner($hook, $type, $return_value, $params)
 {
     if (empty($params) || !is_array($params)) {
         return;
     }
     $event = elgg_extract('event', $params);
     if (!$event instanceof \Elgg\Notifications\Event) {
         return;
     }
     $discussion_reply = $event->getObject();
     if (!$discussion_reply instanceof \ElggDiscussionReply) {
         return;
     }
     $discussion = $discussion_reply->getContainerEntity();
     if (!elgg_instanceof($discussion, 'object', 'discussion')) {
         return;
     }
     $owner = $discussion->getOwnerEntity();
     if (!$owner instanceof \ElggUser) {
         return;
     }
     $user_notification_settings = get_user_notification_settings($owner->getGUID());
     if (empty($user_notification_settings)) {
         // user has no settings, so no notification
         return;
     }
     $temp = [];
     foreach ($user_notification_settings as $method => $enabled) {
         if (empty($enabled)) {
             // notification method not enabled
             continue;
         }
         $temp[] = $method;
     }
     if (empty($temp)) {
         // no enabled notification methods
         return;
     }
     $return_value[$owner->getGUID()] = $temp;
     return $return_value;
 }
开发者ID:coldtrick,项目名称:content_subscriptions,代码行数:51,代码来源:Subscriptions.php


示例4: get_user_notification_settings

<?php

/**
 * User settings for notifications.
 * 
 * @package Elgg
 * @subpackage Core
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Curverider Ltd
 * @copyright Curverider Ltd 2008-2009
 * @link http://elgg.org/
 */
global $NOTIFICATION_HANDLERS;
$notification_settings = get_user_notification_settings(page_owner());
?>
	<h3><?php 
echo elgg_echo('notifications:usersettings');
?>
</h3>
	
	<p><?php 
echo elgg_echo('notifications:methods');
?>
	
	<table>
<?php 
// Loop through options
foreach ($NOTIFICATION_HANDLERS as $k => $v) {
    ?>
			<tr>
				<td><?php 
开发者ID:eokyere,项目名称:elgg,代码行数:31,代码来源:usersettings.php


示例5: _elgg_comments_add_content_owner_to_subscriptions

/**
 * Add the owner of the content being commented on to the subscribers
 *
 * @param string $hook        'get'
 * @param string $type        'subscribers'
 * @param array  $returnvalue current subscribers
 * @param array  $params      supplied params
 *
 * @return void|array
 *
 * @access private
 */
function _elgg_comments_add_content_owner_to_subscriptions($hook, $type, $returnvalue, $params)
{
    $event = elgg_extract('event', $params);
    if (!$event instanceof \Elgg\Notifications\Event) {
        return;
    }
    $object = $event->getObject();
    if (!elgg_instanceof($object, 'object', 'comment')) {
        // can't use instanceof ElggComment as discussion replies inherit
        return;
    }
    $content_owner = $object->getContainerEntity()->getOwnerEntity();
    if (!$content_owner instanceof ElggUser) {
        return;
    }
    $notification_settings = get_user_notification_settings($content_owner->getGUID());
    if (empty($notification_settings)) {
        return;
    }
    $returnvalue[$content_owner->getGUID()] = [];
    foreach ($notification_settings as $method => $enabled) {
        if (empty($enabled)) {
            continue;
        }
        $returnvalue[$content_owner->getGUID()][] = $method;
    }
    return $returnvalue;
}
开发者ID:elgg,项目名称:elgg,代码行数:40,代码来源:comments.php


示例6: zhsite_send_email_to_user

function zhsite_send_email_to_user($to_user, $subject, $message, $is_notificiation)
{
    if ($is_notificiation) {
        if ($notification_settings = get_user_notification_settings($to_user->guid)) {
            if (!$notification_settings->email) {
                return false;
            }
        } else {
            elgg_log("ZHError ,zhsite_send_email_to_user, error calling get_user_notification_settings, to_user_id {$to_user->guid}, " . "logged_user_id " . elgg_get_logged_in_user_guid(), "ERROR");
            return false;
        }
    }
    $end = zhaohuEmailUnsubEnd(null, $to_user->guid, $is_notificiation, false);
    $to_email = $to_user->name . "<" . $to_user->email . ">";
    return zhgroups_send_email(elgg_get_site_entity()->name, $to_email, $subject, $message, $end);
}
开发者ID:pingwangcs,项目名称:51zhaohu,代码行数:16,代码来源:notify.php


示例7: get_input

<?php

/**
 * Elgg notifications user preference save acion.
 *
 * @package Elgg
 * @subpackage Core
 */
$method = get_input('method');
$current_settings = get_user_notification_settings();
$result = false;
foreach ($method as $k => $v) {
    // check if setting has changed and skip if not
    if ($current_settings->{$k} == ($v == 'yes')) {
        continue;
    }
    $result = set_user_notification_setting(elgg_get_logged_in_user_guid(), $k, $v == 'yes' ? true : false);
    if (!$result) {
        register_error(elgg_echo('notifications:usersettings:save:fail'));
    }
}
if ($result) {
    system_message(elgg_echo('notifications:usersettings:save:ok'));
}
开发者ID:duanhv,项目名称:mdg-social,代码行数:24,代码来源:save.php


示例8: elgg_echo

?>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td class="namefield">
			<p>
				<?php 
echo elgg_echo('notifications:subscriptions:personal:description');
?>
			</p>
		</td>

<?php 
$fields = '';
$i = 0;
$notification_settings = get_user_notification_settings($user->guid);
if (!$notification_settings) {
    elgg_log("Error get_user_notification_settings for user {$user->guid}", "ERROR");
}
foreach ($NOTIFICATION_HANDLERS as $method => $foo) {
    if ($notification_settings->{$method}) {
        $personalchecked[$method] = 'checked="checked"';
    } else {
        $personalchecked[$method] = '';
    }
    if ($i > 0) {
        $fields .= "<td class='spacercolumn'>&nbsp;</td>";
    }
    $fields .= <<<END
\t\t<td class="{$method}togglefield">
\t\t<a  border="0" id="{$method}personal" class="{$method}toggleOff" onclick="adjust{$method}_alt('{$method}personal');">
开发者ID:pingwangcs,项目名称:51zhaohu,代码行数:31,代码来源:personal.php


示例9: get_user_notification_settings

<?php

/**
 * User settings for notifications.
 *
 * @package Elgg
 * @subpackage Core
 */
global $NOTIFICATION_HANDLERS;
$notification_settings = get_user_notification_settings(elgg_get_page_owner_guid());
$title = elgg_echo('notifications:usersettings');
$rows = '';
// Loop through options
foreach ($NOTIFICATION_HANDLERS as $k => $v) {
    if ($notification_settings->{$k}) {
        $val = "yes";
    } else {
        $val = "no";
    }
    $radio = elgg_view('input/radio', array('name' => "method[{$k}]", 'value' => $val, 'options' => array(elgg_echo('option:yes') => 'yes', elgg_echo('option:no') => 'no')));
    $cells = '<td class="prm pbl">' . elgg_echo("notification:method:{$k}") . ': </td>';
    $cells .= "<td>{$radio}</td>";
    $rows .= "<tr>{$cells}</tr>";
}
$content = elgg_echo('notifications:methods');
$content .= "<table>{$rows}</table>";
echo elgg_view_module('info', $title, $content);
开发者ID:duanhv,项目名称:mdg-social,代码行数:27,代码来源:notifications.php


示例10: thewire_add_original_poster

/**
 * Add temporary subscription for original poster if not already registered to
 * receive a notification of reply
 *
 * @param string $hook          Hook name
 * @param string $type          Hook type
 * @param array  $subscriptions Subscriptions for a notification event
 * @param array  $params        Parameters including the event
 * @return array
 */
function thewire_add_original_poster($hook, $type, $subscriptions, $params)
{
    $event = $params['event'];
    $entity = $event->getObject();
    if ($entity && elgg_instanceof($entity, 'object', 'thewire')) {
        $parent = $entity->getEntitiesFromRelationship(array('relationship' => 'parent'));
        if ($parent) {
            $parent = $parent[0];
            // do not add a subscription if reply was to self
            if ($parent->getOwnerGUID() !== $entity->getOwnerGUID()) {
                if (!array_key_exists($parent->getOwnerGUID(), $subscriptions)) {
                    $personal_methods = (array) get_user_notification_settings($parent->getOwnerGUID());
                    $methods = array();
                    foreach ($personal_methods as $method => $state) {
                        if ($state) {
                            $methods[] = $method;
                        }
                    }
                    if ($methods) {
                        $subscriptions[$parent->getOwnerGUID()] = $methods;
                        return $subscriptions;
                    }
                }
            }
        }
    }
}
开发者ID:elgg,项目名称:elgg,代码行数:37,代码来源:start.php


示例11: thewire_tools_get_notification_settings

/**
 * Get the subscription methods of the user
 *
 * @param int $user_guid the user_guid to check (default: current user)
 *
 * @return array
 */
function thewire_tools_get_notification_settings($user_guid = 0)
{
    $user_guid = sanitise_int($user_guid, false);
    if (empty($user_guid)) {
        $user_guid = elgg_get_logged_in_user_guid();
    }
    if (empty($user_guid)) {
        return array();
    }
    if (elgg_is_active_plugin("notifications")) {
        $saved = elgg_get_plugin_user_setting("notification_settings_saved", $user_guid, "thewire_tools");
        if (!empty($saved)) {
            $settings = elgg_get_plugin_user_setting("notification_settings", $user_guid, "thewire_tools");
            if (!empty($settings)) {
                return string_to_tag_array($settings);
            }
            return array();
        }
    }
    // default elgg settings
    $settings = get_user_notification_settings($user_guid);
    if (!empty($settings)) {
        $settings = (array) $settings;
        $res = array();
        foreach ($settings as $method => $value) {
            if (!empty($value)) {
                $res[] = $method;
            }
        }
        return $res;
    }
    return array();
}
开发者ID:Twizanex,项目名称:thewire_tools,代码行数:40,代码来源:functions.php


示例12: elgg_echo

		<td>&nbsp;</td>
	</tr>
	<tr>
		<td class="namefield">
			<p>
				<?php 
echo elgg_echo('notifications:subscriptions:personal:description');
?>
			</p>
		</td>

<?php 
$fields = '';
$i = 0;
foreach ($NOTIFICATION_HANDLERS as $method => $foo) {
    if ($notification_settings = get_user_notification_settings(elgg_get_logged_in_user_guid())) {
        if ($notification_settings->{$method}) {
            $personalchecked[$method] = 'checked="checked"';
        } else {
            $personalchecked[$method] = '';
        }
    }
    if ($i > 0) {
        $fields .= "<td class='spacercolumn'>&nbsp;</td>";
    }
    $fields .= <<<END
\t\t<td class="{$method}togglefield">
\t\t<a  border="0" id="{$method}personal" class="{$method}toggleOff" onclick="adjust{$method}_alt('{$method}personal');">
\t\t<input type="checkbox" name="{$method}personal" id="{$method}checkbox" onclick="adjust{$method}('{$method}personal');" value="1" {$personalchecked[$method]} /></a></td>
END;
    $i++;
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:31,代码来源:personal.php


示例13: user_support_get_subscriptions_support_ticket_hook

/**
 * Get the subscribers to the creation of a support ticket
 *
 * @param string $hook         the name of the hook
 * @param string $type         the type of the hook
 * @param array  $return_value current return value
 * @param array  $params       supplied params
 *
 * @return array
 */
function user_support_get_subscriptions_support_ticket_hook($hook, $type, $return_value, $params)
{
    if (empty($params) || !is_array($params)) {
        return $return_value;
    }
    $event = elgg_extract("event", $params);
    if (empty($event) || !$event instanceof Elgg_Notifications_Event) {
        return $return_value;
    }
    // ignore access
    $ia = elgg_set_ignore_access(true);
    // get object
    $object = $event->getObject();
    if (empty($object) || !elgg_instanceof($object, "object", UserSupportTicket::SUBTYPE)) {
        elgg_set_ignore_access($ia);
        return $return_value;
    }
    // by default notify nobody
    $return_value = array();
    // get all the admins to notify
    $users = user_support_get_admin_notify_users($object);
    if (empty($users) || !is_array($users)) {
        elgg_set_ignore_access($ia);
        return $return_value;
    }
    // pass all the guids of the admins/staff
    foreach ($users as $user) {
        $notification_settings = get_user_notification_settings($user->getGUID());
        if (empty($notification_settings)) {
            continue;
        }
        $methods = array();
        foreach ($notification_settings as $method => $subbed) {
            if ($subbed) {
                $methods[] = $method;
            }
        }
        if (!empty($methods)) {
            $return_value[$user->getGUID()] = $methods;
        }
    }
    // restore access
    elgg_set_ignore_access($ia);
    return $return_value;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:55,代码来源:hooks.php


示例14: register_error

if (!$group instanceof ElggGroup) {
    register_error(elgg_echo('error:missing_data'));
    forward(REFERER);
}
$user = elgg_get_logged_in_user_entity();
$notifications_enabled = \ColdTrick\GroupTools\Membership::notificationsEnabledForGroup($user, $group);
if ($notifications_enabled) {
    // user has notifications enabled, but wishes to disable this
    $NOTIFICATION_HANDLERS = _elgg_services()->notifications->getMethodsAsDeprecatedGlobal();
    foreach ($NOTIFICATION_HANDLERS as $method => $dummy) {
        elgg_remove_subscription($user->getGUID(), $method, $group->getGUID());
    }
    system_message(elgg_echo('group_tools:action:toggle_notifications:disabled', [$group->name]));
} else {
    // user has no notification settings for this group and wishes to enable this
    $user_settings = get_user_notification_settings($user->getGUID());
    $supported_notifications = ['site', 'email'];
    $found = [];
    if (!empty($user_settings)) {
        // check current user settings
        foreach ($user_settings as $method => $value) {
            if (!in_array($method, $supported_notifications)) {
                continue;
            }
            if (!empty($value)) {
                $found[] = $method;
            }
        }
    }
    // user has no base nofitication settings
    if (empty($found)) {
开发者ID:coldtrick,项目名称:group_tools,代码行数:31,代码来源:toggle_notifications.php


示例15: addAnswerOwnerToAnswerSubscribers

 /**
  * Add answer owner to the subscribers for an answer
  *
  * @param string $hook         the name of the hook
  * @param string $type         the type of the hook
  * @param array  $return_value current return value
  * @param array  $params       supplied params
  *
  * @return void|array
  */
 public static function addAnswerOwnerToAnswerSubscribers($hook, $type, $return_value, $params)
 {
     $event = elgg_extract('event', $params);
     if (!$event instanceof \Elgg\Notifications\Event) {
         return;
     }
     $answer = $event->getObject();
     if (!$answer instanceof \ElggAnswer) {
         return;
     }
     $owner = $answer->getOwnerEntity();
     $methods = get_user_notification_settings($owner->getGUID());
     if (empty($methods)) {
         return;
     }
     $filtered_methods = [];
     foreach ($methods as $method => $value) {
         if (empty($value)) {
             continue;
         }
         $filtered_methods[] = $method;
     }
     if (empty($filtered_methods)) {
         return;
     }
     $return_value[$owner->getGUID()] = $filtered_methods;
     return $return_value;
 }
开发者ID:epsylon,项目名称:Hydra-dev,代码行数:38,代码来源:Notifications.php


示例16: elgg_extract

}
$username = elgg_extract("username", $vars);
$notifications = array(true, false);
$targetUser = get_user_by_username($username);
if (!$targetUser) {
    register_error(elgg_echo("profile:notfound"));
    forward();
}
if (isset($targetUser->notifications)) {
    for ($i = 0; $i < max(count($targetUser->notifications), count($notifications)); $i++) {
        $notifications[$i] = $targetUser->notifications[$i] != "0";
    }
}
$groups = rijkshuisstijl_get_featured_groups();
$interests = rijkshuisstijl_get_interests($targetUser);
$notificationSettings = get_user_notification_settings($targetUser->guid);
/* will recode to use entitiesfromrelationship later
  $interests = $user->getEntitiesFromRelationship(array(
    'type' => 'group',
    'relationship' => 'interests'
  ));*/
?>

<script type="text/javascript">
  var gUsername = '<?php 
echo $username;
?>
';
  var gUserGuid = '<?php 
echo $targetUser->guid;
?>
开发者ID:pleio,项目名称:rijkshuisstijl,代码行数:31,代码来源:interests.php


示例17: elgg_echo

  </tr>
  <tr>
    <td class="namefield">
    	<p>
    		<?php 
echo elgg_echo('notifications:subscriptions:personal:description');
?>
    	</p>
    	
    </td>
    
<?php 
$fields = '';
$i = 0;
foreach ($NOTIFICATION_HANDLERS as $method => $foo) {
    if ($notification_settings = get_user_notification_settings($vars['user']->guid)) {
        if ($notification_settings->{$method}) {
            $personalchecked[$method] = 'checked="checked"';
        } else {
            $personalchecked[$method] = '';
        }
    }
    if ($i > 0) {
        $fields .= "<td class=\"spacercolumn\">&nbsp;</td>";
    }
    $fields .= <<<END
\t\t\t    <td class="{$method}togglefield">
\t\t\t    <a  border="0" id="{$method}personal" class="{$method}toggleOff" onclick="adjust{$method}_alt('{$method}personal');">
\t\t\t    <input type="checkbox" name="{$method}personal" id="{$method}checkbox" onclick="adjust{$method}('{$method}personal');" value="1" {$personalchecked[$method]} /></a></td>
END;
    $i++;
开发者ID:eokyere,项目名称:elgg,代码行数:31,代码来源:personal.php


示例18: get_entity

$entity = get_entity($entity_guid);
if (!$entity) {
    register_error(elgg_echo("generic_comment:notfound"));
    forward(REFERER);
}
$user = elgg_get_logged_in_user_entity();
$annotation = create_annotation($entity->getGUID(), "generic_comment", $comment_text, "", $user->getGUID(), $entity->access_id);
// tell user annotation posted
if (!$annotation) {
    register_error(elgg_echo("generic_comment:failure"));
    forward(REFERER);
}
// notify if poster wasn't owner
if ($entity->getOwnerGUID() != $user->getGUID()) {
    // get the notification settings for the owner
    $notification_settings = (array) get_user_notification_settings($entity->getOwnerGUID());
    if (!empty($notification_settings)) {
        // loop through the preferences
        foreach ($notification_settings as $method => $enabled) {
            if ($enabled) {
                if ($method == "email") {
                    // send special (short) message
                    notify_user($entity->getOwnerGUID(), $user->getGUID(), elgg_echo("generic_comment:email:subject"), elgg_echo("advanced_notifications:notification:email:body", array($entity->getURL())), null, $method);
                } else {
                    // send the normal message
                    notify_user($entity->getOwnerGUID(), $user->getGUID(), elgg_echo("generic_comment:email:subject"), elgg_echo("generic_comment:email:body", array($entity->title, $user->name, $comment_text, $entity->getURL(), $user->name, $user->getURL())), null, $method);
                }
            }
        }
    }
}
开发者ID:juliendangers,项目名称:advanced_notifications,代码行数:31,代码来源:add.php


示例19: hj_inbox_send_message


//.........这里部分代码省略.........
                if ($file->simpletype == "image") {
                    $file->icontime = time();
                    $thumbnail = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), 60, 60, true);
                    if ($thumbnail) {
                        $thumb = new ElggFile();
                        $thumb->setMimeType($attachments['type'][$i]);
                        $thumb->setFilename($prefix . "thumb" . $filestorename);
                        $thumb->open("write");
                        $thumb->write($thumbnail);
                        $thumb->close();
                        $file->thumbnail = $prefix . "thumb" . $filestorename;
                        unset($thumbnail);
                    }
                    $thumbsmall = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), 153, 153, true);
                    if ($thumbsmall) {
                        $thumb->setFilename($prefix . "smallthumb" . $filestorename);
                        $thumb->open("write");
                        $thumb->write($thumbsmall);
                        $thumb->close();
                        $file->smallthumb = $prefix . "smallthumb" . $filestorename;
                        unset($thumbsmall);
                    }
                    $thumblarge = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), 600, 600, false);
                    if ($thumblarge) {
                        $thumb->setFilename($prefix . "largethumb" . $filestorename);
                        $thumb->open("write");
                        $thumb->write($thumblarge);
                        $thumb->close();
                        $file->largethumb = $prefix . "largethumb" . $filestorename;
                        unset($thumblarge);
                    }
                }
            }
        }
    }
    $success = $error = 0;
    foreach ($recipient_guids as $recipient_guid) {
        $message_to = new ElggObject();
        $message_to->subtype = "messages";
        $message_to->owner_guid = $recipient_guid;
        $message_to->container_guid = $recipient_guid;
        $message_to->access_id = ACCESS_PRIVATE;
        $message_to->title = $subject;
        $message_to->description = $message;
        $message_to->toId = $recipient_guids;
        // the users receiving the message
        $message_to->fromId = $sender_guid;
        // the user sending the message
        $message_to->readYet = 0;
        // this is a toggle between 0 / 1 (1 = read)
        $message_to->hiddenFrom = 0;
        // this is used when a user deletes a message in their sentbox, it is a flag
        $message_to->hiddenTo = 0;
        // this is used when a user deletes a message in their inbox
        $message_to->msg = 1;
        $message_to->msgType = $message_type;
        $message_to->msgHash = $message_hash;
        if ($message_to->save()) {
            $success++;
            // Make attachments
            if ($uploaded_attachments) {
                foreach ($uploaded_attachments as $attachment_guid) {
                    make_attachment($message_to->guid, $attachment_guid);
                }
            }
            // Send out notifications skipping 'site' notification handler
            if ($recipient_guid != $sender_guid) {
                $methods = (array) get_user_notification_settings($recipient_guid);
                unset($methods['site']);
                if (count($methods)) {
                    $recipient = get_user($recipient_guid);
                    $sender = get_user($sender_guid);
                    $notification_subject = elgg_echo('messages:email:subject');
                    $notification_message = strip_tags($message);
                    if ($uploaded_attachments) {
                        $notification_message .= elgg_view_module('inbox-attachments', elgg_echo('messages:attachments'), $attachment_urls);
                    }
                    $notification_body = elgg_echo('messages:email:body', array($sender->name, $notification_message, elgg_get_site_url() . "messages/inbox/{$recipient->username}?message_type={$message_type}", $sender->name, elgg_get_site_url() . "messages/thread/{$message_hash}"));
                    notify_user($recipient_guid, $sender_guid, $notification_subject, $notification_body, null, $methods);
                }
            }
        } else {
            $error++;
        }
    }
    if ($success > 0) {
        // Make attachments
        if ($uploaded_attachments) {
            foreach ($uploaded_attachments as $attachment_guid) {
                make_attachment($message_sent->guid, $attachment_guid);
            }
        }
        $return = true;
    } else {
        $message_sent->delete();
        $return = false;
    }
    elgg_set_ignore_access($ia);
    return $return;
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:101,代码来源:base.php


示例20: content_subscriptions_get_notification_settings

/**
 * Get the subscription methods of the user
 *
 * @param int $user_guid the user_guid to check (default: current user)
 *
 * @return array
 */
function content_subscriptions_get_notification_settings($user_guid = 0)
{
    static $user_cache;
    $user_guid = sanitise_int($user_guid, false);
    if (empty($user_guid)) {
        $user_guid = elgg_get_logged_in_user_guid();
    }
    if (empty($user_guid)) {
        return [];
    }
    if (!isset($user_cache)) {
        $user_cache = [];
    }
    if (!isset($user_cache[$user_guid])) {
        $user_cache[$user_guid] = [];
        $checked = false;
        if (elgg_is_active_plugin('notifications')) {
            $saved = elgg_get_plugin_user_setting('notification_settings_saved', $user_guid, 'content_subscriptions');
            if (!empty($saved)) {
                $checked = true;
                $settings = elgg_get_plugin_user_setting('notification_settings', $user_guid, 'content_subscriptions');
                if (!empty($settings)) {
                    $user_cache[$user_guid] = string_to_tag_array($settings);
                }
            }
        }
        if (!$checked) {
            // default elgg settings
            $settings = get_user_notification_settings($user_guid);
            if (!empty($settings)) {
                $settings = (array) $settings;
                foreach ($settings as $method => $value) {
                    if (!empty($value)) {
                        $user_cache[$user_guid][] = $method;
                    }
                }
            }
        }
    }
    return $user_cache[$user_guid];
}
开发者ID:coldtrick,项目名称:content_subscriptions,代码行数:48,代码来源:functions.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP get_user_option函数代码示例发布时间:2022-05-15
下一篇:
PHP get_user_name函数代码示例发布时间: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