示例#1
0
function Awards_after_Users_insertUser($params)
{
    // Create a stream for the user's credits
    $user = $params['user'];
    $stream = Awards_Credits::createStream($user);
    $stream->join(array('userId' => $user->id));
}
示例#2
0
function Awards_after_Q_responseExtras()
{
    Q_Response::addScript('plugins/Awards/js/Awards.js');
    try {
        $amount = Awards_Credits::amount();
    } catch (Exception $e) {
        $amount = null;
    }
    Q_Response::setScriptData('Q.plugins.Awards.credits', compact('amount'));
    $user = Users::loggedInUser();
    if ($user) {
        Q_Response::setScriptData("Q.Users.loggedInUser.displayName", Streams::displayName($user));
    }
}