Save posts as drafts

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.

Rating:

Excellent!
47
72%
Very Good
10
15%
Good
5
8%
Fair
1
2%
Poor
2
3%
 
Total votes: 65

Maischter
Registered User
Posts: 8
Joined: Tue Feb 21, 2006 12:50 pm
Contact:

Re: Save posts as drafts

Post by Maischter » Sun Nov 02, 2008 2:56 pm

this confirmation fix doesnt work for me:

Code: Select all

OPEN
includes/functions_post.php

FIND
   $message = $lang['Stored'] . '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');

REPLACE WITH
   if (!$save_as_draft)
   {
      $message = $lang['Stored'] . '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');
   }
   else
   {
      $message = $lang['Draft_saved'] . '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');
   }

OPEN
langauge/lang_english_lang_main.php

FIND
$lang['Stored'] = 'Your message has been entered successfully.';

AFTER, ADD
$lang['Draft_saved'] = 'Your draft has been saved successfully.';
also this quickreply fis dosnt work:

Code: Select all

#
#-----[ OPEN ]------------------------------------------------
#
includes/viewtopic_quickreply.php

#
#-----[ FIND ]------------------------------------------------
#
         $template->assign_block_vars('switch_advanced_qr.switch_notify_checkbox', array());
      }

#
#-----[ AFTER, ADD ]------------------------------------------------
#
      $template->assign_block_vars('switch_save_as_draft_button', array());

#
#-----[ FIND ]------------------------------------------------
#
   'L_SUBMIT' => $lang['Submit'],

#
#-----[ AFTER, ADD ]-----------------------------------------
#
   'L_SAVE_AS_DRAFT' => $lang['Save_as_draft'],

#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/posting_body.tpl

#
#-----[ FIND ]------------------------------------------------
#
     <td class="catBottom" colspan="2" align="center" height="28"> {S_HIDDEN_FORM_FIELDS}<input type="submit" tabindex="5" name="preview" class="mainoption" value="{L_PREVIEW}" />&nbsp;<input type="submit" accesskey="s" tabindex="6" name="post" class="mainoption" value="{L_SUBMIT}" /></td>

#
#-----[ REPLACE WITH ]-----------------------------------------
#
   <!-- start mod save posts as drafts -->
   <!-- added begin and end switch_save_as_draft and stuff between it -->
     <td class="catBottom" colspan="3" align="center" height="28"> {S_HIDDEN_FORM_FIELDS}
     <!-- BEGIN switch_save_as_draft_button -->
     <input type="submit" tabindex="4" name="save_as_draft" class="mainoption" value="{L_SAVE_AS_DRAFT}" />&nbsp;
     <!-- END switch_save_as_draft_button -->
     <input type="submit" tabindex="5" name="preview" class="mainoption" value="{L_PREVIEW}" />&nbsp;<input type="submit" accesskey="s" tabindex="6" name="post" class="mainoption" value="{L_SUBMIT}" /></td>
   <!-- end mod save posts as drafts -->
i have an orion phpbb.. and there are no viewtopic_quickreply.php "cback orion phpbb" only has a quickreply.php and a quickreply.tpl



soemone an idea how to make this running?

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: Save posts as drafts

Post by asinshesq » Sun Nov 02, 2008 3:39 pm

Maischter wrote:...soemone an idea how to make this running?
I have absolutely no idea what you are asking. What is orion phpbb? What confirmation? What quick reply? And what doesn't work?

Just looking at those changes you asked about, the first one seems to relate to some mod you have that confirms the user's post was actually successfully submitted. Is that right? If so, are you sure the code you tinker with in includes/functions_post.php appears inside a function that actually has $save_as_draft as a parameter? If not, you'll need to pass that parameter to that function. If you pm me your posting.php and includes/functions_post.php files I'll take a look when I have time.

And on your quickreply question, again I have no idea what quckreply mod you are talking about, what you are trying to do to it and what doesn't work. Maybe if you pm me your viewtopic_quickreply.php and posting_body.tpl files I can figure out what you are doing. And note that if quickreply has its own posting template (e.g. viewtopic_quickreply.tpl), wouldn't that be where you need to make the change you are trying to make??

Maischter
Registered User
Posts: 8
Joined: Tue Feb 21, 2006 12:50 pm
Contact:

Re: Save posts as drafts

Post by Maischter » Sun Nov 02, 2008 3:51 pm

yes your correct the first one is an submit confirmation.. posted a few sites before (site 50 or so..)

the quickreplay mod is also posted here .. but dont know where it was^^

the orion mod is here: http://www.cback.de/ its maybe the best phpbb2 on the market... the programmer now writes an complete own portal software.. and has an software company... so realy talented people writing on orion phpbb..

thanks for your help, i will pn you my code..

edit:

you have pm

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

adding a confirmation screen when user saves draft

Post by asinshesq » Mon Nov 03, 2008 2:24 pm

I think Maischter's issues are now all sorted out (Maischter please correct me if I jumped the gun but I hope what I sent you this am fixes the last problem you had). His issues generally related to specific differences in his files so will not be of general interest.

However, one thing that may be of general interest is how to change things so that when a user clicks to save a post as a draft, the user gets a confirmation screen similar to the regular post confirmation screen that would say the post has been saved and that would give the user a chance to choose whether to go the the index or the forum where the user was at (with a default to the index page if the user does nothing for 3 seconds).

I intentionally set up this mod to immediately redirect the user to the index after submitting a draft because I hate making users wait for confirmation screens (in fact I've disabled all the confirmation screens on my boards and I instead have the code set up to take the user directly to a default location). But if you want this mod to give you a confirmation screen confirming the draft has been saved and allowing the user to choose whether to go to the index or the forum where the draft was saved, here's what you can do (Maischter, this is a bit different from what I gave you since you already had some of this stuff in includes/functions_post.php but you can conform the changes to what appears below if you prefer):

Code: Select all

OPEN
posting.php

FIND
		$redirect = "index.$phpEx?";
		redirect(append_sid($redirect, true) . $post_append);
		$template->assign_vars(array(
			'META' => $return_meta)
		);
		message_die(GENERAL_MESSAGE, $return_message);

REPLACE WITH
		$return_meta = '<meta http-equiv="refresh" content="3;url=' . append_sid("index.$phpEx") . '">';
		$return_message = $lang['Draft_saved'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_id) . '">', '</a>');
		$template->assign_vars(array(
			'META' => $return_meta)
		);
		message_die(GENERAL_MESSAGE, $return_message);

OPEN
language/lang_english/lang_main.php

FIND
$lang['Save_as_draft'] = 'Save as draft';

AFTER, ADD
$lang['Draft_saved'] = 'Your draft has been saved successfully.';
I think that should do it (though I haven't tested it and it may have a typo or two in there). If anyone tries this, please let us know whether it worked (and if it doesn't I'm sure it won't take long to get it to work).


By the way, to give people added flexibility here are permuations of the definitions of $return_meta and $return_message that you can plug in to the above change in posting,php that will do somewhat different things:

1. If you want it to automatically go to the index after 3 seconds but give the user a choice between the index and the forum where the draft was saved (this is altermative already posted above):

Code: Select all

		$return_meta = '<meta http-equiv="refresh" content="3;url=' . append_sid("index.$phpEx") . '">';
		$return_message = $lang['Draft_saved'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_id) . '">', '</a>');


2. If you want it to automatically go to the forum where the draft was saved after 3 seconds but give the user a choice between that forum and index:

Code: Select all

		$return_meta = '<meta http-equiv="refresh" content="3;url=' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_id) . '">';
		$return_message = $lang['Draft_saved'] . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_id) . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
3. If you want it to automatically go to the most recent post in the topic where the draft was saved after 3 seconds but give the user a choice between that post and the index:

Code: Select all

		$return_meta = '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&view=newest") . '">';
		$return_message = $lang['Draft_saved'] . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&view=newest") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
4. If you want it to automatically go to the most recent post in the topic where the draft was saved after 3 seconds but give the user a choice between that post and the forum where the draft was saved:

Code: Select all

		$return_meta = '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&view=newest") . '">';
		$return_message = $lang['Draft_saved'] . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&view=newest") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid(""viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_id") . '">', '</a>');
5. If you want to replace one of the links in the confirmation page with a link to a list of the user's drafts and posts, you can replace (or add to) the relevant code in $return_message the following bit (I got the idea from Maischter's post below):

Code: Select all

'<br /><br />' . sprintf($lang['Click_view_drafts'], '<a href="' . append_sid("search.$phpEx?search_id=egosearch_by_post") . '">', '</a>')
(of course, if your usual link to drafts on the index page is view your drafts and topics you have posted to (rather than view your drafts and posts), that code would read like this (as per Maischter's post below):

Code: Select all

'<br /><br />' . sprintf($lang['Click_return_drafts'], '<a href="' . append_sid("search.$phpEx?search_id=egosearch_by_topic") . '">', '</a>')
In either event, you can also make the default redirection after three seconds be to returning to the list of drafts by making a corresponding change in $return_meta. And in either event, you would need to add to language/lang_english/lang_main.php the following definition:

Code: Select all

OPEN
 language/lang_english/lang_main.php 

FIND
$lang['Save_as_draft'] = 'Save as draft';

AFTER, ADD
$lang['Click_return_drafts'] = 'Click %sHere%s to return to your drafts';
Last edited by asinshesq on Mon Nov 03, 2008 7:18 pm, edited 2 times in total.

Maischter
Registered User
Posts: 8
Joined: Tue Feb 21, 2006 12:50 pm
Contact:

Re: Save posts as drafts

Post by Maischter » Mon Nov 03, 2008 4:53 pm

i have no also added this :

Code: Select all

$message = $lang['Draft_saved'] . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid ("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&view=newest") . '">', '</a>') . '<br /><br />' . sprintf($lang ['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_show_drafts_and_topics'], '<a href="' . append_sid("search.$phpEx?search_id=egosearch_by_topic") . '">', '</a>');
and in the langauge file:

$lang['Click_show_drafts_and_topics'] = 'Click %sHere%s to return to your drafts';

i also added now these lines after deleting:

Code: Select all

	if ($mode == 'delete' && $post_data['first_post'] && $post_data['last_post'])
	{
		$meta = '<meta http-equiv="refresh" content="3;url=' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . '=' . $forum_id) . '">';
		$message = $lang['Deleted'];
	}
	else
	{
		$meta = '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $topic_id) . '">';
		$message = (($mode == 'poll_delete') ? $lang['Poll_delete'] : $lang['Deleted']) . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a 

href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>');
	}

	$message .=  '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . 

'">', '</a>') . '<br /><br />' . sprintf($lang['Click_show_drafts_and_topics'], '<a href="' . append_sid("search.$phpEx?search_id=egosearch_by_topic") . 

'">', '</a>');

so you can go back to your drafts folder... after posting a draft etc...

Camulas
Registered User
Posts: 13
Joined: Mon Dec 01, 2008 8:39 pm

Re: Save posts as drafts

Post by Camulas » Mon Jan 05, 2009 7:03 pm

I have two quick questions.

1) Where does one find their own drafts. The only option I see is to click the (View drafts and posts you have posted to) which takes me, obviously, to a whole hell of a lot of posts and not the drafts, is there not a folder or location where I can find my drafts?

2) Is it possible for me, as the Administration, to locate and delete my Forum Members' drafts?


Thank you for you're answer, it's appreciated.

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: Save posts as drafts

Post by asinshesq » Mon Jan 05, 2009 7:22 pm

Camulas wrote:...Where does one find their own drafts. The only option I see is to click the (View drafts and posts you have posted to) which takes me, obviously, to a whole hell of a lot of posts and not the drafts
If you installed the mod correctly, that link will bring you to a page that has a list of all of your drafts at the top (under the caption "Your drafts") and a list of all of your posts at the bottom (under the caption "Your posts"). If you have actually saved a draft and you don't see the draft list at the top of the page when you click the "View your drafts and topics you have posted to" link, you have done something wrong.
Camulas wrote:Is it possible for me, as the Administration, to locate and delete my Forum Members' drafts?...
Click the 'pruning' link In the ACP and you can prune drafts in the same way you can prune regular posts. I did NOT allow the admin to view drafts that have not yet been posted because I thought that would be inappropriate, but if you need to do that for some reason you can always look directly in the database.

Post Reply

Return to “[2.0.x] MOD Database Releases”

Who is online

Users browsing this forum: No registered users and 15 guests