PDA

View Full Version : how id do it? thx!


Dj Sagi
06-19-2009, 10:26 AM
hellow all
i want to do in the admin threads options
on the bottom in FORUMDISPLAY in the options
more option
that move the threads that i mark in V
to the forum with id 168
without choose any forum
i want that it move without choose the forum with the id...
i try add action but i dont success...
please help.
thx =]

Lynne
06-19-2009, 03:02 PM
Post the code you tried to add and maybe we can spot what you did wrong. Please use the code tags and if it is a plugin, tell us what hook you used.

Dj Sagi
06-19-2009, 09:29 PM
in inlinemod.php file
i add to (2 times)
switch ($_POST['do'])
{
case 'dodeletethreads':
case 'domovethreads':
this:
case 'domovethreadsbin':

my bin forum id is 168

so i add this:
if ($_POST['do'] == 'domovethreadsbin')
{
$vbulletin->input->clean_array_gpc('p', array(
'destforumid' => TYPE_UINT,
'redirect' => TYPE_STR,
'frame' => TYPE_STR,
'period' => TYPE_UINT,
));

// check whether dest can contain posts
$destforumid = verify_id('forum', '168');
$destforuminfo = fetch_foruminfo($destforumid);
if (!$destforuminfo['cancontainthreads'] OR $destforuminfo['link'])
{
eval(standard_error(fetch_error('moveillegalforum' )));
}

// check destination forum permissions
$forumperms = fetch_permissions($destforuminfo['forumid']);
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']))
{
print_no_permission();
}

if ($vbulletin->GPC['redirect'] == 'none')
{
$method = 'move';
}
else
{
$method = 'movered';
}

$countingthreads = array();
$redirectids = array();

// Validate threads
$threads = $db->query_read_slave("
SELECT threadid, visible, open, pollid, title, prefixid, postuserid, forumid
" . ($method == 'movered' ? ", lastpost, replycount, postusername, lastposter, dateline, views, iconid" : "") . "
FROM " . TABLE_PREFIX . "thread
WHERE threadid IN(" . implode(',', $threadids) . ")
");
while ($thread = $db->fetch_array($threads))
{
$forumperms = fetch_permissions($thread['forumid']);
if (
!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview'])
OR
!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads'])
OR
(!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) AND $thread['postuserid'] != $vbulletin->userinfo['userid'])
)
{
print_no_permission();
}

$thread['prefix_plain_html'] = ($thread['prefixid'] ? htmlspecialchars_uni($vbphrase["prefix_$thread[prefixid]_title_plain"]) . ' ' : '');

if (!can_moderate($thread['forumid'], 'canmanagethreads'))
{
eval(standard_error(fetch_error('you_do_not_have_p ermission_to_manage_threads_and_posts', $vbphrase['n_a'], $thread['prefix_plain_html'] . $thread['title'], $vbulletin->forumcache["$thread[forumid]"]['title'])));
}
else if (!$thread['visible'] AND !can_moderate($thread['forumid'], 'canmoderateposts'))
{
eval(standard_error(fetch_error('you_do_not_have_p ermission_to_manage_moderated_threads_and_posts')) );
}
else if ($thread['visible'] == 2 AND !can_moderate($thread['forumid'], 'candeleteposts'))
{
eval(standard_error(fetch_error('you_do_not_have_p ermission_to_manage_deleted_threads_and_posts', $vbphrase['n_a'], $thread['prefix_plain_html'] . $thread['title'], $vbulletin->forumcache["$thread[forumid]"]['title'])));
}

if ($thread['visible'] == 2 AND !can_moderate($destforuminfo['forumid'], 'candeleteposts'))
{
eval(standard_error(fetch_error('you_do_not_have_p ermission_to_manage_deleted_threads_and_posts_in_d estination_forum')));
}
else if (!$thread['visible'] AND !can_moderate($destforuminfo['forumid'], 'canmoderateposts'))
{
eval(standard_error(fetch_error('you_do_not_have_p ermission_to_manage_moderated_threads_and_posts_in _destination_forum')));
}

// Ignore all threads that are already in the destination forum
if ($thread['forumid'] == $destforuminfo['forumid'])
{
$sameforum = true;
continue;
}

$threadarray["$thread[threadid]"] = $thread;
$forumlist["$thread[forumid]"] = true;

if ($thread['open'] == 10)
{
$redirectids["$thread[pollid]"][] = $thread['threadid'];
}
else if ($thread['visible'])
{
$countingthreads[] = $thread['threadid'];
}
}

if (empty($threadarray))
{
if ($sameforum)
{
eval(standard_error(fetch_error('thread_is_already _in_the_forum')));
}
else
{
eval(standard_error(fetch_error('you_did_not_selec t_any_valid_threads')));
}
}

// check to see if these threads are being returned to a forum they've already been in
// if redirects exist in the destination forum, remove them
$checkprevious = $db->query_read_slave("
SELECT threadid
FROM " . TABLE_PREFIX . "thread
WHERE forumid = $destforuminfo[forumid]
AND open = 10
AND pollid IN(" . implode(',', array_keys($threadarray)) . ")
");
while ($check = $db->fetch_array($checkprevious))
{
$old_redirect =& datamanager_init('Thread', $vbulletin, ERRTYPE_SILENT, 'threadpost');
$old_redirect->set_existing($check);
$old_redirect->delete(false, true, NULL, false);
unset($old_redirect);
}

// check to see if a redirect is being moved to a forum where its destination thread already exists
// if so delete the redirect
if (!empty($redirectids))
{
$checkprevious = $db->query_read_slave("
SELECT threadid
FROM " . TABLE_PREFIX . "thread
WHERE forumid = $destforuminfo[forumid]
AND threadid IN(" . implode(',', array_keys($redirectids)) . ")

");
while ($check = $db->fetch_array($checkprevious))
{
if (!empty($redirectids["$check[threadid]"]))
{
foreach($redirectids["$check[threadid]"] AS $threadid)
{
$old_redirect =& datamanager_init('Thread', $vbulletin, ERRTYPE_SILENT, 'threadpost');
$old_redirect->set_existing($threadarray["$threadid"]);
$old_redirect->delete(false, true, NULL, false);
unset($old_redirect);

# Remove redirect threadids from $threadarray so no log entry is entered below or new redirect is added
unset($threadarray["$threadid"]);
}
}
}
}

if (!empty($threadarray))
{
// Move threads
// If mod can not manage threads in destination forum then unstick all moved threads
$db->query_write("
UPDATE " . TABLE_PREFIX . "thread
SET forumid = $destforuminfo[forumid]
" . (!can_moderate($destforuminfo['forumid'], 'canmanagethreads') ? ", sticky = 0" : "") . "
WHERE threadid IN(" . implode(',', array_keys($threadarray)) . ")
");

require_once(DIR . '/includes/functions_prefix.php');
remove_invalid_prefixes(array_keys($threadarray), $destforuminfo['forumid']);

// update canview status of thread subscriptions
update_subscriptions(array('threadids' => array_keys($threadarray)));

// kill the post cache for these threads
delete_post_cache_threads(array_keys($threadarray) );

$movelog = array();
// Insert Redirects FUN FUN FUN
if ($method == 'movered')
{
$redirectsql = array();
if ($vbulletin->GPC['redirect'] == 'expires')
{
switch($vbulletin->GPC['frame'])
{
case 'h':
$expires = mktime(date('H') + $vbulletin->GPC['period'], date('i'), date('s'), date('m'), date('d'), date('y'));
break;
case 'd':
$expires = mktime(date('H'), date('i'), date('s'), date('m'), date('d') + $vbulletin->GPC['period'], date('y'));
break;
case 'w':
$expires = $vbulletin->GPC['period'] * 60 * 60 * 24 * 7 + TIMENOW;
break;
case 'y':
$expires = mktime(date('H'), date('i'), date('s'), date('m'), date('d'), date('y') + $vbulletin->GPC['period']);
break;
case 'm':
default:
$expires = mktime(date('H'), date('i'), date('s'), date('m') + $vbulletin->GPC['period'], date('d'), date('y'));
}
}
foreach($threadarray AS $threadid => $thread)
{
if ($thread['visible'] == 1)
{
$thread['open'] = 10;
$thread['pollid'] = $threadid;
unset($thread['threadid']);
$redir =& datamanager_init('Thread', $vbulletin, ERRTYPE_SILENT, 'threadpost');
foreach (array_keys($thread) AS $field)
{
// bypassing the verify_* calls; this data should be valid as is
if (isset($redir->validfields["$field"]))
{
$redir->setr($field, $thread["$field"], true, false);
}
}
$redirthreadid = $redir->save();
if ($vbulletin->GPC['redirect'] == 'expires')
{
$redirectsql[] = "$redirthreadid, $expires";
}
unset($redir);
}
else
{
// else this is a moderated or deleted thread so leave no redirect behind
// insert modlog entry of just "move", not "moved with redirect"
// unset threadarray[threadid] so thread_moved_with_redirect log entry is not entered below.

unset($threadarray["$threadid"]);
$movelog = array(
'userid' =>& $vbulletin->userinfo['userid'],
'forumid' =>& $thread['forumid'],
'threadid' => $threadid,
);
}
}

if (!empty($redirectsql))
{
$db->query_write("
INSERT INTO " . TABLE_PREFIX . "threadredirect
(threadid, expires)
VALUES
(" . implode("), (", $redirectsql) . ")
");
}
}

if (!empty($movelog))
{
log_moderator_action($movelog, 'thread_moved_to_x', $destforuminfo['title']);
}

if (!empty($threadarray))
{
foreach ($threadarray AS $threadid => $thread)
{
$modlog[] = array(
'userid' =>& $vbulletin->userinfo['userid'],
'forumid' =>& $thread['forumid'],
'threadid' => $threadid,
);
}

log_moderator_action($modlog, ($method == 'move') ? 'thread_moved_to_x' : 'thread_moved_with_redirect_to_a', $destforuminfo['title']);

if (!empty($countingthreads))
{
$posts = $db->query_read_slave("
SELECT userid, threadid
FROM " . TABLE_PREFIX . "post
WHERE threadid IN(" . implode(',', $countingthreads) . ")
AND visible = 1
AND userid > 0
");
$userbyuserid = array();
while ($post = $db->fetch_array($posts))
{
$foruminfo = fetch_foruminfo($threadarray["$post[threadid]"]['forumid']);
if ($foruminfo['countposts'] AND !$destforuminfo['countposts'])
{ // Take away a post
if (!isset($userbyuserid["$post[userid]"]))
{
$userbyuserid["$post[userid]"] = -1;
}
else
{
$userbyuserid["$post[userid]"]--;
}
}
else if (!$foruminfo['countposts'] AND $destforuminfo['countposts'])
{ // Add a post
if (!isset($userbyuserid["$post[userid]"]))
{
$userbyuserid["$post[userid]"] = 1;
}
else
{
$userbyuserid["$post[userid]"]++;
}
}
}

if (!empty($userbyuserid))
{
$userbypostcount = array();
$alluserids = '';

foreach ($userbyuserid AS $postuserid => $postcount)
{
$alluserids .= ",$postuserid";
$userbypostcount["$postcount"] .= ",$postuserid";
}
foreach ($userbypostcount AS $postcount => $userids)
{
$casesql .= " WHEN userid IN (0$userids) THEN $postcount";
}

$db->query_write("
UPDATE " . TABLE_PREFIX . "user
SET posts = CAST(posts AS SIGNED) +
CASE
$casesql
ELSE 0
END
WHERE userid IN (0$alluserids)
");
}
}
}
}

foreach(array_keys($forumlist) AS $forumid)
{
build_forum_counters($forumid);
}
build_forum_counters($destforuminfo['forumid']);

// empty cookie
setcookie('vbulletin_inlinethread', '', TIMENOW - 3600, '/');

($hook = vBulletinHook::fetch_hook('inlinemod_domovethread' )) ? eval($hook) : false;

eval(print_standard_redirect('redirect_inline_move d', true, $forceredirect));
}


i only take the domovethreads action and i copy
and i change the acion name to domovethreadsbin
after i change in the 10 first lines this line:
$destforumid = verify_id('forum', $vbulletin->GPC['destforumid']);

to this line:

$destforumid = verify_id('forum', '168');

and it is say that i dont choose any forum...

thx for help!

Lynne
06-19-2009, 10:38 PM
But, how to you get to domovethreadsbin? If you look at the Moderation dropdown, movethread is an action in there, not domovethread. domovethread is not a case available until you get to the second page after selecting all the threads. Did you add anything to the dropdown menu itself?

Dj Sagi
06-20-2009, 08:32 AM
i add one more option to dropdown with value "domovethreadsbin" and it dont work...
i must your help!
thx!

--------------- Added 1245575789 at 1245575789 ---------------

please someone!!
help me...
thx.

Dj Sagi
06-21-2009, 11:38 AM
someone plz =]

Dj Sagi
06-23-2009, 01:51 PM
UP plz i must your help!

Dj Sagi
06-25-2009, 08:58 PM
someone??
plz

--------------- Added 1246045941 at 1246045941 ---------------

nobody wanna help?
please.