Code: Select all
...if you only want ADMINS, MODS or the author of a given post to be
allowed to clone that post, you could change the first line to:
if ( $userdata['user_level'] == ADMIN || $userdata['user_level'] == MOD || $postrow[$i]['user_id'] == $userdata['user_id'] )
Zenandrar wrote: ...And if I want only admin and mods to be allowed to clone?
Code: Select all
if ( $userdata['user_level'] == ADMIN || $userdata['user_level'] == MOD )
yes, just a few small changes (or more extensive changes that I have no desire to code if you want to give the user the option to post in his name or the original poster's name), but why do you want users to be able to pose as other users? Doesn't make sense to me.otseng wrote: Is there a way to keep the original author of the post?
asinshesq wrote: Are you sure you're not really just talking about moving a post but leaving a shadow behind (which phpbb already allows the admin to do)?
Code: Select all
OPEN
clone.php
FIND (actual line is longer)
$sql = "SELECT f.forum_name, f.forum_status,
IN-LINE FIND
p.post_username,
IN-LINE REPLACE WITH
p.poster_id,
FIND
$hidden_form_fields .= '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />';
AFTER, ADD
$old_user_id = $post_info['poster_id'];
$hidden_form_fields .= '<input type="hidden" name="clone" value="' . $old_user_id . '" />';
OPEN
posting.php
FIND (actual line is longer)
$params = array('submit' => 'post', 'preview' => 'preview',
IN-LINE FIND
'preview' => 'preview',
IN-LINE AFTER, ADD
'clone' => 'clone',
FIND (actual line is longer)
prepare_post($mode, $post_data,
BEFORE, ADD
if ( $clone )
{
$post_data['poster_id'] = $clone;
$sql = "SELECT username FROM " . USERS_TABLE . "
WHERE user_id = $clone";
if ( $result = $db->sql_query($sql) )
{
$row = $db->sql_fetchrow($result);
$username = $row['username'];
$userdata['user_id'] = $clone;
$userdata['username'] = $username;
$db->sql_freeresult($result);
}
else message_die(GENERAL_MESSAGE, $lang['No_such_user']);
}
FIND
$user_id = ( $mode == 'reply' || $mode == 'newtopic' ) ? $userdata['user_id'] : $post_data['poster_id'];
AFTER, ADD
$user_id = ( !$clone ) ? $user_id : $clone;
FIND
$page_title = $lang['Post_a_new_topic'];
$hidden_form_fields .= '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />';
AFTER, ADD
if ( $clone )
{
$hidden_form_fields .= '<input type="hidden" name="clone" value="' . $clone . '" />';
}