Users can ignore each others' post now
This commit is contained in:
49
Sources/Ignore.php
Normal file
49
Sources/Ignore.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/******************************************************************************
|
||||
* Ignore.php *
|
||||
******************************************************************************/
|
||||
if (!defined('SMF'))
|
||||
die('Hacking attempt...');
|
||||
|
||||
|
||||
function ignore()
|
||||
{
|
||||
global $topic, $txt, $db_prefix, $context, $scripturl, $sourcedir, $ID_MEMBER, $mongodb;
|
||||
|
||||
// We need at least a topic... go away if you don't have one.
|
||||
if (empty($topic))
|
||||
fatal_lang_error(472, false);
|
||||
|
||||
foreach (array('member', 'msg') as $var) isset($_GET[$var]) ? $_GET[$var] = (int) $_GET[$var] : $_GET[$var] = 0;
|
||||
|
||||
$ignoree_id = $_GET['member'];
|
||||
$msg = $_GET['msg'];
|
||||
if ($ID_MEMBER > 0 && $ignoree_id > 0)
|
||||
$mongodb->rock->ignorelists->update(
|
||||
array ('user' => (int) $ID_MEMBER),
|
||||
array ('$addToSet' => array ('ignores' => $ignoree_id)),
|
||||
array ('upsert' => true));
|
||||
// Back to the topic!
|
||||
redirectexit('topic=' . $topic . '.msg'.$msg."#msg".$msg);
|
||||
}
|
||||
|
||||
function unignore()
|
||||
{
|
||||
global $topic, $txt, $db_prefix, $context, $scripturl, $sourcedir, $ID_MEMBER, $mongodb;
|
||||
|
||||
// We need at least a topic... go away if you don't have one.
|
||||
if (empty($topic))
|
||||
fatal_lang_error(472, false);
|
||||
|
||||
foreach (array('member', 'msg') as $var) isset($_GET[$var]) ? $_GET[$var] = (int) $_GET[$var] : $_GET[$var] = 0;
|
||||
|
||||
$ignoree_id = $_GET['member'];
|
||||
$msg = $_GET['msg'];
|
||||
if ($ID_MEMBER > 0 && $ignoree_id > 0)
|
||||
$mongodb->rock->ignorelists->update(
|
||||
array ('user' => (int) $ID_MEMBER),
|
||||
array ('$pull' => array ('ignores' => $ignoree_id)));
|
||||
|
||||
// Back to the topic!
|
||||
redirectexit('topic=' . $topic . '.msg'.$msg."#msg".$msg);
|
||||
}
|
||||
Reference in New Issue
Block a user