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

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

Re: yet another critical error during install

Post by asinshesq »

SaloSV wrote: EDIT: I fixed it by pasting the "replace with" code and rem'ing out the "find" code.

THat's one way to do it. But your error was probably due to some extra characters in the line it was looking for (e.g. an extra space in there). Another way around that would have been to copy the lines as they appear in your forum and paste it into the the 'FIND' part of the mod script (or vice versa).
but I continued on and got the following 3 warnings:
Warning

FIND FAILED: In file [templates/cs_red/posting_body.tpl] could not 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>

MOD script line #2478 :: FAQ :: Report


Error Detail

Warning

FIND FAILED: In file [templates/cs_red/search_results_posts.tpl] could not find:

<table border="0" cellpadding="3" cellspacing="1" width="100%" class="forumline" align="center">

MOD script line #2504 :: FAQ :: Report


Error Detail

Warning

FIND FAILED: In file [templates/cs_red/search_results_topics.tpl] could not find:

<table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline" align="center">

MOD script line #2552 :: FAQ :: Report

THat's easymod's way of saying that it found all lines it needed everywhere except in your non-subSilver templates. If easymod finds all your regular phpbb lines (including in subSivler templates) but can't find some lines in your non-standard templates, it gives you that warning but will still allow you to install the mod. In that case, you can complete the installation and do the non-subSilver files manually (but you'll need to figure out how to make it work for your non-subSilver tmeplates). You can pm me if you have trouble doing that..
SaloSV
Registered User
Posts: 9
Joined: Sun Dec 17, 2006 1:41 am

Post by SaloSV »

Well, I'm using a template that is a subSilver copy, just with different colors and customized buttons/icons and such. I have one style installed that is completely different but the one I have customized is an exact structural copy of subSilver, and is the one I am forcing on the board. So it appears to have made the proper changes, meaning, the mod is working on my template.

However, it doesn't seem to want to obey my template layout. For example, when I click the "View drafts..." url from the index page, the tables appear to be rearranged. But when I go into and actual draft message, it looks fine.

Any advice on why my tables are getting moved? Could it be that my style template didn't get updated?

Thanks for you help!
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Post by asinshesq »

Area_51 wrote: I've encountered a quirk and was wondering if anybody's found a workaround for it...

If a post is saved as a draft, it gets lost if you try to view it as a regular topic. For instance, if you go to ...viewtopic.php?t=14 (or whatever topic number it was saved as) you'll get the message "The topic or post you requested does not exist" - but somehow that's removing the draft altogether. The info for the post still exists in the sql table, but the ...posting.php?mode=draft&p=14 link won't work, it's as if the draft were deleted.

Never noticed that before. It happens because when you get the message that there is no such topic it correctly executes the function sync() and in sync if it can't find any non-draft psots in the topic it thinks the topic no longer exists and so it deletes the entry from the topics table. Here's a fix that should do the job:

Try this:

Code: Select all

OPEN
includes/functions_admin.php

FIND
					$sql = 'SELECT topic_moved_id 

REPLACE WITH
					$sql = 'SELECT topic_first_post_id, topic_moved_id 

FIND
						if (!$row['topic_moved_id'])

REPLACE WITH
						if (!$row['topic_moved_id'] && $row['topic_first_post_id'] <> 0)
Let me know if that fixes things for you.
Area_51
Registered User
Posts: 6
Joined: Sat Jun 03, 2006 12:15 pm

Post by Area_51 »

Thanks Alan, that did the trick! And by the way, very nice mod - good work!
krisbfunk
Registered User
Posts: 150
Joined: Mon Jul 10, 2006 1:47 am

Post by krisbfunk »

Does this mod work with EasyCMS?
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Post by asinshesq »

krisbfunk wrote: Does this mod work with EasyCMS?

No idea...I have no clue about what easycms is. Backup up your files and try it and you'll find out...

And save yourself time and agony by installing it with easymod.
krisbfunk
Registered User
Posts: 150
Joined: Mon Jul 10, 2006 1:47 am

Post by krisbfunk »

hehe, thanks Alan. looks like I'm getting quite a bit of use out of your mods. and out of necessity even. :)

*edit*

easyCMS is an Articles mod that allows users to write articles in a place separate from the forum. A mod like this would be fantastic for this mod.. as articles can take quite some time to write. Do you think the save draft mod could be added to the posting templates and php files for this mod?

It can be downloaded here.
and the updated attachment mod for it here.

It's similar to a couple Knowledge Base/Article mods that have been developed and abandoned, or are being developed now. Like the Knowledge Base (MMW) MOD.
krisbfunk
Registered User
Posts: 150
Joined: Mon Jul 10, 2006 1:47 am

Post by krisbfunk »

ok, got around to installing the mod on a test forum using easymod and doing as you suggested by making the code corrections as it went. It surprisingly was only 3 instances.

everything went fine according to easymod, including the database alterations.. however i'm unable to save a post as a draft. When I click the 'save as draft' button, it returns immediately to the forum index without error.. no post is generated in the forum.

the 'View your posts' link is missing from the forum too. I have the attachment mod, tabluated survey at topic head and clone post mods all installed.

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

Post by asinshesq »

krisbfunk wrote: i'm unable to save a post as a draft. When I click the 'save as draft' button, it returns immediately to the forum index without error.. no post is generated in the forum.

the 'View your posts' link is missing from the forum too. I have the attachment mod, tabluated survey at topic head and clone post mods all installed.

When you save a post as a draft you are supposed to be taken back to the index (that's proper behavior), but there should be a link where the 'View your posts' link used to be called 'view your drafts and the topics you have posted to' (and the author's notes tell you how to change that to 'View your drafts and posts').

First question: what happens if you try to navigate to where that link should have take you to. Try the following address in your browser:
http://[address_of_your_forum]/search.php?search_id=egosearch_by_topic
(obviously instead of '[address_of_your_forum]' you would insert whatever the normal address is for your forum...for example, on this site the entire address to use would be http://www.phpbb.com/phpBB/search.php?s ... h_by_topic)

Does that take you to a list of your drafts and the topics you have posted to? If so, the mod is working fine and you just have to figure out why the link is not showing up.

Are you using subSilver or another template?
krisbfunk
Registered User
Posts: 150
Joined: Mon Jul 10, 2006 1:47 am

Post by krisbfunk »

ahhh, ok. that makes sense, sorry for not looking further into that on my own. The link was the missing link, heheh. I'm using a different template and for some reason the code was missing. I re-inserted the code from the install file and now have a working link to bring me to drafts!

appreciate the support.

In doing this, I also see another issue that might cause a problem using this mod for the article mod. Because the articles posted in easyCMS do not show up in the 'Topics you have posted to' section.. so it's not likely drafts would appear there even if I were able to get them to save. And then there's the fact that I know nothing about PHP aside from the very basics. lol.
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Post by asinshesq »

krisbfunk wrote: ahhh, ok. that makes sense, sorry for not looking further into that on my own. The link was the missing link, heheh. I'm using a different template and for some reason the code was missing. I re-inserted the code from the install file and now have a working link to bring me to drafts!

...the articles posted in easyCMS do not show up in the 'Topics you have posted to' section.. so it's not likely drafts would appear there even if I were able to get them to save. And then there's the fact that I know nothing about PHP aside from the very basics. lol.

I'm not following you. I thought you were going to save articles as drafts, work on them, and when you were ready to post them, post them live and then use some easycms feature to turn the post into an article. Wasn't that what you were talking about?

For what it's worth, the author's notes tell you how to change the link so that it takes you to drafts and a list of your posts rather than drafts and a list of topics you have posted to, but I don't imagine that has anything to do with what you are trying to do.
krisbfunk
Registered User
Posts: 150
Joined: Mon Jul 10, 2006 1:47 am

Post by krisbfunk »

asinshesq wrote: I'm not following you. I thought you were going to save articles as drafts, work on them, and when you were ready to post them, post them live and then use some easycms feature to turn the post into an article. Wasn't that what you were talking about?

For what it's worth, the author's notes tell you how to change the link so that it takes you to drafts and a list of your posts rather than drafts and a list of topics you have posted to, but I don't imagine that has anything to do with what you are trying to do.


yeah, that's def the way i have to do it... create an 'Article Drafts' forum, and have users draft their articles and notify a mod when they're ready to be moved. Just hoping not to confuse the user base, or make it too complicated to bother using, & i'll need to extend the advanced bbcode only avail. in articles over to the main forum (for drafting articles) where it's currently limited because i fear too much control of font/video embed/etc will just make things unprofessional and corny. BUT anyway, way off topic. it's a cool mod, and all the help is much appreciated. I'm going to change the link too, thanks for the note on that.
jay9
Registered User
Posts: 12
Joined: Wed Sep 20, 2006 5:34 am

Post by jay9 »

great mod, thank you.

I found a slight conflict with the Easy Admin Topic Notifier mod that results in admin being notified when someone saves a new topic as a draft. When you click the link to access the new topic, it says it's not there and deletes it.
So in order to avoid this, I made some changes to includes/functions_post.php - it seems to work ok. I add it here in case anyone else has the same problem. But please, I'm a bit of a noob, so maybe someone can check that it is ok.

IF and ONLY IF you have easy_admin_topic_notifier mod 1.0.4 installed:-

Code: Select all

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

#
#-----[ FIND ]------------------------------------------------
#
		if ($mode == 'newtopic')
		{
			$topic_id = $db->sql_nextid();
			sk_send_mail_to_admins($topic_id, $post_subject); 
		}

#
#-----[ REPLACE WITH ]----------------------------------------
#

		if ($mode == 'newtopic') 
		{
			$topic_id = $db->sql_nextid();
		}

		if ( (($mode == 'newtopic') && !$save_as_draft)  || ($was_a_draft && !$save_as_draft && $post_data['first_post']) )
		{
			sk_send_mail_to_admins($topic_id, $post_subject); //admin topic noftify
		}

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

Post by asinshesq »

jay9 wrote: I found a slight conflict with the Easy Admin Topic Notifier mod that results in admin being notified when someone saves a new topic as a draft. When you click the link to access the new topic, it says it's not there and deletes it.
So in order to avoid this, I made some changes to includes/functions_post.php - it seems to work ok. I add it here in case anyone else has the same problem. But please, I'm a bit of a noob, so maybe someone can check that it is ok....

Your change looks perfect (not nooby at all). You don't need those inside parenthesis around ($mode == 'newtopic') in the second if statement so you could delete those inside parenthesis if you want but they don't do any harm.

Your change will properly prevent the admin from being notified about the creation of a new topic until that new topic is submitted as a live post (rather than just a draft). By the way, the bug that results in a draft topic disappearing when you try to go to it directly via viewtopic was noticed by Area_51 and I gave a fix for that earlier in this page (here http://www.phpbb.com/phpBB/viewtopic.ph ... 22#2712222 ) but now that you've fixed the problem with your other mod so that it doesn't notify the admin of a draft you are unlucky to run into that problem anyway.
jay9
Registered User
Posts: 12
Joined: Wed Sep 20, 2006 5:34 am

Post by jay9 »

OK, Bewdy. Hope this is of some use to others, then.

Thanks Alan for taking the time to check this out. And thanks too for your suggestions.
Post Reply

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