Save full drafts

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

NOTICE: This forum is only for the announcement of new releases and/or updates of MODs. Any MOD support should be obtained through the Customisations Database in the support area designated for each MOD.

A direct link to support for each MOD is in the first post of the respective topic.
NicksNet
Registered User
Posts: 55
Joined: Sat Apr 04, 2009 1:16 pm

Re: Save full drafts

Post by NicksNet »

asinshesq wrote:
asinshesq wrote:Hang on, I just replicated that with my test board so I should be able to figure it out. I suspect something happened with the upgrade to phpbb3.0.5...I'll lcheck this later today and get back to you.
Ok, everything worked with phpbb3.0.4 but 3.0.5 added a line to posting.php that messed things up. Try this:

Code: Select all

OPEN
posting.php

FIND
				(($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND p.post_approved = 1');
REPLACE WITH
				(($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND p.post_approved > 0');
Let me know if that works.
hi,

nice job, now it works perfectly ;)


but a suggestion i have...

if i save a draft, is there a possibility to redirect (or link) after saving to the post (so that i can create this post) because now i will redirected to the forum, not to the site where i create a topic/post (hopefully you understand my bad english :oops: )

regards
Sorry, my English isn't the best...
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: Save full drafts

Post by asinshesq »

DutchToxophilite wrote:Hi asinshesq.

I'm afraid soft delete also altered something here.
I will include the file, so you can figure it out.
(SORRY!!!)

Then about my first question:
As I only use Automod to install MODS, I couldn't have forgotten about that change, nor put it in the incorrect place.
But never the less, I checked the file, and the alteration is there, as it should be.
But the drafts remain in the list.

But first things first.

Please solve the issue with users not being able to access drafts first.

grtz,
Twan
That file looks fine. Can you try this for testing purposes:

Code: Select all

OPEN
includes/functions_posting.php

FIND
		delete_drafts($old_post_id);

BEFORE, ADD
		DIE("The post_id of the draft post that has not been deleted is: " . $old_post_id);
When you take a draft and submit it live, that should stop the script and display the post_id of the draft. I'm trying to figure out if it gets that far and whether it finds the correct post_id. So, let me know if you get to that message and if so, whether the post_id it reports is in fact the post_id of hte draft (you can figure out the post_id of the draft by going to the list of drafts and hovering the mouse over the link for the draft and looking for the part of the upl that says p=xyz).

If all of that works as expected, pm me your includes/functions_save_full_drafts.php file and I'll atke a look at that. If not, we'll figure out where to go from there.

All of this relates to the problem where for some reason it doesn't autodelete the draft after you post it live. On your separate problem where it doesn't allow a regular user to access the draft, the code I gave you earlier works fine for a regular board so you are probably right that soft_delete or some other mod messed it up on your board. Please pm me your posting.php file and I'll try to figure that out.
User avatar
DutchToxophilite
Registered User
Posts: 175
Joined: Fri Dec 14, 2007 9:59 pm
Location: Venlo - The Netherlands
Contact:

Re: Save full drafts

Post by DutchToxophilite »

asinshesq wrote: When you take a draft and submit it live, that should stop the script and display the post_id of the draft. I'm trying to figure out if it gets that far and whether it finds the correct post_id. So, let me know if you get to that message and if so, whether the post_id it reports is in fact the post_id of hte draft (you can figure out the post_id of the draft by going to the list of drafts and hovering the mouse over the link for the draft and looking for the part of the upl that says p=xyz).
Yep, when logged in as admin, I get exactly that message, with the correct message ID.
asinshesq wrote: If all of that works as expected, pm me your includes/functions_save_full_drafts.php file and I'll atke a look at that. If not, we'll figure out where to go from there.
Check your mailbox.
asinshesq wrote:All of this relates to the problem where for some reason it doesn't autodelete the draft after you post it live. On your separate problem where it doesn't allow a regular user to access the draft, the code I gave you earlier works fine for a regular board so you are probably right that soft_delete or some other mod messed it up on your board. Please pm me your posting.php file and I'll try to figure that out.
Also check your mail.

My gratitudes for helping me....

grtz,
Twan
You are never to old to be stubern.....
NicksNet
Registered User
Posts: 55
Joined: Sat Apr 04, 2009 1:16 pm

Re: Save full drafts

Post by NicksNet »

hello again,

reading your correspondence i found another little error:

if a user saves a draft the draft will be showing as a new topic in recent list (NV_recent_topics_1_0_3) and also in usermenu in the portal (board3portal_1_0_3) as new topic/post - but since the draft was only saved, the topic/post wont opened.

i hope, you can help


regards Nick
Attachments
NV recent topics - but posting dont exists
NV recent topics - but posting dont exists
Screenshot_208.jpg (53.06 KiB) Viewed 2359 times
newposts (portal) - but posting not exists
newposts (portal) - but posting not exists
Screenshot_210.jpg (91.11 KiB) Viewed 2359 times
search.php -> newposts
search.php -> newposts
Screenshot_211.jpg (54.69 KiB) Viewed 2359 times
Sorry, my English isn't the best...
User avatar
DutchToxophilite
Registered User
Posts: 175
Joined: Fri Dec 14, 2007 9:59 pm
Location: Venlo - The Netherlands
Contact:

Re: Save full drafts

Post by DutchToxophilite »

Hi.

I can not confirm this behaviour, even though I have board3portal installed as wel.

For the benefit of asinshesq.
This is my list of installed MOD's
Which are all working, before I tried the installation of the "Save Full drafts" MOD.
List is taken from AutoMOD. No MOD's where installed without AutoMod.
100+ Bots Install Script
ACP Add User MOD
Activity Stats MOD
Avatar on Memberlist
Clickable Rows
Contact Admin
FAQ Manager
Genders
Guests Past 24 hours on index
IP-address in topic for phpBB3
Latest Post In Profile
Link page
List subforums in columns
MCP info on index
MOD Version Check
Notify Admin on Registration
Prime Links
Profile Views List
Quick reply for phpBB3
Soft Delete
Special Chars
Thanks for posts
Topic SiteMap
Universal No Avatar
Users Online Time
board3 Portal
daroPL_AntiSpam

I hope this helps, and not confuses things.

grtz,
Twan
You are never to old to be stubern.....
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: Save full drafts

Post by asinshesq »

NicksNet wrote:i found another little error:

if a user saves a draft the draft will be showing as a new topic in recent list (NV_recent_topics_1_0_3) and also in usermenu in the portal (board3portal_1_0_3) as new topic/post - but since the draft was only saved, the topic/post wont opened.
That is not an error with this mod. That is a problem with your other mods. If you have other mods like recent_topics that list topics or posts, you will need to change those mods so that they ignore drafts. You need to add to the $sql queries they run the constraint that post_approved <> POST_DRAFT or topic_approved <> POST_DRAFT. If you can find the $sql queries in those mods that find the posts or drafts and you can't figure out how to fix them, you can show them to me and I'll try to help.
User avatar
DutchToxophilite
Registered User
Posts: 175
Joined: Fri Dec 14, 2007 9:59 pm
Location: Venlo - The Netherlands
Contact:

Re: Save full drafts

Post by DutchToxophilite »

Hi Alan.

Here are the results of the jury ;)

Regarding the change you suggested in post:
http://www.phpbb.com/community/viewtopi ... #p10293645
(Sorry about the file mix up from my side)
Now even regular users can access the drafts.
So that issue is solved.



Regarding the change you suggested in post:
http://www.phpbb.com/community/viewtopi ... #p10294235
The correct messageID is posted in the line for all drafts that are "submitted".
When that particular line is removed, the draft still remains in the drafts list after submitting.
Even more strangely, It can be re-submitted again and again.
As shown in this screenshot:
ScreenShot679.jpg
ScreenShot679.jpg (20.14 KiB) Viewed 2353 times
Those 3x Test89 topics have the following links:

Code: Select all

http://www.handboogforum.nl/viewtopic.php?f=4&t=791
http://www.handboogforum.nl/viewtopic.php?f=4&t=790
http://www.handboogforum.nl/viewtopic.php?f=4&t=789
I hope that helps.

What would you like me to test or try now?

grtz,
Twan
You are never to old to be stubern.....
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: Save full drafts

Post by asinshesq »

DutchToxophilite is right - I had an error that prevented the mod from deleting the old version of the draft when you finally submit it live as a real post. The change you need to make to fix that problem is this:

Code: Select all

OPEN
includes/functionms_save_full_drafts.php

FIND
		$draft_posts = array($draft_pms);

REPLACE WITH
		$draft_pms = array($draft_pms);
Thanks for pointing out the error and working with me to track it down, DutchToxophilite.
User avatar
DutchToxophilite
Registered User
Posts: 175
Joined: Fri Dec 14, 2007 9:59 pm
Location: Venlo - The Netherlands
Contact:

Re: Save full drafts

Post by DutchToxophilite »

asinshesq wrote: Thanks for pointing out the error and working with me to track it down, DutchToxophilite.
NP

Thank you for your patience, and the will to help a user.

But I do suggest you update your MOD, to reflect the correct changes.

grtz,
Twan
You are never to old to be stubern.....
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: Save full drafts

Post by asinshesq »

DutchToxophilite wrote:But I do suggest you update your MOD, to reflect the correct changes.
Yesterday I edited my first post in this topic to alert people about these changes. And of course at some point I'll submit a new version that addresses them as well.
NicksNet
Registered User
Posts: 55
Joined: Sat Apr 04, 2009 1:16 pm

Re: Save full drafts

Post by NicksNet »

hi,

thanks for help, i cant figure out what i have to do :oops:
Attachments
functions.php
/portal/includes/functions.php
(18.26 KiB) Downloaded 47 times
functions_recenttopics.php
/includes/functions_recenttopics.php
(10.99 KiB) Downloaded 51 times
Sorry, my English isn't the best...
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

adapting recent topic and portal mods to this mod...

Post by asinshesq »

NicksNet wrote:hi,

thanks for help, i cant figure out what i have to do :oops: ...
TO adopt the NV recent topics mod to this, try using this in place of functions_recenttopics.php:

Code: Select all

<?php

/**
*
* @package - NV recent topics
* @version $Id: functions_recenttopics.php 182 2008-12-22 16:24:16Z nickvergessen $
* @copyright (c) nickvergessen ( http://www.flying-bits.org/ )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

if (!function_exists('display_forums'))
{
	include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
}

$user->add_lang('mods/info_acp_recenttopics');

$limit			= $config['rt_number'];
$page_limit		= $config['rt_page_number'] * $config['rt_number'];
$start			= request_var('start', 0);
$rt_anti_topics	= $config['rt_anti_topics'];
$onlyforum		= request_var('f', 0);

// Only call the query, if we need to
if ($onlyforum)
{
	$onlyforum_ary = array($onlyforum);
	$sql = 'SELECT parent_id, forum_id FROM ' . FORUMS_TABLE . "
		ORDER BY left_id";
	$result = $db->sql_query($sql);
	while ($row = $db->sql_fetchrow($result))
	{
		if (in_array($row['parent_id'], $onlyforum_ary))
		{
			$onlyforum_ary[] = $row['forum_id'];
		}
	}
	$db->sql_freeresult($result);
}

// Get the allowed forums
$forum_ary = $topic_ary = array();
$forum_read_ary = $auth->acl_getf('f_read');
foreach ($forum_read_ary as $forum_id => $allowed)
{
	if ($allowed['f_read'])
	{
		$forum_ary[] = (int) $forum_id;
	}
}
$forum_ary = array_unique($forum_ary);

// Get the allowed topics
$sql = 'SELECT t.topic_id
	FROM ' . TOPICS_TABLE . ' t
	LEFT JOIN ' . FORUMS_TABLE . ' f
		ON f.forum_id = t.forum_id
	WHERE (
			f.forum_recent_topics = 1
			' . (($onlyforum) ? ' AND ' . $db->sql_in_set('t.forum_id', $onlyforum_ary) : '') . '
			AND ' . $db->sql_in_set('t.topic_id', $rt_anti_topics, true) . '
			AND ' . $db->sql_in_set('t.forum_id', $forum_ary, false, true) . '
			AND t.topic_approved <> ' . POST_DRAFT . '
		)
		OR (t.topic_type = ' . POST_GLOBAL . ' AND t.topic_approved <> ' . POST_DRAFT . '
	GROUP BY t.topic_last_post_id
	ORDER BY t.topic_last_post_time DESC';
$result = $db->sql_query_limit($sql, $limit + 1, $start);
while ($row = $db->sql_fetchrow($result))
{
	$topic_ary[] = $row['topic_id'];
}
$db->sql_freeresult($result);

// Grab icons
$icons = $cache->obtain_icons();

// Now only pull the data of the requested topics
$sql = 'SELECT t.*, i.icons_url, i.icons_width, i.icons_height, tp.topic_posted, f.forum_name
	FROM ' . TOPICS_TABLE . ' t
	LEFT JOIN ' . TOPICS_POSTED_TABLE . ' tp
		ON (t.topic_id = tp.topic_id
			AND tp.user_id = ' . $user->data['user_id'] . ')
	LEFT JOIN ' . FORUMS_TABLE . ' f
		ON f.forum_id = t.forum_id
	LEFT JOIN ' . ICONS_TABLE . ' i
		ON t.icon_id = i.icons_id
	WHERE ' . $db->sql_in_set('t.topic_id', $topic_ary, false, true) . '
	ORDER BY t.topic_last_post_time DESC';
$result = $db->sql_query_limit($sql, $limit, 0);

while ($row = $db->sql_fetchrow($result))
{
	$topic_id = $row['topic_id'];
	$forum_id = $row['forum_id'];

	// Cheat for Global Announcements on the unread-link: copied from search.php
	if (!$forum_id && !isset($g_forum_id))
	{
		$sql2 = 'SELECT forum_id
			FROM ' . FORUMS_TABLE . '
			WHERE forum_type = ' . FORUM_POST . '
				AND ' . $db->sql_in_set('forum_id', $forum_ary, false, true);
		$result2 = $db->sql_query_limit($sql2, 1);
		$g_forum_id = (int) $db->sql_fetchfield('forum_id');
		$db->sql_freeresult($result2);
		$forum_id = $g_forum_id;
	}
	else if (!$forum_id)
	{
		$forum_id = $g_forum_id;
	}

	$s_type_switch_test = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0;
	$replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
	$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id, $global_announce_list = false);
	$unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
	$folder_img = $folder_alt = $topic_type = $folder = $folder_new = '';
	switch ($row['topic_type'])
	{
		case POST_GLOBAL:
			$topic_type = $user->lang['VIEW_TOPIC_GLOBAL'];
			$folder = 'global_read';
			$folder_new = 'global_unread';
		break;
		case POST_ANNOUNCE:
			$topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT'];
			$folder = 'announce_read';
			$folder_new = 'announce_unread';
		break;
		case POST_STICKY:
			$topic_type = $user->lang['VIEW_TOPIC_STICKY'];
			$folder = 'sticky_read';
			$folder_new = 'sticky_unread';
		break;
		default:
			$topic_type = '';
			$folder = 'topic_read';
			$folder_new = 'topic_unread';
			if ($config['hot_threshold'] && $replies >= $config['hot_threshold'] && $row['topic_status'] != ITEM_LOCKED)
			{
				$folder .= '_hot';
				$folder_new .= '_hot';
			}
		break;
	}
	if ($row['topic_status'] == ITEM_LOCKED)
	{
		$topic_type = $user->lang['VIEW_TOPIC_LOCKED'];
		$folder .= '_locked';
		$folder_new .= '_locked';
	}
	if ($row['topic_posted'])
	{
		$folder .= '_mine';
		$folder_new .= '_mine';
	}
	if ($row['topic_type'] == POST_GLOBAL)
	{
		$global_announce_list[$row['topic_id']] = true;
	}
	$folder_img = ($unread_topic) ? $folder_new : $folder;
	$folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS');
	if ($row['poll_start'] && $row['topic_status'] != ITEM_MOVED)
	{
		$topic_type = $user->lang['VIEW_TOPIC_POLL'];
	}
	$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $forum_id . '&t=' . $topic_id);
	$view_forum_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id);
	$topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $forum_id)) ? true : false;
	$posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $forum_id)) ? true : false;
	$u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&t=$topic_id", true, $user->session_id) : '';
	$s_type_switch = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0;
	$template->assign_block_vars('recenttopicrow', array(
		'FORUM_ID'					=> $forum_id,
		'TOPIC_ID'					=> $topic_id,
		'TOPIC_AUTHOR_FULL'			=> get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
		'FIRST_POST_TIME'			=> $user->format_date($row['topic_time']),
		'LAST_POST_SUBJECT'			=> censor_text($row['topic_last_post_subject']),
		'LAST_POST_TIME'			=> $user->format_date($row['topic_last_post_time']),
		'LAST_VIEW_TIME'			=> $user->format_date($row['topic_last_view_time']),
		'LAST_POST_AUTHOR'			=> get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
		'LAST_POST_AUTHOR_COLOUR'	=> get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
		'LAST_POST_AUTHOR_FULL'		=> get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
		'PAGINATION'		=> topic_generate_pagination($replies, $view_topic_url),
		'REPLIES'			=> $replies,
		'VIEWS'				=> $row['topic_views'],
		'TOPIC_TITLE'		=> censor_text($row['topic_title']),
		'FORUM_NAME'		=> $row['forum_name'],
		'TOPIC_TYPE'		=> $topic_type,
		'TOPIC_FOLDER_IMG'		=> $user->img($folder_img, $folder_alt),
		'TOPIC_FOLDER_IMG_SRC'	=> $user->img($folder_img, $folder_alt, false, '', 'src'),
		'TOPIC_FOLDER_IMG_ALT'	=> $user->lang[$folder_alt],
		'NEWEST_POST_IMG'		=> $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
		'TOPIC_ICON_IMG'		=> (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '',
		'TOPIC_ICON_IMG_WIDTH'	=> (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '',
		'TOPIC_ICON_IMG_HEIGHT'	=> (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '',
		'ATTACH_ICON_IMG'		=> ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
		'UNAPPROVED_IMG'		=> ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '',
		'S_TOPIC_TYPE'			=> $row['topic_type'],
		'S_USER_POSTED'			=> (isset($row['topic_posted']) && $row['topic_posted']) ? true : false,
		'S_UNREAD_TOPIC'		=> $unread_topic,
		'S_TOPIC_REPORTED'		=> (!empty($row['topic_reported']) && $auth->acl_get('m_report', $forum_id)) ? true : false,
		'S_TOPIC_UNAPPROVED'	=> $topic_unapproved,
		'S_POSTS_UNAPPROVED'	=> $posts_unapproved,
		'S_HAS_POLL'			=> ($row['poll_start']) ? true : false,
		'S_POST_ANNOUNCE'		=> ($row['topic_type'] == POST_ANNOUNCE) ? true : false,
		'S_POST_GLOBAL'			=> ($row['topic_type'] == POST_GLOBAL) ? true : false,
		'S_POST_STICKY'			=> ($row['topic_type'] == POST_STICKY) ? true : false,
		'S_TOPIC_LOCKED'		=> ($row['topic_status'] == ITEM_LOCKED) ? true : false,
		'S_TOPIC_MOVED'			=> ($row['topic_status'] == ITEM_MOVED) ? true : false,
		'U_NEWEST_POST'			=> $view_topic_url . '&view=unread#unread',
		'U_LAST_POST'			=> $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'],
		'U_LAST_POST_AUTHOR'	=> get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
		'U_TOPIC_AUTHOR'		=> get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
		'U_VIEW_TOPIC'			=> $view_topic_url,
		'U_VIEW_FORUM'			=> $view_forum_url,
		'U_MCP_REPORT'			=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=reports&f=' . $forum_id . '&t=' . $topic_id, true, $user->session_id),
		'U_MCP_QUEUE'			=> $u_mcp_queue,
		'S_TOPIC_TYPE_SWITCH'	=> ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test,
	));
}
$db->sql_freeresult($result);

$topic_counter = 0;
if (count($topic_ary) > $limit)
{
	$sql = 'SELECT t.topic_id
		FROM ' . TOPICS_TABLE . ' t
		LEFT JOIN ' . FORUMS_TABLE . ' f
			ON f.forum_id = t.forum_id
		WHERE (
				f.forum_recent_topics = 1
				' . (($onlyforum) ? ' AND ' . $db->sql_in_set('t.forum_id', $onlyforum_ary) : '') . '
				AND ' . $db->sql_in_set('t.topic_id', $rt_anti_topics, true) . '
				AND ' . $db->sql_in_set('t.forum_id', $forum_ary, false, true) . '
				AND t.topic_approved <> ' . POST_DRAFT . '
			)
			OR (t.topic_type = ' . POST_GLOBAL . ' AND t.topic_approved <> ' . POST_DRAFT . '
		GROUP BY t.topic_last_post_id';
	$result = $db->sql_query($sql);
	while ($row = $db->sql_fetchrow($result))
	{
		$topic_counter++;
	}
	$db->sql_freeresult($result);
}

$topic_counter = ($page_limit < $topic_counter) ? $page_limit : $topic_counter;
$template->assign_vars(array(
	'RT_DISPLAY'			=> true,
	'NEWEST_POST_IMG'		=> $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
	'PAGE_NUMBER'			=> on_page($topic_counter, $limit, $start),
	'PAGINATION'			=> generate_pagination(append_sid("{$phpbb_root_path}index.$phpEx"), $topic_counter, $limit, $start),
));
?>
Your portal mod should work ok with this mod because it already limits the topics it selects to those with topic_approved == 1. And I gather dutchtoxophilite is using the portal mod and has confirmed that it does not list topics that are just drafts (see http://www.phpbb.com/community/viewtopi ... #p10296235 ).
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: adapting recent topic and portal mods to this mod...

Post by asinshesq »

asinshesq wrote:Your portal mod should work ok with this mod because it already limits the topics it selects to those with topic_approved == 1. And I gather dutchtoxophilite is using the portal mod and has confirmed that it does not list topics that are just drafts (see http://www.phpbb.com/community/viewtopi ... #p10296235 ).
It may be that the place where you saw a draft comes from your recenttopics mod rather than your portal mod. Or perhaps there are other files in the portal mod that look up posts or topics and maybe the problem in in those files?
Last edited by asinshesq on Fri Jul 24, 2009 2:03 pm, edited 1 time in total.
NicksNet
Registered User
Posts: 55
Joined: Sat Apr 04, 2009 1:16 pm

Re: Save full drafts

Post by NicksNet »

thanks for funtcions_recenttopics.php but now i have a sql-error:

Code: Select all

SQL ERROR [ mysql4 ]

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP BY t.topic_last_post_id ORDER BY t.topic_last_post_time DESC LIMIT' at line 13 [1064]

SQL

SELECT t.topic_id FROM phpbb_topics t LEFT JOIN phpbb_forums f ON f.forum_id = t.forum_id WHERE ( f.forum_recent_topics = 1 AND t.topic_id <> '0' AND t.forum_id IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 37) AND t.topic_approved <> 2 ) OR (t.topic_type = 3 AND t.topic_approved <> 2 GROUP BY t.topic_last_post_id ORDER BY t.topic_last_post_time DESC LIMIT 6

BACKTRACE

FILE: includes/db/mysql.php
LINE: 174
CALL: dbal_mysql->sql_error()

FILE: includes/db/mysql.php
LINE: 221
CALL: dbal_mysql->sql_query()

FILE: includes/db/dbal.php
LINE: 170
CALL: dbal_mysql->_sql_query_limit()

FILE: includes/functions_recenttopics.php
LINE: 77
CALL: dbal_mysql->sql_query_limit()

FILE: index.php
LINE: 300
CALL: include('includes/functions_recenttopics.php')
Sorry, my English isn't the best...
NicksNet
Registered User
Posts: 55
Joined: Sat Apr 04, 2009 1:16 pm

Re: adapting recent topic and portal mods to this mod...

Post by NicksNet »

asinshesq wrote: It may be that the place where you saw a draft comes from your recenttopics mod rather than your portal mod. Or perhaps there are other files in the portal mod that look up posts or topics and maybe the problem in in those files?

i think this one can be such a file?
Attachments
portal.php
/root/portal.php
(12.49 KiB) Downloaded 51 times
Sorry, my English isn't the best...
Locked

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