Bumping a topic

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Ideas Centre
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
Locked
User avatar
Jessica
Former Team Member
Posts: 4341
Joined: Sun Jul 18, 2010 2:53 pm
Location: Pennsylvania, USA
Name: Jessica
Contact:

Bumping a topic

Post by Jessica » Wed Apr 06, 2011 2:29 am

I have a general question on bumping a topic. I have it set so that you can bump your topic every 10 days, but only one time. Once you've bumped your topic, you can't do it again.

How do I make it so that you can bump it as many times as you want within the limit (10 days)?
Please do not PM me for support unless it is absolutely necessary
Pro-choice, Atheist, Pro-LGBT rights

Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid. - Albert Einstein

User avatar
Pony99CA
Registered User
Posts: 4783
Joined: Thu Sep 30, 2004 3:13 pm
Location: Hollister, CA
Name: Steve
Contact:

Re: Bumping a topic

Post by Pony99CA » Wed Apr 06, 2011 9:04 am

If you want people to be able to bump more frequently than once every 10 days, just set the bump limit lower. The whole point of the bump limit is to prevent people from constantly bumping the topic.

Also, somewhat bizarrely, only the last person to post in a topic is able to bump it. I think that anybody should be able to bump a topic to prevent junk posts like "I'd like to hear the answer, too."

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.

User avatar
Jessica
Former Team Member
Posts: 4341
Joined: Sun Jul 18, 2010 2:53 pm
Location: Pennsylvania, USA
Name: Jessica
Contact:

Re: Bumping a topic

Post by Jessica » Sat Apr 16, 2011 2:42 pm

okay I changed the bump limit but I can't bump a thread I've already bump. so apparently you can't do that? Once you bump a thread, you can't bump it again? :/
Please do not PM me for support unless it is absolutely necessary
Pro-choice, Atheist, Pro-LGBT rights

Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid. - Albert Einstein

User avatar
Pony99CA
Registered User
Posts: 4783
Joined: Thu Sep 30, 2004 3:13 pm
Location: Hollister, CA
Name: Steve
Contact:

Re: Bumping a topic

Post by Pony99CA » Sat Apr 16, 2011 7:02 pm

jesschen wrote:okay I changed the bump limit but I can't bump a thread I've already bump. so apparently you can't do that? Once you bump a thread, you can't bump it again? :/
That would be strange. I would hope that you could bump again as long as the bump limit had expired again.

UPDATE: OK, I've just looked at the bump_topic_allowed function in \includes\functions_content.php:

Code: Select all

function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_poster, $last_topic_poster)
{
	global $config, $auth, $user;

	// Check permission and make sure the last post was not already bumped
	if (!$auth->acl_get('f_bump', $forum_id) || $topic_bumped)
	{
		return false;
	}

	// Check bump time range, is the user really allowed to bump the topic at this time?
	$bump_time = ($config['bump_type'] == 'm') ? $config['bump_interval'] * 60 : (($config['bump_type'] == 'h') ? $config['bump_interval'] * 3600 : $config['bump_interval'] * 86400);

	// Check bump time
	if ($last_post_time + $bump_time > time())
	{
		return false;
	}

	// Check bumper, only topic poster and last poster are allowed to bump
	if ($topic_poster != $user->data['user_id'] && $last_topic_poster != $user->data['user_id'])
	{
		return false;
	}

	// A bump time of 0 will completely disable the bump feature... not intended but might be useful.
	return $bump_time;
}
The first IF statement checks to see if you don't have permission to bump or the topic was previously bumped. So it seems that a topic can only be bumped once. If you change that IF statement to the following, you should be able to bump multiple times:

Code: Select all

if (!$auth->acl_get('f_bump', $forum_id))
More about that later....

The second IF statement checks to ensure that you're not bumping too early. The final IF statement prevents anybody but the topic starter and the last person who posted from bumping. If you want to allow anybody to bump, replace the RETURN statement with the following:

Code: Select all

// return false;
You could delete the entire IF statement, but this makes it easier to undo.

If you make the first edit, you might be worried that somebody could bump as often as they wanted after bump interval had passed. However, if you look in posting.php, you'll see the following:

Code: Select all

if ($mode == 'bump')
{
	if ($bump_time = bump_topic_allowed($forum_id, $post_data['topic_bumped'], $post_data['topic_last_post_time'], $post_data['topic_poster'], $post_data['topic_last_poster_id'])
	   && check_link_hash(request_var('hash', ''), "topic_{$post_data['topic_id']}"))
	{
		$db->sql_transaction('begin');

		$sql = 'UPDATE ' . POSTS_TABLE . "
			SET post_time = $current_time
			WHERE post_id = {$post_data['topic_last_post_id']}
				AND topic_id = $topic_id";
		$db->sql_query($sql);

		$sql = 'UPDATE ' . TOPICS_TABLE . "
			SET topic_last_post_time = $current_time,
				topic_bumped = 1,
				topic_bumper = " . $user->data['user_id'] . "
			WHERE topic_id = $topic_id";
		$db->sql_query($sql);

		update_post_information('forum', $forum_id);

		$sql = 'UPDATE ' . USERS_TABLE . "
			SET user_lastpost_time = $current_time
			WHERE user_id = " . $user->data['user_id'];
		$db->sql_query($sql);

		$db->sql_transaction('commit');

		markread('post', $forum_id, $topic_id, $current_time);

		add_log('mod', $forum_id, $topic_id, 'LOG_BUMP_TOPIC', $post_data['topic_title']);

		$meta_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&p={$post_data['topic_last_post_id']}") . "#p{$post_data['topic_last_post_id']}";
		meta_refresh(3, $meta_url);

		$message = $user->lang['TOPIC_BUMPED'] . '<br /><br />' . sprintf($user->lang['VIEW_MESSAGE'], '<a href="' . $meta_url . '">', '</a>');
		$message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) . '">', '</a>');

		trigger_error($message);
	}

	trigger_error('BUMP_ERROR');
}
You can see that both the time of the last post and the time of the topic's last post are set to the current time. That should prevent bumping until another bump interval has passed.

The above changes might make a nice little update for phpBB's ACP. Besides simply controlling the bump interval, you could allow the topic to be bumped only once or more than once (and, with a few more changes, you could set a maximum number of bumps) and you could allow bumping by only the topic starter, the topic starter and last poster or anybody at all (allowing only people who have posted in the topic would require more code).

Of course, you can always just post again. ;)

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.

Cory Ander
Registered User
Posts: 65
Joined: Thu Mar 21, 2013 1:31 am

Re: Bumping a topic

Post by Cory Ander » Thu Jun 12, 2014 12:29 am

I know this is an old thread, but I just wanted to say "thank you" to pony for their suggestions. I modified the first IF statement (as per pony's post above) so that a member can bump a topic more than once. It worked a treat, thanks! :)

Locked

Return to “[3.0.x] Support Forum”

Who is online

Users browsing this forum: Yandex [Bot] and 62 guests