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

phpbb 2.0.21

Post by asinshesq »

This installs fine on phpbb 2.0.21.
Trunks81
Registered User
Posts: 25
Joined: Sat Apr 15, 2006 6:42 pm

Post by Trunks81 »

Hi i have a kind of trouble finding the next lines in mij viewtopic

Code: Select all

#-----[ OPEN ]------------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]------------------------------------------------
#
					ORDER BY p.post_time ASC
					LIMIT 1";

#
#-----[ REPLACE WITH ]------------------------------------------------
#
						AND p.post_draft = 0
					ORDER BY p.post_time ASC
					LIMIT 1";
// start mod save posts as drafts (and end mod too): added an AND constraint in the foregoing sql definition that post_draft be zero (i.e. that the post not just be a draft)
I updated the forum to 2.0.21 i have keep unread flags, file attachement mod installed en some more
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Post by asinshesq »

Trunks81 wrote: Hi i have a kind of trouble finding the next lines in mij viewtopic

Code: Select all

#-----[ OPEN ]------------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]------------------------------------------------
#
					ORDER BY p.post_time ASC
					LIMIT 1";

#
#-----[ REPLACE WITH ]------------------------------------------------
#
						AND p.post_draft = 0
					ORDER BY p.post_time ASC
					LIMIT 1";
// start mod save posts as drafts (and end mod too): added an AND constraint in the foregoing sql definition that post_draft be zero (i.e. that the post not just be a draft)
I updated the forum to 2.0.21 i have keep unread flags, file attachement mod installed en some more


Find the line in vietopic that reads:

Code: Select all

$sql = "SELECT p.post_id
and then post that line and the ten that follow it here and we should be able to help.
Trunks81
Registered User
Posts: 25
Joined: Sat Apr 15, 2006 6:42 pm

Post by Trunks81 »

Hi

Tried to find this line, but also cant find it

Code: Select all

$sql = "SELECT p.post_id
Only thing i can find with p.post_id in it are these lines

Code: Select all

$order_sql = (!$post_id) ? '' : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments ORDER BY p.post_id ASC";

$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments" . $count_sql . "
	FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $join_sql_table . "
	WHERE $join_sql
		AND f.forum_id = t.forum_id
		$order_sql";
		attach_setup_viewtopic_auth($order_sql, $sql);
if ( !($result = $db->sql_query($sql)) )
And this one

Code: Select all

{ //added topic_last_post_id, p.post_time to sql
	$sql = "SELECT t.forum_id, t.topic_id, t.topic_last_post_id, p.post_time
		FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
		WHERE t.topic_id = p.topic_id
		AND t.topic_moved_id = 0
		AND p.post_id = $post_id";
Greetings TRunks
roadhog
Registered User
Posts: 104
Joined: Mon Jul 11, 2005 2:23 pm
Location: Texas, USA

Post by roadhog »

Hi,

I installed this MOD with EasyMod, into a heavily modded board that was alread updated to 2.0.21. Of course I had to modify a few of the "Find" lines in the MOD, because of previously installed MODs. The files that necessitated the changes were posting.php, privmsg.php, prune.php, and search.php. In most cases the problem was that the "Find" line had already been modified to the "Replace with" version, but as I recall, one of them required an "in-line" modificaion.

Anyway, my problem is that everything seems to work ok, except for the fact that when I click on the link on the index page to access my drafts, there is no way to edit the draft and/or submit it. You say to "click on it". Where? No matter where I click, nothing happens. If I click on the topic link, of course, then that topic will appear, but there is no way to edit or submit the draft. (It appears, as a draft, below the text window, along with the actual posts, but there is no way to edit it). Obviously something on my board is not working correctly. Where did I go wrong?
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Post by asinshesq »

roadhog wrote: ...Anyway, my problem is that everything seems to work ok, except for the fact that when I click on the link on the index page to access my drafts, there is no way to edit the draft and/or submit it. You say to "click on it". Where? No matter where I click, nothing happens. If I click on the topic link, of course, then that topic will appear, but there is no way to edit or submit the draft. (It appears, as a draft, below the text window, along with the actual posts, but there is no way to edit it). Obviously something on my board is not working correctly. Where did I go wrong?


When you point to the link and look at the area in your browser that tells you where the link is going to take you to, is it of the following form:
http://siteaddress.com/posting.php?mode=draft&p=13420

If you're not sure where to look in your browser for this information, how about right clicking the link and selecting 'copy link location' or whatever your browser calls it and then pasting that into a text document so that you can figure out where those links are pointing to.
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Post by asinshesq »

Trunks81 wrote: Hi

Tried to find this line, but also cant find it

Code: Select all

$sql = "SELECT p.post_id
Only thing i can find with p.post_id in it are these lines

Code: Select all

$order_sql = (!$post_id) ? '' : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments ORDER BY p.post_id ASC";

$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments" . $count_sql . "
	FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $join_sql_table . "
	WHERE $join_sql
		AND f.forum_id = t.forum_id
		$order_sql";
		attach_setup_viewtopic_auth($order_sql, $sql);
if ( !($result = $db->sql_query($sql)) )
And this one

Code: Select all

{ //added topic_last_post_id, p.post_time to sql
	$sql = "SELECT t.forum_id, t.topic_id, t.topic_last_post_id, p.post_time
		FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
		WHERE t.topic_id = p.topic_id
		AND t.topic_moved_id = 0
		AND p.post_id = $post_id";
Greetings TRunks


Please send me your viewtopic.php file and I'll take a look.
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Post by asinshesq »

Trunks81 wrote: Hi i have a kind of trouble finding the next lines in mij viewtopic

Code: Select all

#-----[ OPEN ]------------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]------------------------------------------------
#
					ORDER BY p.post_time ASC
					LIMIT 1";

#
#-----[ REPLACE WITH ]------------------------------------------------
#
						AND p.post_draft = 0
					ORDER BY p.post_time ASC
					LIMIT 1";
// start mod save posts as drafts (and end mod too): added an AND constraint in the foregoing sql definition that post_draft be zero (i.e. that the post not just be a draft)
I updated the forum to 2.0.21 i have keep unread flags, file attachement mod installed en some more


Ok, Trunks81, as you suspected other mods have changed that particular code in your viewtopic. If you change that mod change to read like this it should do the job:

Code: Select all

#
#-----[ FIND ]------------------------------------------------
#
		$sql = "SELECT p.post_id, t.topic_last_post_id
			FROM (" . TOPICS_TABLE . " t
			LEFT JOIN " . POSTS_TABLE . " p ON p.topic_id = t.topic_id AND p.post_time > $topic_last_read)
			WHERE t.topic_id = $topic_id
			AND t.topic_moved_id = 0
			ORDER BY p.post_time";

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

		$sql = "SELECT p.post_id, t.topic_last_post_id
			FROM (" . TOPICS_TABLE . " t
			LEFT JOIN " . POSTS_TABLE . " p ON p.topic_id = t.topic_id AND p.post_time > $topic_last_read)
			WHERE t.topic_id = $topic_id
			AND t.topic_moved_id = 0
			AND p.post_draft = 0
			ORDER BY p.post_time";
// start mod save posts as drafts (and end mod too): added an AND constraint in the foregoing sql definition that post_draft be zero (i.e. that the post not just be a draft)
roadhog
Registered User
Posts: 104
Joined: Mon Jul 11, 2005 2:23 pm
Location: Texas, USA

Post by roadhog »

Thanks for the response. No, the search links look like this, of course, and seem to work correctly, (drafts are not listed on top, however, unless they were submitted last):

http://www.perskyfarms.com/phpBB2/searc ... ch_by_post

When I look at the draft in the list, however it appears just like any other post, (except that it is not actually posted in the forum to which it is connected). IOW, it is not identified in the list as a draft. The only links on the draft itself, are the usual viewforum, and viewtopic links. No draft link is present, (at least I can't find one).
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Post by asinshesq »

roadhog wrote: Thanks for the response. No, the search links look like this, of course, and seem to work correctly, (drafts are not listed on top, however, unless they were submitted last):

http://www.perskyfarms.com/phpBB2/searc ... ch_by_post

When I look at the draft in the list, however it appears just like any other post, (except that it is not actually posted in the forum to which it is connected). IOW, it is not identified in the list as a draft. The only links on the draft itself, are the usual viewforum, and viewtopic links. No draft link is present, (at least I can't find one).


Do the drafts inappropriately show up in topics when you are looking at topics in viewtopic? Do new draft topics show up when you are looking at the llist of topics in viewforum? If the answer is no, that's good: it's possible that everything is working 100 percent except for the changes you made in search.php.

I'm confused about what your drafts and post list looks like when you click the vieww your drafts and posts linlk from the index. Are you saying there is no top section for drafts?

How about emailing me your search.php file and I'll take a look over the next few days.
roadhog
Registered User
Posts: 104
Joined: Mon Jul 11, 2005 2:23 pm
Location: Texas, USA

Post by roadhog »

Ok, I just checked it out again to make sure that I was correct, and no, the drafts do not inappropriately show up in either viewtopic or viewforum.

You are correct, when I click on the view your drafts and posts link, on the index page, the resulting list does not include a separate top section for drafts. They are simply mixed in with the posts.

I've already emailed you the search.php file.

If there's supposed to be a separate section for drafts in that search list, then I'm guessing that I must have a template problem. Or am I wrong?
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Post by asinshesq »

roadhog wrote: Ok, I just checked it out again to make sure that I was correct, and no, the drafts do not inappropriately show up in either viewtopic or viewforum.

You are correct, when I click on the view your drafts and posts link, on the index page, the resulting list does not include a separate top section for drafts. They are simply mixed in with the posts.

I've already emailed you the search.php file.

If there's supposed to be a separate section for drafts in that search list, then I'm guessing that I must have a template problem. Or am I wrong?


It looks like your error was in how you adapted this mod to another mod on your board that uses the concept of 'post_flagged' (I guess it's a mod that checks for spam and pms the admins?). You called submit_post with post_flagged in a different order than the order it appears in the definitionof submit_post() and for that reason you messed up the order of post_flagged as well as the order of was_a_draft and save_as_draft.

I just pm'd you what I think will be a fix. See if that does the trick.
Last edited by asinshesq on Fri Jun 16, 2006 7:21 am, edited 1 time in total.
roadhog
Registered User
Posts: 104
Joined: Mon Jul 11, 2005 2:23 pm
Location: Texas, USA

Post by roadhog »

That other mod is called the Spam Words MOD, and making the change you suggested may have neutered that MOD, (I didn't bother to check that out, though), but it didn't seem to change anything else. There is still no seperate section for drafts, in the list that the search displays, and no way to access them for editing or submitting. The drafts are mixed in with the actual posts, collated according to date and time, just as before.

Wait a minute--there is one change that I can see. Now the Forum Statistics in the admin panel shows one draft, rather than zero. However this could be the one that I created for the account that you viewed, and I didn't check the admin panel after that. That would suggest that it doesn't count drafts made by an admin, since I had made two drafts earlier that didn't show up.
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Post by asinshesq »

Sorry, but that change didn't neuter spam posts...that change fixed an error you made in spam posts that neutered both mods. (I didn't check spam posts on your board but the way you had it before couldn't have worked since you called the function submit_post with post_flagged in the third to last slot and defined the function submit_post with post_flagged in the last slot, and similarly you called the function submit_post with was_as_draft and save_as_draft in the second to last and last slot but defined the function submit_post with those in the third to last and second to last slot...that error would have broken both spam_posts and save as drafts (neither mod would have had a chance).

Your board now saves drafts...I've just tried it. It will not fix the drafts you made earlier since those were saved incorrectly when you didn't have the mod working and for that reason are wrongly stored in your db. If you have further questions about this, let's take this offline to pms since it no longer is about save drafts.
roadhog
Registered User
Posts: 104
Joined: Mon Jul 11, 2005 2:23 pm
Location: Texas, USA

Post by roadhog »

Hey, I apologize for not thinking about trying a new draft last night. I'd had a long hard day, and I was tired.

It does indeed work correctly now, and I do appreciate all your help. Thanks.
Post Reply

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