Пример #1
0
        $user_id = null;
        $author_id = null;
        if ($_POST["t"] == 1) {
            $post = PostData::getReceptorId($_POST["r"]);
            $user_id = $post->receptor_ref_id;
            $author_id = $post->author_ref_id;
        } else {
            if ($_POST["t"] == 2) {
                $post = ImageData::getUserId($_POST["r"]);
                $user_id = $post->user_id;
                $author_id = $post->user_id;
            }
        }
        if ($author_id != $_SESSION["user_id"] && $user_id != $_SESSION["user_id"]) {
            // si es el mismo autor del post, entonces no le notificamos
            $notification = new NotificationData();
            $notification->not_type_id = 1;
            // like
            $notification->type_id = $_POST["t"];
            // al mismo que nos referenciamos en al crear el comentario
            $notification->ref_id = $_POST["r"];
            // =
            $notification->receptor_id = $user_id;
            // en este caso nos referimos a quien va dirigida la notificacion
            $notification->sender_id = $_SESSION["user_id"];
            // ahora al usuario implicado
            $notification->add();
        }
        ///////////
    }
}
Пример #2
0
<?php

$f = new FollowerData();
$f->channel_id = $_POST['channel_id'];
$f->add();
$u = UserData::getById(Session::getUID());
$channel = ChannelData::getById($_POST['channel_id']);
$author = $channel->getUser();
$not_type = NotificationTypeData::getByName("Nuevo Seguidor");
$n = new NotificationData();
$n->brief = "<b>{$u->name} {$u->lastname}</b> Te Sigue";
$n->content = "";
$n->channel_id = $_POST['channel_id'];
$n->image_id = "NULL";
$n->comment_id = "NULL";
$n->album_id = "NULL";
$n->notification_type_id = $not_type->id;
$n->user_id = Session::getUID();
$n->add();
//index.php?module=channelinfo&id=1
print "<script>window.location='index.php?view=channelinfo&id={$_POST['channel_id']}';</script>";