First, love the mod. Great job. Installed it with EM after a few tweaks due to some other mods I have installed. I'm almost ready to go live with the new clean code, however noticed a slight problem that 2 others have had in these 24 pages, but I can't seem to find a fix.
Installed
- phpBB2.0.19
- Save as Drafts Mod among others, but I think this is part of the problem.
Symptom
1. New post, enter description, submit, all works great. Now edit that same post, description is now missing. Cannot change it at all. Like it's not even there.
2. New post, enter description, save as draft. Go back to retrieve draft, description is not there just like above, can't change or even see it. Now gone from viewforum. (I'm sure this is a conflict with the two mods, however wanted to check)
I'm thinking its a posting.php problem, so here is what I have. Anyone notice a potential conflict here. I don't know php, but suspect the adding description is not reflected in some of the changes within the drafts mode.
Any help would be appreciated.
I don't want to post the entire posting.php file, however here are some snippets where Save as Draft and Topic Descriptions seem to be together.
Code: Select all
// mod topic description: add
$select_sql = (!$submit) ? ', t.topic_title,t.topic_description, t.topic_descmod, t.topic_icon, p.enable_bbcode, p.enable_html, p.enable_smilies, p.enable_sig, p.post_draft, p.post_username, pt.post_subject, p.post_icon, pt.post_text, pt.bbcode_uid, u.username, u.user_id, u.user_sig, u.user_sig_bbcode_uid' : '';
// start mod save posts as drafts (and end mod too) ... in the preceding line (definition of $select_sql), add reference to post_draft column in table
Code: Select all
// mod topic description add
$candesc = check_descperm ( );
if ( $candesc == AUTH_NODESC )
{
$candesc = FALSE;
$canmoddesc = FALSE;
}
elseif ( $candesc == AUTH_DESC )
{
$candesc = TRUE;
$candescmod = FALSE;
}
elseif ( $candesc == AUTH_MODDESC )
{
$candesc = TRUE;
$canmoddesc = TRUE;
}
// mod topic description end
if ( $mode == 'editpost' || $mode == 'delete' || $mode == 'poll_delete' )
{
$topic_id = $post_info['topic_id'];
$post_data['poster_post'] = ( $post_info['poster_id'] == $userdata['user_id'] ) ? true : false;
// start mod save posts as drafts...changed the next two lines to cover the case where the post had been a draft of a new topic (and therefor never had a first_post_id or last_post_id inserted into the topics table)
$post_data['first_post'] = ( $post_info['topic_first_post_id'] == $post_id || ($was_a_draft && $post_info['topic_first_post_id'] == $post_info['topic_last_post_id'] && $post_info['topic_first_post_id'] == 0) ) ? true : false;
$post_data['last_post'] = ( $post_info['topic_last_post_id'] == $post_id || ($was_a_draft && $post_info['topic_first_post_id'] == $post_info['topic_last_post_id'] && $post_info['topic_last_post_id'] == 0) ) ? true : false;
//end mod save posts as drafts
Code: Select all
// mod topic description add
$post_desc4mod = $post_info['topic_descmod'];
if ( $post_data['first_post'] && $post_data['has_poll'] )
{
$sql = "SELECT *
FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr
WHERE vd.topic_id = $topic_id
AND vr.vote_id = vd.vote_id
ORDER BY vr.vote_option_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain vote data for this topic', '', __LINE__, __FILE__, $sql);
}
$poll_options = array();
$poll_results_sum = 0;
if ( $row = $db->sql_fetchrow($result) )
{
$poll_title = $row['vote_text'];
$poll_id = $row['vote_id'];
$poll_length = $row['vote_length'] / 86400;
do
{
$poll_options[$row['vote_option_id']] = $row['vote_option_text'];
$poll_results_sum += $row['vote_result'];
}
while ( $row = $db->sql_fetchrow($result) );
}
$db->sql_freeresult($result);
$post_data['edit_poll'] = ( ( !$poll_results_sum || $is_auth['auth_mod'] ) && $post_data['first_post'] ) ? true : 0;
}
else
{
$post_data['edit_poll'] = ($post_data['first_post'] && $is_auth['auth_pollcreate']) ? true : false;
}
Code: Select all
//
// Can this user edit/delete the post/poll?
//
if ( $post_info['poster_id'] != $userdata['user_id'] && !$is_auth['auth_mod'] )
{
$message = ( $delete || $mode == 'delete' ) ? $lang['Delete_own_posts'] : $lang['Edit_own_posts'];
$message .= '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
else if ( !$post_data['last_post'] && !$is_auth['auth_mod'] && ( $mode == 'delete' || $delete ) && !$was_a_draft )
{
message_die(GENERAL_MESSAGE, $lang['Cannot_delete_replied']);
}
else if ( !$post_data['edit_poll'] && !$is_auth['auth_mod'] && ( $mode == 'poll_delete' || $poll_delete ) && !$was_a_draft )
// start mod save posts as drafts (and end mod too)... added !$was_a_draft at end of the preceding two else if clauses to assure that a user who is not a moderator can always delete his own drafts even if the topic has subsequently been replied to
Code: Select all
// mod topic description add
$post_desc4mod = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['desc4mod']) && $canmoddesc ) ? TRUE : FALSE ) : FALSE;
if ( !$board_config['allow_html'] )
{
$html_on = 0;
}
else
{
$html_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_html']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_html'] : $userdata['user_allowhtml'] );
}
if ( !$board_config['allow_bbcode'] )
{
$bbcode_on = 0;
}
else
{
$bbcode_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_bbcode']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_bbcode'] : $userdata['user_allowbbcode'] );
}
if ( !$board_config['allow_smilies'] )
{
$smilies_on = 0;
}
else
{
$smilies_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_smilies']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_smilies'] : $userdata['user_allowsmile'] );
}
if ( ($submit || $refresh) && $is_auth['auth_read'])
{
$notify_user = ( !empty($HTTP_POST_VARS['notify']) ) ? TRUE : 0;
}
else
{
if ( $mode != 'newtopic' && $userdata['session_logged_in'] && $is_auth['auth_read'] )
{
$sql = "SELECT topic_id
FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain topic watch information', '', __LINE__, __FILE__, $sql);
}
$notify_user = ( $db->sql_fetchrow($result) ) ? TRUE : $userdata['user_notify'];
$db->sql_freeresult($result);
}
else
{
$notify_user = ( $userdata['session_logged_in'] && $is_auth['auth_read'] ) ? $userdata['user_notify'] : 0;
}
}
$attach_sig = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['attach_sig']) ) ? TRUE : 0 ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? 0 : $userdata['user_attachsig'] );
// --------------------
// What shall we do?
//
if ( ( $delete || $poll_delete || $mode == 'delete' ) && !$confirm )
{
//
// Confirm deletion
//
// start mod save posts as drafts...orignal definition was just the first part; changes so that if this was a draft, that fact gets passed on to the confirmation template so that it can return to post.php afterwards with that fact known
$s_hidden_fields = ( !$was_a_draft ) ? '<input type="hidden" name="' . POST_POST_URL . '" value="' . $post_id . '" />' : '<input type="hidden" name="' . POST_POST_URL . '" value="' . $post_id . '" /><input type="hidden" name="was_a_draft" value="was_a_draft" />';
// end mod save posts as drafts
$s_hidden_fields .= ( $delete || $mode == "delete" ) ? '<input type="hidden" name="mode" value="delete" />' : '<input type="hidden" name="mode" value="poll_delete" />';
$l_confirm = ( $delete || $mode == 'delete' ) ? $lang['Confirm_delete'] : $lang['Confirm_delete_poll'];