[ABD] Scheduled Posts

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
odenmc
Registered User
Posts: 49
Joined: Sat Apr 24, 2010 1:44 am
Contact:

Re: [BETA] Scheduled Posts

Post by odenmc »

Hi Tom!

Works perfect! but there is something that although not a bug, gives me problems.

Users without permissions can not see the post in the forum, but mod's as "last post" or "last topic" does appear, is there a way to fix it?
User avatar
Tom
Former Team Member
Posts: 2665
Joined: Tue Jun 20, 2006 2:12 am
Name: Tom Catullo
Contact:

Re: [BETA] Scheduled Posts

Post by Tom »

Glad to see that it's working well for you.
odenmc wrote:Users without permissions can not see the post in the forum, but mod's as "last post" or "last topic" does appear, is there a way to fix it?
I'm sorry, but could you explain the problem again please? I have an idea of what you are referring to, but I just want to make sure that I understood the issue correctly. Are you saying that the last post in a forum that contains a future topic does not show the future topic as the "last post" for moderators of that forum, or am I misunderstanding you?
Tom Catullo - Former Moderator Team Member
phpBB3 Smiley Pak Generator | Legend Repositioning MOD | My GitHub | My Site
User avatar
imkingdavid
Former Team Member
Posts: 2673
Joined: Sun Jul 26, 2009 7:59 pm
Location: EST
Name: David King

Re: [BETA] Scheduled Posts

Post by imkingdavid »

Tom wrote:Glad to see that it's working well for you.
odenmc wrote:Users without permissions can not see the post in the forum, but mod's as "last post" or "last topic" does appear, is there a way to fix it?
I'm sorry, but could you explain the problem again please? I have an idea of what you are referring to, but I just want to make sure that I understood the issue correctly. Are you saying that the last post in a forum that contains a future topic does not show the future topic as the "last post" for moderators of that forum, or am I misunderstanding you?
Actually, I think what he is saying that MODs that allow the latest topics to be shown externally will show topics that have not yet been posted. That is, unless I am misunderstanding as well.
In the scenario I presented, the issue is not with this MOD, it's with the code used to get the most recent topics. The SQL will need to be modified to make sure that the topic time has been reached. Something like

Code: Select all

$sql .= ' AND topic_time <= ' . time(); 
might do the trick to add it on to the sql, but I wouldn't know without seeing the code.
Don't forget to smile today. :)
Please do NOT contact for support via PM or email.
odenmc
Registered User
Posts: 49
Joined: Sat Apr 24, 2010 1:44 am
Contact:

Re: [BETA] Scheduled Posts

Post by odenmc »

imkingdavid wrote:
Tom wrote:Glad to see that it's working well for you.
odenmc wrote:Users without permissions can not see the post in the forum, but mod's as "last post" or "last topic" does appear, is there a way to fix it?
I'm sorry, but could you explain the problem again please? I have an idea of what you are referring to, but I just want to make sure that I understood the issue correctly. Are you saying that the last post in a forum that contains a future topic does not show the future topic as the "last post" for moderators of that forum, or am I misunderstanding you?
Actually, I think what he is saying that MODs that allow the latest topics to be shown externally will show topics that have not yet been posted. That is, unless I am misunderstanding as well.
In the scenario I presented, the issue is not with this MOD, it's with the code used to get the most recent topics. The SQL will need to be modified to make sure that the topic time has been reached. Something like

Code: Select all

$sql .= ' AND topic_time <= ' . time(); 
might do the trick to add it on to the sql, but I wouldn't know without seeing the code.
Exactly! that's it.

Sorry for I did not explain better, my English leaves much to be desired.

As you said "imkingdavid" certainly is a problem with the other MOD's and not of this, I will try to modify the other MOD's and see if I can adapt to this.


Thanks!
User avatar
Tom
Former Team Member
Posts: 2665
Joined: Tue Jun 20, 2006 2:12 am
Name: Tom Catullo
Contact:

Re: [BETA] Scheduled Posts

Post by Tom »

imkingdavid wrote:The SQL will need to be modified to make sure that the topic time has been reached. Something like

Code: Select all

$sql .= ' AND topic_time <= ' . time(); 
might do the trick to add it on to the sql, but I wouldn't know without seeing the code.
Yes, that would correctly fix this issue. That is the same method which I employed in the development of this MOD for leaving out "future" posts when determining the last post of a given forum. Thanks for clarifying this for me.
Tom Catullo - Former Moderator Team Member
phpBB3 Smiley Pak Generator | Legend Repositioning MOD | My GitHub | My Site
odenmc
Registered User
Posts: 49
Joined: Sat Apr 24, 2010 1:44 am
Contact:

Re: [BETA] Scheduled Posts

Post by odenmc »

Just a line to say that I made the correction and it worked perfectly, thanks!
odenmc
Registered User
Posts: 49
Joined: Sat Apr 24, 2010 1:44 am
Contact:

Re: [BETA] Scheduled Posts

Post by odenmc »

Congratulations, Tom, for the great job you've done with this mod, I can only give you many many thank you very much and all my congratulations.

There is one thing I do not know if it will change, other users, even if they have permits, they can not see future topics of other users, Is there any way to change this? Although it is not something that is really necessary.
User avatar
Tom
Former Team Member
Posts: 2665
Joined: Tue Jun 20, 2006 2:12 am
Name: Tom Catullo
Contact:

Re: [BETA] Scheduled Posts

Post by Tom »

I'm glad that you are finding this MOD very useful, and I hope others will as well. :)

If you want to allow a user to view the future topics of other users, there is a Moderator permission that is added by this MOD. It must be assigned on a per-forum basis and it can be assigned to either groups or specific users. When you go to set Moderator permissions for a user/group in a forum, this option should be in the "Misc" tab: Can view future scheduled posts before specified post date. Make sure that is set to Yes for the user/group that you want to be able to view future topics. If that still isn't working or if you need further assistance, please let me know and I'll be happy to help.
Tom Catullo - Former Moderator Team Member
phpBB3 Smiley Pak Generator | Legend Repositioning MOD | My GitHub | My Site
odenmc
Registered User
Posts: 49
Joined: Sat Apr 24, 2010 1:44 am
Contact:

Re: [BETA] Scheduled Posts

Post by odenmc »

Hello Tom!

Even with permission, other users with permissions can not see future topics. Any idea? :P
User avatar
Lisbon
Registered User
Posts: 825
Joined: Wed Jan 30, 2008 12:28 pm
Location: Zermatt

Re: [BETA] Scheduled Posts

Post by Lisbon »

Sorry the question, but when came this mod a RC? I whant install this very useful MOD in my live forum but i whait the version RC
User avatar
Tom
Former Team Member
Posts: 2665
Joined: Tue Jun 20, 2006 2:12 am
Name: Tom Catullo
Contact:

Re: [BETA] Scheduled Posts

Post by Tom »

This MOD has actually been submitted to the MOD Database and is under validation. Once the validation is finished, it will be released as a stable version (1.0.0) to the public in the MOD Database. Depending on how validation goes, it shouldn't take more than a week or two more for it to be released (but anything can happen). ;)
odenmc wrote:Hello Tom!

Even with permission, other users with permissions can not see future topics. Any idea? :P
It works fine for me on the demo board. Are you sure that the user has permission to view future posts in that specific forum? I can't really think of what else could be the issue since it has always worked just fine for me. Is this occurring on a page where you have another MOD installed that lists the latest topics, like what imkingdavid mentioned earlier, and future topics are not being listed for users with permissions?
Tom Catullo - Former Moderator Team Member
phpBB3 Smiley Pak Generator | Legend Repositioning MOD | My GitHub | My Site
PDD_20
Registered User
Posts: 154
Joined: Mon May 19, 2008 3:53 pm
Location: Spain
Contact:

Re: [BETA] Scheduled Posts

Post by PDD_20 »

Is it normal that index.php do 66 queries mysql?

Thanks
User avatar
imkingdavid
Former Team Member
Posts: 2673
Joined: Sun Jul 26, 2009 7:59 pm
Location: EST
Name: David King

Re: [BETA] Scheduled Posts

Post by imkingdavid »

PDD_20 wrote:Is it normal that index.php do 66 queries mysql?

Thanks
That depends on how many MODs you have installed. If I recall correctly, a clean phpBB install has roughly 20 queries by default. As you add more MODs, this may increase.
Don't forget to smile today. :)
Please do NOT contact for support via PM or email.
PDD_20
Registered User
Posts: 154
Joined: Mon May 19, 2008 3:53 pm
Location: Spain
Contact:

Re: [BETA] Scheduled Posts

Post by PDD_20 »

imkingdavid wrote:
PDD_20 wrote:Is it normal that index.php do 66 queries mysql?

Thanks
That depends on how many MODs you have installed. If I recall correctly, a clean phpBB install has roughly 20 queries by default. As you add more MODs, this may increase.
I only had 8 more o less queries, but now after install Scheduled Posts, I have 60.

The queries are in this code:

Code: Select all

**
* Get the true last post information for a forum (excluding future topics)
*
* @param array $old_row Original 'last post' information for a forum
*
* @return array The true last post information for a forum
*/
function check_future_date(&$old_row)
{
	global $db;

	$forum_ids_collector = $true_row = array();

	// Get forum_id's of all subforums of the forum being checked
	$sql = 'SELECT forum_id
		FROM ' . FORUMS_TABLE . '
		WHERE (left_id > ' . (int) $old_row['left_id'] . '
			AND right_id < ' . (int) $old_row['right_id'] . ')
			OR forum_id = ' . (int) $old_row['forum_id'];
	$result = $db->sql_query($sql);
	$forum_ids = $db->sql_fetchrowset($result);
	$db->sql_freeresult($result);

	// Place all selected forum_ids in one array
	foreach($forum_ids as $id)
	{
		$forum_ids_collector[] = $id['forum_id'];
	}

	// Get the latest post out of all these forums combined
	$sql = 'SELECT topic_last_post_id, topic_last_post_subject, topic_last_post_time, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour
		FROM ' . TOPICS_TABLE . '
		WHERE ' . $db->sql_in_set('forum_id', $forum_ids_collector) . '
			AND topic_last_post_time <= ' . time() . '
			AND topic_approved = 1
		ORDER BY topic_last_post_time DESC';
	$result = $db->sql_query_limit($sql, 1);
	$row = $db->sql_fetchrow($result);
	$db->sql_freeresult($result);

	$true_row['forum_last_post_id'] = $row['topic_last_post_id'];
	$true_row['forum_last_post_subject'] = $row['topic_last_post_subject'];
	$true_row['forum_last_post_time'] = $row['topic_last_post_time'];
	$true_row['forum_last_poster_id'] = $row['topic_last_poster_id'];
	$true_row['forum_last_poster_name'] = $row['topic_last_poster_name'];
	$true_row['forum_last_poster_colour'] = $row['topic_last_poster_colour'];

	$final_row = array_merge($old_row, $true_row);

	return $final_row;
}

/**
* Check to see if a specific forum contains future posts
*
* @param int $forum_id Forum_id of the forum to be checked
*
* @return bool Does the forum contain future posts?
*/
function has_future_posts($forum_id)
{
	global $db;

	$sql = 'SELECT post_id
		FROM ' . POSTS_TABLE . '
		WHERE forum_id = ' . (int) $forum_id . '
			AND post_time > ' . time();
	$result = $db->sql_query_limit($sql, 1);
	$row = $db->sql_fetchrow($result);
	$db->sql_freeresult($result);

	if ($row)
	{
		return true;
	}
	else
	{
		return false;
	}
}

/**
* Check to see if there is an unread post in a forum for the current user that is NOT a future post
*
* @param int $forum_id Forum_id of the forum to be checked
* @param int $mark_time Last time the current user viewed a post in the forum
*
* @return bool Does the forum contain any new 'present' posts for this user?
*/
function new_present_posts($forum_id, $mark_time)
{
	global $db;

	$sql = 'SELECT post_id
		FROM ' . POSTS_TABLE . '
		WHERE forum_id = ' . (int) $forum_id . '
			AND post_time > ' . (int) $mark_time . '
			AND post_time <= ' . time();
	$result = $db->sql_query_limit($sql, 1);
	$row = $db->sql_fetchrow($result);
	$db->sql_freeresult($result);

	if ($row)
	{
		return true;
	}
	else
	{
		return false;
	}
}
User avatar
MichaelC
Consultant
Consultant
Posts: 3642
Joined: Mon Dec 21, 2009 3:36 pm
Location: Surrey, UK
Name: Michael Cullum
Contact:

Re: [BETA] Scheduled Posts

Post by MichaelC »

PDD_20 wrote:
imkingdavid wrote:
PDD_20 wrote:Is it normal that index.php do 66 queries mysql?

Thanks
That depends on how many MODs you have installed. If I recall correctly, a clean phpBB install has roughly 20 queries by default. As you add more MODs, this may increase.
I only had 8 more o less queries, but now after install Scheduled Posts, I have 60.

The queries are in this code:

Code: Select all

**
* Get the true last post information for a forum (excluding future topics)
*
* @param array $old_row Original 'last post' information for a forum
*
* @return array The true last post information for a forum
*/
function check_future_date(&$old_row)
{
	global $db;

	$forum_ids_collector = $true_row = array();

	// Get forum_id's of all subforums of the forum being checked
	$sql = 'SELECT forum_id
		FROM ' . FORUMS_TABLE . '
		WHERE (left_id > ' . (int) $old_row['left_id'] . '
			AND right_id < ' . (int) $old_row['right_id'] . ')
			OR forum_id = ' . (int) $old_row['forum_id'];
	$result = $db->sql_query($sql);
	$forum_ids = $db->sql_fetchrowset($result);
	$db->sql_freeresult($result);

	// Place all selected forum_ids in one array
	foreach($forum_ids as $id)
	{
		$forum_ids_collector[] = $id['forum_id'];
	}

	// Get the latest post out of all these forums combined
	$sql = 'SELECT topic_last_post_id, topic_last_post_subject, topic_last_post_time, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour
		FROM ' . TOPICS_TABLE . '
		WHERE ' . $db->sql_in_set('forum_id', $forum_ids_collector) . '
			AND topic_last_post_time <= ' . time() . '
			AND topic_approved = 1
		ORDER BY topic_last_post_time DESC';
	$result = $db->sql_query_limit($sql, 1);
	$row = $db->sql_fetchrow($result);
	$db->sql_freeresult($result);

	$true_row['forum_last_post_id'] = $row['topic_last_post_id'];
	$true_row['forum_last_post_subject'] = $row['topic_last_post_subject'];
	$true_row['forum_last_post_time'] = $row['topic_last_post_time'];
	$true_row['forum_last_poster_id'] = $row['topic_last_poster_id'];
	$true_row['forum_last_poster_name'] = $row['topic_last_poster_name'];
	$true_row['forum_last_poster_colour'] = $row['topic_last_poster_colour'];

	$final_row = array_merge($old_row, $true_row);

	return $final_row;
}

/**
* Check to see if a specific forum contains future posts
*
* @param int $forum_id Forum_id of the forum to be checked
*
* @return bool Does the forum contain future posts?
*/
function has_future_posts($forum_id)
{
	global $db;

	$sql = 'SELECT post_id
		FROM ' . POSTS_TABLE . '
		WHERE forum_id = ' . (int) $forum_id . '
			AND post_time > ' . time();
	$result = $db->sql_query_limit($sql, 1);
	$row = $db->sql_fetchrow($result);
	$db->sql_freeresult($result);

	if ($row)
	{
		return true;
	}
	else
	{
		return false;
	}
}

/**
* Check to see if there is an unread post in a forum for the current user that is NOT a future post
*
* @param int $forum_id Forum_id of the forum to be checked
* @param int $mark_time Last time the current user viewed a post in the forum
*
* @return bool Does the forum contain any new 'present' posts for this user?
*/
function new_present_posts($forum_id, $mark_time)
{
	global $db;

	$sql = 'SELECT post_id
		FROM ' . POSTS_TABLE . '
		WHERE forum_id = ' . (int) $forum_id . '
			AND post_time > ' . (int) $mark_time . '
			AND post_time <= ' . time();
	$result = $db->sql_query_limit($sql, 1);
	$row = $db->sql_fetchrow($result);
	$db->sql_freeresult($result);

	if ($row)
	{
		return true;
	}
	else
	{
		return false;
	}
}
Activate Debug Extra then click explain that should list all the sql queries with a little information like time to load ect.,
:)
Formerly known as Unknown Bliss.
Formerly Website Team Lead/Manager & Development Team.
Please don't PM me for support (or stuff that belongs in the forums or tracker) but otherwise feel free
Locked

Return to “[3.0.x] Abandoned MODs”