|
Page 1 of 2
|
Limun
Joined: January 2008
Posts: 1334
Location: [Censor]
|
Trash Button In Replies
hello..
Now to add trash button in post replyes ?
see pic
Thanks
____________ We are the phpBBorg. Lower your Crackers. Your phpological and forumological distinctivness will be added to our own. Resistance if futile!
|
#1 Wed 13 Feb, 2008 09:56 |
|
Sponsors
|
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.
|
|
KasLimon
Joined: November 2006
Posts: 494
Location: Madrid (Spain)
|
Re: Trash Button In Replyes
Hi,
What do you want this button to do, send the post to trash or send the topic to trash?
Greets
Note: install instructions here
____________ Gabriel Anca
Last edited by KasLimon on Thu 14 Feb, 2008 19:33; edited 1 time in total |
#2 Wed 13 Feb, 2008 20:36 |
|
Limun
Joined: January 2008
Posts: 1334
Location: [Censor]
|
Re: Trash Button In Replyes
Hi,
What do you want this button to do, send the post to trash or send the topic to trash?
Greets
send the post...or post reply to trash
____________ We are the phpBBorg. Lower your Crackers. Your phpological and forumological distinctivness will be added to our own. Resistance if futile!
|
#3 Wed 13 Feb, 2008 21:15 |
|
KasLimon
Joined: November 2006
Posts: 494
Location: Madrid (Spain)
|
Re: Trash Button In Replyes
I'm doing something that would do that in a while.
Wait Greets
____________ Gabriel Anca
|
#4 Wed 13 Feb, 2008 22:38 |
|
KasLimon
Joined: November 2006
Posts: 494
Location: Madrid (Spain)
|
Re: Trash Button In Replyes
Ok, here it is.
It's a bit long but it works.
You can't send to trash first post in a topic.
It allows you to send any post to trash if you are moderator.
Before sending to trash, you'll have to confirm.
Copy modcp_trash.tpl to templates/mg_themes/modcp_trash.tpl (look below)
Open file modcp.php
Find: if ( !$is_auth['auth_mod'] )
Replace with: //if ( !$is_auth['auth_mod'] ) //Modified to add Send post to trash function
if ( !$is_auth['auth_mod'] && $userdata['user_level'] != ADMIN)
Find:
Before, add: // Begin - Send post to trash
// Code based on "case split"
case 'trash':
$page_title = $lang['Mod_CP'] .' ('. $lang['Trash_Post'] .')';
include($phpbb_root_path . 'includes/page_header.' . $phpEx);
$trash_id = ( (!empty($_GET['trash_id'])) ? $_GET['trash_id'] : $_POST['trash_id'] );
if (empty($trash_id))
{
message_die(GENERAL_ERROR, 'Post id not specified');
}
if( $_POST['trash_yes'] != '' )
{
$sql = "SELECT post_id FROM " . POSTS_TABLE . " WHERE post_id = $trash_id LIMIT 1";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not get post id information', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$trash_id_sql = intval($row['post_id']);
if ($trash_id_sql == '')
{
message_die(GENERAL_MESSAGE, $lang['None_selected']);
}
$db->sql_freeresult($result);
$sql = "SELECT p.post_id, p.poster_id, p.topic_id, p.post_time, pt.post_subject FROM (" . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " pt)
WHERE p.post_id = $trash_id ORDER BY p.post_time ASC";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not get post information', '', __LINE__, __FILE__, $sql);
}
if( $row = $db->sql_fetchrow($result) )
{
$first_poster = $row['poster_id'];
$post_id = $row['post_id'];
$post_time = $row['post_time'];
$post_subject = $row['post_subject'];
$user_id_sql = intval($row['poster_id']);
$post_id_sql = intval($row['post_id']);
if( empty($post_subject) )
{
message_die(GENERAL_MESSAGE, $lang['Empty_subject']);
}
$new_forum_id = $board_config['bin_forum'];
if ($new_forum_id <= 0 ) message_die(GENERAL_MESSAGE, $lang['Forum_not_exist']);
$topic_time = time();
$sql = "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type)
VALUES ('" . str_replace("'", "''", $post_subject) . "', $first_poster, " . $topic_time . ", $new_forum_id, " . TOPIC_UNLOCKED . ", " . POST_NORMAL . ")";
if( !($db->sql_query($sql, BEGIN_TRANSACTION)) )
{
message_die(GENERAL_ERROR, 'could not insert new topic.', '', __LINE__, __FILE__, $sql);
}
$new_topic_id = $db->sql_nextid();
$sql = "UPDATE " . TOPICS_WATCH_TABLE . " SET topic_id = $new_topic_id
WHERE topic_id = $topic_id AND user_id IN ($user_id_sql)";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'could not update topics watch table.', '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE " . POSTS_TABLE . " SET topic_id = $new_topic_id, forum_id = $new_forum_id WHERE post_id = $post_id_sql";
if( !$db->sql_query($sql, END_TRANSACTION) )
{
message_die(GENERAL_ERROR, 'could not update posts table.', '', __LINE__, __FILE__, $sql);
}
//<!-- BEGIN Unread Post Information to Database Mod -->
$sql = "UPDATE " . UPI2DB_LAST_POSTS_TABLE . "
SET topic_id = $new_topic_id, forum_id = $new_forum_id
WHERE post_id = $post_id_sql";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update old topic', '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE " . UPI2DB_UNREAD_POSTS_TABLE . "
SET topic_id = $new_topic_id, forum_id = $new_forum_id
WHERE post_id = $post_id_sql";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update old topic', '', __LINE__, __FILE__, $sql);
}
//<!-- END Unread Post Information to Database Mod -->
$db->clear_cache('posts_');
$db->clear_cache('forums_');
sync('topic', $new_topic_id);
sync('topic', $topic_id);
sync('forum', $new_forum_id);
sync('forum', $forum_id);
$template->assign_vars(array('META' => '<meta http-equiv="refresh" content="3;url='. VIEWTOPIC_MG . '?' . POST_TOPIC_URL . '=' . $topic_id . '&sid=' . $userdata['session_id'] .'">'));
$message = $lang['Trash_Post_OK'] . '<br /><br />' . sprintf($lang['Mod_CP_click_return_topic'], '<a href="' . VIEWTOPIC_MG . '?' . POST_TOPIC_URL . '=' . $topic_id . '&sid=' . $userdata['session_id'] . '">', '</a>', '<a href="' . VIEWTOPIC_MG . '?' . POST_TOPIC_URL . '=' . $new_topic_id . '&sid=' . $userdata['session_id'] . '">', '</a>').'<br /><br />'. sprintf($lang['Click_return_modcp'], '<a href="modcp.' . $phpEx . '?' . POST_FORUM_URL . '=' . $forum_id . '&sid=' . $userdata['session_id'] .'">', '</a>').'<br ><br >'. sprintf($lang['Click_return_forum'], '<a href="'. VIEWFORUM_MG . '?' . POST_FORUM_URL . '=' . $forum_id . '&sid=' . $userdata['session_id'] .'">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
}
else
{
$template->set_filenames(array('trash_body' => 'modcp_trash.tpl'));
$sql = "SELECT u.username, p.*, pt.post_text, pt.bbcode_uid, pt.post_subject, p.post_username
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt
WHERE p.post_id = $trash_id AND pt.post_id = p.post_id AND p.poster_id = u.user_id LIMIT 1";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'could not get topic/post information.', '', __LINE__, __FILE__, $sql);
}
$s_hidden_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" /><input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" /><input type="hidden" name="' . POST_TOPIC_URL . '" value="' . $topic_id . '" /><input type="hidden" name="mode" value="trash" /><input type="hidden" name="trash_id" value="'.$trash_id.'" />';
if( ( $total_posts = $db->sql_numrows($result) ) > '0' )
{
$postrow = $db->sql_fetchrow($result);
$template->assign_vars(array(
'L_TRASH_POST' => $lang['Trash_Post'],
'L_AUTHOR' => $lang['Author'],
'L_MESSAGE' => $lang['Message'],
'L_SUBJECT' => $lang['Trash_Post_Subject'],
'L_POSTED' => $lang['Posted'],
'L_SUBMIT' => $lang['Submit'],
'L_POST_SUBJECT' => $lang['Post_subject'],
'L_POST' => $lang['Post'],
'L_POST_TO_TRASH' => $lang['Post_To_Trash'],
'L_POST_TO_TRASH_NO' => $lang['Post_To_Trash_No'],
'FORUM_NAME' => $forum_name,
'MINIPOST_IMG' => $images['icon_minipost'],
'U_VIEW_FORUM' => append_sid(VIEWFORUM_MG . '?' . POST_FORUM_URL . '=' . $forum_id),
'S_TRASH_ACTION' => append_sid('modcp.' . $phpEx),
'S_HIDDEN_FIELDS' => $s_hidden_fields,
)
);
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
$bbcode_uid = $postrow['bbcode_uid'];
$message = $postrow['post_text'];
$post_subject = ( $postrow['post_subject'] != '' ) ? $postrow['post_subject'] : $topic_title;
$post_date = create_date2($board_config['default_dateformat'], $postrow['post_time'], $board_config['board_timezone']);
if(!empty($postrow['post_text_compiled']))
{
$message = $postrow['post_text_compiled'];
}
else
{
$bbcode->allow_html = ( $board_config['allow_html'] && $postrow['enable_bbcode'] ? true : false );
$bbcode->allow_bbcode = ( $board_config['allow_bbcode'] && $postrow['enable_bbcode'] ? true : false );
$bbcode->allow_smilies = ( $board_config['allow_smilies'] && $postrow['enable_smilies'] ? true : false );
$message = $bbcode->parse($message, $bbcode_uid);
}
$template->assign_vars(array(
'ROW_CLASS' => ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'],
'POSTER_NAME' => $postrow['username'],
'POST_DATE' => $post_date,
'POST_SUBJECT' => $post_subject,
'MESSAGE' => $message,
'POST_ID' => $postrow['post_id'],
)
);
$template->pparse('trash_body');
}
else
{
message_die(GENERAL_ERROR, 'Invalid post id');
}
}
break;
// End - Send post to trash
Open viewtopic.php
Find:
Before, add: // Begin - Send post to trash
if ( ($i + 1 + $start) != 1 && $board_config['bin_forum'] != false )
{
$temp_url = 'modcp.' . $phpEx . '?' . POST_TOPIC_URL . '=' . $topic_id . '&mode=trash&trash_id=' . $postrow[$i]['post_id'] . '&' . POST_FORUM_URL . '=' . $forum_id . '&sid=' . $userdata['session_id'];
$trash_img = '<a href="' . $temp_url . '"><img src="' . $images['topic_mod_bin'] . '" alt="' . $lang['Trash_Post'] . '" title="' . $lang['Trash_Post'] . '" /></a>';
}
// End - Send post to trash
Find:
After, add:
// Begin - Send post to trash
'TRASH_IMG' => $trash_img,
// End - Send post to trash
Open language/lang_english/lang_main.php
Find:
After, add:
// Begin - Send post to trash
$lang['Trash_Post'] = 'Send this post to trash';
$lang['Trash_Post_Subject'] = 'Subject of new topic';
$lang['Post_To_Trash'] = 'Send post to trash';
$lang['Post_To_Trash_No'] = 'Return to topic';
$lang['Trash_Post_OK'] = 'The selected post has been sent to trash successfully';
// End - Send post to trash
Repeat last action in all languages you've installed
Open temlplates/mg_themes/viewtopic_body.tpl
Find:
After, add: Repeat last action in all styles you've installed
I hope you like it. Greets!
Description: |
|
Download |
Filename: |
modcp_trash.zip |
Filesize: |
955 Bytes |
Downloaded: |
178 Time(s) |
____________ Gabriel Anca
Edited by KasLimon, Thu 14 Feb, 2008 19:35: Fixed 2 errors |
#5 Wed 13 Feb, 2008 23:19 |
|
Limun
Joined: January 2008
Posts: 1334
Location: [Censor]
|
Re: Trash Button In Replyes
i will try right now...
thank you man very much
i will answer if made it
____________ We are the phpBBorg. Lower your Crackers. Your phpological and forumological distinctivness will be added to our own. Resistance if futile!
|
#6 Wed 13 Feb, 2008 23:26 |
|
Limun
Joined: January 2008
Posts: 1334
Location: [Censor]
|
Re: Trash Button In Replyes
this gona be great ...
there is still one little problem
button is there
but i recive this message : You are not a moderator of this forum.
see pic
and i m loged as administrator
i forghet to say... edit and delete work normal
____________ We are the phpBBorg. Lower your Crackers. Your phpological and forumological distinctivness will be added to our own. Resistance if futile!
Last edited by Limun on Thu 14 Feb, 2008 00:02; edited 1 time in total |
#7 Thu 14 Feb, 2008 00:00 |
|
KasLimon
Joined: November 2006
Posts: 494
Location: Madrid (Spain)
|
Re: Trash Button In Replyes
I see... It seems to be a problem with auth. Fist of all try to clean cache.
If it doesn't work I think this would fix it:
Open modcp.php
Find: if ( !$is_auth['auth_mod'] )
Replace with: //if ( !$is_auth['auth_mod'] ) //Modified to add Send post to trash function
if ( !$is_auth['auth_mod'] && $userdata['user_level'] != ADMIN)
Greets!
____________ Gabriel Anca
|
#8 Thu 14 Feb, 2008 08:56 |
|
KugeLSichA
Joined: August 2006
Posts: 803
Location: Dresden
|
Re: Trash Button In Replyes
great work, KasLimon !!!
thanks
moved to customizations
|
#9 Thu 14 Feb, 2008 09:35 |
|
Limun
Joined: January 2008
Posts: 1334
Location: [Censor]
|
Re: Trash Button In Replyes
now i m reciving this error...
but post go in trash see pic
thank you
____________ We are the phpBBorg. Lower your Crackers. Your phpological and forumological distinctivness will be added to our own. Resistance if futile!
|
#10 Thu 14 Feb, 2008 10:05 |
|
Mighty Gorgon
Luca Libralato
Joined: August 2006
Posts: 7191
Location: Borgo San Michele
|
Re: Trash Button In Replyes
Even if not fully working I appreciate your efforts.
Keep up trying to fix problems.
____________ Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
|
#11 Thu 14 Feb, 2008 13:28 |
|
KasLimon
Joined: November 2006
Posts: 494
Location: Madrid (Spain)
|
Re: Trash Button In Replyes
Yes, it's working, but in my PC
Thanks for moving!
Well, it seems now to be a problem with sync
Try this:
Open viewtopic.php
Find: $temp_url = 'modcp.' . $phpEx . '?t=1&mode=trash&trash_id=' . $postrow[$i]['post_id'] . '&sid=' . $userdata['session_id'];
Replace with: $temp_url = 'modcp.' . $phpEx . '?' . POST_TOPIC_URL . '=' . $topic_id . '&mode=trash&trash_id=' . $postrow[$i]['post_id'] . '&' . POST_FORUM_URL . '=' . $forum_id . '&sid=' . $userdata['session_id'];
I hope it works, I think it'll do...
If it doesn't, I think there's another possible solution...
Greets!
____________ Gabriel Anca
|
#12 Thu 14 Feb, 2008 17:20 |
|
Limun
Joined: January 2008
Posts: 1334
Location: [Censor]
|
Re: Trash Button In Replyes
thank you so much....
now its working....
only little question...
all posts moved to trash have same name...its not so important ...i m asking if is normal ???
that gg is trashed before this mod all this same names are trashed with your new mod from different topics
Thank you again
____________ We are the phpBBorg. Lower your Crackers. Your phpological and forumological distinctivness will be added to our own. Resistance if futile!
|
#13 Thu 14 Feb, 2008 17:32 |
|
KasLimon
Joined: November 2006
Posts: 494
Location: Madrid (Spain)
|
Re: Trash Button In Replyes
If they all have the same name doesn't mutter at all
Also, you can change the topic name when "trashing" (after you click trash button)
Greets!
____________ Gabriel Anca
|
#14 Thu 14 Feb, 2008 19:31 |
|
Limun
Joined: January 2008
Posts: 1334
Location: [Censor]
|
Re: Trash Button In Replyes
Thanks a lot if u ever come in croacia i m takeing u to dinner
____________ We are the phpBBorg. Lower your Crackers. Your phpological and forumological distinctivness will be added to our own. Resistance if futile!
|
#15 Thu 14 Feb, 2008 20:36 |
|
|
Page 1 of 2
|
Was this topic useful?
Was this topic useful?
Link this topic |
URL |
|
BBCode |
|
HTML |
|
You cannot post new topics You cannot reply to topics You cannot edit your posts You cannot delete your posts You cannot vote in polls You cannot attach files You can download files You cannot post calendar events
|
|
|
|