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

Nap BlownApart
Registered User
Posts: 35
Joined: Sun Jul 30, 2006 6:47 am

Re: Save posts as drafts

Post by Nap BlownApart »

I am running Ptirhiik's Categories hierarchy (Version 2.1.6c).
Is the "Save Posts as Drafts" compatable with the install I have? Anyone tried it?
If not, I understand. I'm just asking the question because I got the following error below:

I tried to install this mod (using EasyMod 0.3.0) but I got a CRITICAL error saying that "viewforum.php" could not be opened for reading.

I checked the files in my phpBB2 install, and there is no such file. I do have a file, "index.php" which contains the lines that are being searched for "auto_prune($forum_id);".

Is it possible to change the target file in the install?
(I edited the mod script and changed viewforum.php to index.php, but then encountered further errors.)

Has anyone else runnign Ptirhiik's Categories hierarchy (Version 2.1.6c) had this issue?

Cheers,
Nap
Last edited by Nap BlownApart on Tue Jun 12, 2007 10:31 pm, edited 1 time in total.
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 »

Nap BlownApart wrote:I tried to install this mod (using EasyMod 0.3.0) but I got a CRITICAL error saying that "viewforum.php" could not be opened for reading.

I checked the files in my phpBB2 install, and there is no such file...
Errrr....either you have viewforum.php or you do not have a working phpbb forum (or maybe you are using CH??). Any chance you are trying to install this in phpbb-nuke (which is not the same thing as phpbb)? If you are trying to install this in phpbb with CH or nuke the mod would have to be changed to accomodate the differences. I actually did a version that worked for an older version of CH but I have no idea if that still works in the latest version.
Nap BlownApart
Registered User
Posts: 35
Joined: Sun Jul 30, 2006 6:47 am

Re: Save posts as drafts

Post by Nap BlownApart »

Hi asinshesq,

Thanks for your SUPER quick response. I just edited my earlier post because I realised that CH might have something to do with it.

Cheers,
Nap
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 »

Nap BlownApart wrote:I just edited my earlier post because I realised that CH might have something to do with it
Yup, the mod needs to be revised substantially to work with CH (since CH is more of a total re-write of phpbb than it is a mod).

If you search in ptirhiik's CH site you'll find posts by me and a link to a revised version of this mod that worked with CH 2.1.4. I don't think that will work wioth his latest versions of CH, and I do not plan to do another version that works with his latest version (sorry), but maybe someone there has adapted the earlier version I did to ch 2.1.6?
bbowen
Registered User
Posts: 11
Joined: Tue Nov 01, 2005 2:08 pm

Re: Save posts as drafts

Post by bbowen »

Love your mod, have used it ever since I found it, almost 2 years ago. I have a problem, which honestly seems all of a sudden.

I can save as draft just fine, but when I go to post it as a new topic, it posts 'incorrectly' basically looking at the post in phpmyadmin, I can see that the topic_id is set to 0 for the post, which I think is pretty incorrect. I have a lot of mods, and I am not sure when this occured. If I sent you a copy of my posting.php or functions_post.php could you help me figure out what went wrong?
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 »

bbowen wrote:If I sent you a copy of my posting.php or functions_post.php could you help me figure out what went wrong?
probably. pm me those files and I'll see what I can see.
Rep
Registered User
Posts: 317
Joined: Sat Jan 15, 2005 11:19 pm

Re: Save posts as drafts

Post by Rep »

I added this mod to my phpBB 2.0.22 board. Wonderful mod BTW, and TY.

I used it a number of times and it was working fine. But now, all of a sudden, the, "save post as draft" buttons no longer show up when drafting a post.

The, "View your drafts and topics you have posted to" link appears on the index page, I can call up previously saved drafts but the Save as draft button is no longer there. Nor is there when I am drafting a new topic, or, a post.

Any ideas?

(I did change the values in included/functions_post.php to allow an increase in the number of smilies the board displays. Other than that, no other mod added changed any files save drafts uses.)
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 »

Rep wrote:I added this mod to my phpBB 2.0.22 board. Wonderful mod BTW, and TY.

I used it a number of times and it was working fine. But now, all of a sudden, the, "save post as draft" buttons no longer show up when drafting a post.

The, "View your drafts and topics you have posted to" link appears on the index page, I can call up previously saved drafts but the Save as draft button is no longer there. Nor is there when I am drafting a new topic, or, a post.

Any ideas?

(I did change the values in included/functions_post.php to allow an increase in the number of smilies the board displays. Other than that, no other mod added changed any files save drafts uses.)
Is it possible that you have switched templates and forgot to make the changes on the new template that correspond to the changes this mod makes to posting_body.tpl? If so, that's the problem. If not, we'll need to investigate further.

Next question: do you see the save as draft button when you start a new pm? If not, then it is clear the problem is not in posting.php (since privmsg.php has its own code for this) so the problem must be in posting_body.tpl.

FInally, note that the code lines that give you the buttons when you are writing a new post are:

1. From posting.php:

Code: Select all

// start mod save posts as drafts...if a new topic or a reply or a quote or was_a_draft, allow to save as draft or to delete
if ( $userdata['session_logged_in'] && ( $mode == 'newtopic' || $mode == 'reply' || $mode == 'quote' || $was_a_draft ) )
{
	$template->assign_block_vars('switch_save_as_draft_button', array());
}
// end mod save posts as drafts
and

Code: Select all

	'L_SAVE_AS_DRAFT' => $lang['Save_as_draft'],
2. From the tempaltes/subSilver/posting_body.tpl file:

Code: Select all

	<!-- start mod save posts as drafts -->
	<!-- added begin and end switch_delete_button and switch_save_as_draft and stuff between them -->
	  <td class="catBottom" colspan="3" align="center" height="28"> {S_HIDDEN_FORM_FIELDS}
	  <!-- BEGIN switch_delete_button -->
	  <input type="submit" tabindex="3" name="delete" class="mainoption" value="{L_DELETE}" />&nbsp;
	  <!-- END switch_delete_button -->
	  <!-- 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 -->
If you can't figure this out, tell me what you have tried and then pm me your posting.php and posting_body.tpl files and I'll take a look.
bbowen
Registered User
Posts: 11
Joined: Tue Nov 01, 2005 2:08 pm

Re: Save posts as drafts

Post by bbowen »

asinshesq wrote:
bbowen wrote:If I sent you a copy of my posting.php or functions_post.php could you help me figure out what went wrong?
probably. pm me those files and I'll see what I can see.
Thanks asinshesq for your help. You PM'd me that missing set of code, and while that didn't work at first, I noticed going through the mod file that I seemingly had some duplicated line code code setting the $sql, so I commented out that line and all is well.

Thanks again for this great mod.
Rep
Registered User
Posts: 317
Joined: Sat Jan 15, 2005 11:19 pm

Re: Save posts as drafts

Post by Rep »

asinshesq wrote:
Rep wrote:I added this mod to my phpBB 2.0.22 board. Wonderful mod BTW, and TY.

I used it a number of times and it was working fine. But now, all of a sudden, the, "save post as draft" buttons no longer show up when drafting a post.

The, "View your drafts and topics you have posted to" link appears on the index page, I can call up previously saved drafts but the Save as draft button is no longer there. Nor is there when I am drafting a new topic, or, a post.

Any ideas?

(I did change the values in included/functions_post.php to allow an increase in the number of smilies the board displays. Other than that, no other mod added changed any files save drafts uses.)
Is it possible that you have switched templates and forgot to make the changes on the new template that correspond to the changes this mod makes to posting_body.tpl? If so, that's the problem. If not, we'll need to investigate further.

Next question: do you see the save as draft button when you start a new pm? If not, then it is clear the problem is not in posting.php (since privmsg.php has its own code for this) so the problem must be in posting_body.tpl.

FInally, note that the code lines that give you the buttons when you are writing a new post are:

1. From posting.php:

Code: Select all

// start mod save posts as drafts...if a new topic or a reply or a quote or was_a_draft, allow to save as draft or to delete
if ( $userdata['session_logged_in'] && ( $mode == 'newtopic' || $mode == 'reply' || $mode == 'quote' || $was_a_draft ) )
{
	$template->assign_block_vars('switch_save_as_draft_button', array());
}
// end mod save posts as drafts
and

Code: Select all

	'L_SAVE_AS_DRAFT' => $lang['Save_as_draft'],
2. From the tempaltes/subSilver/posting_body.tpl file:

Code: Select all

	<!-- start mod save posts as drafts -->
	<!-- added begin and end switch_delete_button and switch_save_as_draft and stuff between them -->
	  <td class="catBottom" colspan="3" align="center" height="28"> {S_HIDDEN_FORM_FIELDS}
	  <!-- BEGIN switch_delete_button -->
	  <input type="submit" tabindex="3" name="delete" class="mainoption" value="{L_DELETE}" />&nbsp;
	  <!-- END switch_delete_button -->
	  <!-- 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 -->
If you can't figure this out, tell me what you have tried and then pm me your posting.php and posting_body.tpl files and I'll take a look.
asinshesq

For now, please consider this issue closed. This is what I did:

I grabbed a couple of backup files, and remodded posting_body.tpl and uploaded it. That is where the problem apparently came from as I have my buttons back and the mod is working as you designed it to.

Yet, I still have not figured out why it worked when I originally installed it and then all of a sudden I lost my save posts as drafts buttons. I have performed a couple of tweaks to the board, none of which played in the posting_body.tpl.

Unless, and this is a possibility, I added a mod and had not documented that mod in my personal, "PHPBB update and modification logs - A history" file that I keep to remind me of what I have done to the board over time. If so, I will probably run into a mod that is no longer working and can move forward from Save Posts as Drafts.

I appreciate your offer to examine my files and work this through with me.
taxlady
Registered User
Posts: 43
Joined: Sun Mar 26, 2006 1:13 am

Re: Save posts as drafts

Post by taxlady »

On our Board we use m2f (mail to forum) so posts from the Board are also posted on our old yahoo group (some don't like a Board format :o I know, I don't understand why either). Our problem is that since a draft is treated as being submitted, they post to the yahoo list. Would it be possible to modify the posting.php file as follows (changes I want to make in red):

// start mod save draft posts
// since opening up a draft is mostly the same as editing it, we will (if draft mode)
// switch to edit mode but make sure we keep track that it is a draft
if ( $mode == 'draft' )
{
$was_a_draft = TRUE;
$mode = 'editpost';
}
// also, since save as draft is still a form of submit, make submit true if save as draft is true...
if ( $save_as_draft )
{
$submit = TRUE; $submit = FALSE;
}
// end mod save draft posts

Would this create problems? If so, do you have a solution?

Thanks!
Jules
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 »

taxlady wrote:On our Board we use m2f (mail to forum) so posts from the Board are also posted on our old yahoo group (some don't like a Board format :o I know, I don't understand why either).
I use m2f on one of my boards too...I hate hate hate it but I got muscled into it the same way as you ;)

If I have time tonight I'll take a look to refresh my recollection about what I did to fix the problem you are describing (I don't think I did what you describe but I don't remember).
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 »

taxlady wrote:On our Board we use m2f (mail to forum) so posts from the Board are also posted on our old yahoo group (some don't like a Board format :o I know, I don't understand why either). Our problem is that since a draft is treated as being submitted, they post to the yahoo list.
Ok, give this a try:

Code: Select all

OPEN
includes/functions_post.php

FIND
	if ($mode == 'newtopic' || $mode == 'reply' || $mode == 'editpost') 

REPLACE WITH
	// mod for marrying m2f and save posts as drafts: added && !save as draft at end of next line so that posts being saved as drafts to not get emailed
	if ( ($mode == 'newtopic' || $mode == 'reply' || $mode == 'editpost') && !$save_as_draft )

FIND
		$m2f_forum_post->mode 					= $mode;

REPLACE WITH
		// mod for marrying m2f and save posts as drafts: added test in next line to see if this was a draft now getting submitted
		// (in which case we need to fool m2f into thinking this is a regular reply rather than a draft
		$m2f_forum_post->mode = ($was_a_draft) ? 'reply' : $mode;
taxlady
Registered User
Posts: 43
Joined: Sun Mar 26, 2006 1:13 am

Re: Save posts as drafts

Post by taxlady »

Thank you so much, Alan ~ I'll make the changes. You rock!!
Jules
taxlady
Registered User
Posts: 43
Joined: Sun Mar 26, 2006 1:13 am

Re: Save posts as drafts

Post by taxlady »

Hi Alan,

I only have one problem ~ there are two instances of:
if ($mode == 'newtopic' || $mode == 'reply' || $mode == 'editpost')

Which one is the one I edit? :?

One is after: $current_time = time();

And the other after: // Begin M2F ----------------------------------------------

I already had our Board down for a bit :mrgreen: so, need to clarify which one is the one I edit. Some folks probably got a little surprise when they couldn't reply to any messages (and got an error msg) for a bit until I got things restored back to the original coding. ;)

Thanks again!

P.S. I am thinking it is the second one, but don't want to attempt this again until I know for sure. Yup, I am chicken!
Jules
Post Reply

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