コード例 #1
0
/**
 * Return a list of DOM selectors whose contents FBSS should automatically
 * update via AJAX when a new status is submitted from a status update form on
 * the same page. Do not select a region which includes the status update form.
 *
 * @param $recipient
 *   An object representing the recipient of the status message.
 * @param $type
 *   The context stream type.
 * @return
 *   An array of DOM selector expressions.
 * @see theme_facebook_status_form_display()
 */
function hook_facebook_status_refresh_selectors($recipient, $type)
{
    //Automatically update all instances of the view that is displayed for this context.
    $context = facebook_status_determine_context($type);
    return array('.view-id-' . $context['view']);
}
コード例 #2
0
ファイル: api.php プロジェクト: native2517/Game-Reviews
/**
 * Alter user access.
 *
 * @param $allow
 *   Whether the action is permitted to be taken. Change this only if you can
 *   decide conclusively that the action is definitely (not) permitted.
 * @param $op
 *   The action being taken. One of add, converse, delete, edit, view,
 *   view_stream, generate.
 * @param $args
 *   An array of additional arguments. Varies depending on $op.
 * @see facebook_status_user_access()
 */
function hook_facebook_status_user_access_alter(&$allow, $op, $args)
{
    global $user;
    switch ($op) {
        case 'add':
            $recipient = isset($args[0]) ? $args[0] : $user;
            $type = isset($args[1]) ? $args[1] : 'user';
            $sender = isset($args[2]) ? $args[2] : $user;
            $context = facebook_status_determine_context($type);
            //Updating one's own status should ALWAYS be allowed.
            if ($type == 'user' && $context['handler']->recipient_id($recipient) == $sender->uid) {
                $allow = TRUE;
            }
            break;
    }
}