Example #1
0
/**
 * Subscribe a user to notifications about a target entity
 *
 * @param int    $user_guid   The GUID of the user to subscribe to notifications
 * @param string $method      The delivery method of the notifications
 * @param int    $target_guid The entity to receive notifications about
 * @return bool
 * @since 1.9
 */
function elgg_add_subscription($user_guid, $method, $target_guid)
{
    $methods = _elgg_services()->notifications->getMethods();
    $db = _elgg_services()->db;
    $subs = new Elgg_Notifications_SubscriptionsService($db, $methods);
    return $subs->addSubscription($user_guid, $method, $target_guid);
}