UBB.Dev
A minor hack request... I need the exact same thing as here: https://www.ubbdev.com/ubbcgi/ultimatebb.cgi?ubb=get_topic&f=3&t=000539 , only now for 6.3.1. wink

http://community.infopop.net/2/OpenTopic?a=tpc&s=729094322&f=5733071413&m=4013076036 also has some clues...

Any takers?
OK, I'll bite here..

(HOW LONG has it been since I posted at UBBDev??? smile )

Try:
in ubb_new_reply.cgi (circa line 403 in 6.3.1)
# grab last post
@rev_this_topic = reverse(@this_topic);
@last_post = split (/||/, $rev_this_topic[0]);
$last_post_num = $last_post[1];
$last_post_num++;

ADD right AFTER it:
if ($username eq $lastpost[2]) {
&StandardHTML("You cannot reply to this thread again until someone else does.");
}

Should be all you need. (NOTE: StandardHTML calls exit internally so you don't need it again)

(I tried to make it obvious enough over at community without spelling it out.. smile )

Graeme
Doh! Thanks...

Ok, how about expanding on this, if possible, while we're at it. (You didn't think you'd get off so easy, did you? laugh )

Can you insert a timer somewhere that WOULD allow someone to reply to their own post, but only after a certain amount of time passed? Say, 24 hrs... Which would essentially allow one bump every 24 hours. If this would be possible, our users would be overjoyed. Not to mention me. tipsy
Anyone? Come on people, I haven't posted a request here yet that someone couldn't hack together... Don't disappoint me. smile
It might help if you posts requests in the requests forum, moving there.
Quote
Originally posted by Graeme:

OK, I'll bite here..

(HOW LONG has it been since I posted at UBBDev??? smile )

Try:
in ubb_new_reply.cgi (circa line 403 in 6.3.1)
# grab last post
@rev_this_topic = reverse(@this_topic);
@last_post = split (/||/, $rev_this_topic[0]);
$last_post_num = $last_post[1];
$last_post_num++;

ADD right AFTER it:
if ($username eq $lastpost[2]) {
&StandardHTML("You cannot reply to this thread again until someone else does.");
}

Should be all you need. (NOTE: StandardHTML calls exit internally so you don't need it again)

(I tried to make it obvious enough over at community without spelling it out.. smile )

Graeme
Any idea why this wouldn't work in 6.7.x?
Would like to also see some sort of timer for this. But lets make it admin panel configurable.

Can someone copy this to the request forum?
done smile er, copied to request forum smile
The reason $lastpost[2] prolly doesn't work is because it should probably be:

$last_post[2]

I'll try it later and report back tipsy
Well, I see getting a timer hasn't progressed anywhere over the years, but I'd still very much like to see it in...

How about at least being able to specify forums where this restriction wouldn't apply; i.e. where people could reply to their own posts freely? Can someone add that?
Anyone? Pretty please?
I only had a little time to write this, and even less time to test, but give this a shot.

In ubb_new_reply.cgi
Find:
Code
	@last_post      = split (/||/, $rev_this_topic[0]);
$last_post_num = $last_post[1];
Add after:
Code
	# Minutes after first reply before we allow a second
# Set to 0 to disable time constraints
my $time_to_allow_spam = 60;
my $allow_staff_bypass = true;

if(
( $last_post[11] eq $user_number ) &&
!( (&is_admin_or_mod($in{f}, @user_profile) eq 'true') && ($allow_staff_bypass == true) )
)
{
# Last post was made by same account as this user
if( $time_to_allow_spam > 0 )
{
$that_unix = &ConvertPostTimeToUnixEpoch( $last_post[3], $last_post[4] );
if( ($GotTime{CurrentEpoch} - ($time_to_allow_spam * 60)) < $that_unix )
{
&StandardHTML("I'm sorry, but you cannot make another post without someone replying first, or until $time_to_allow_spam minutes have passed");
}
}
else
{
&StandardHTML("I'm sorry, but you cannot make another post without someone replying first.");
}
}
# End no double post mod
I added an option to allow staff members to bypass the bump thing, as well as added a timer. I hope this works
That's great... I'll try it tomorrow as I'm off to bed now.

Could you also add being able to specify forums where this restriction wouldn't apply; i.e. where people could reply to their own posts freely?
Code
	# Begin no double post mod

# Minutes after first reply before we allow a second
# Set to 0 to disable time constraints
my $time_to_allow_spam = 60;
my $allow_staff_bypass = true;

if(
( $last_post[11] eq $user_number ) &&
!( (&is_admin_or_mod($in{f}, @user_profile) eq 'true') && ($allow_staff_bypass == true) )
&& ($in{f} !~ /^(1|3|23)$/i )
)
{
# Last post was made by same account as this user
if( $time_to_allow_spam > 0 )
{
$that_unix = &ConvertPostTimeToUnixEpoch( $last_post[3], $last_post[4] );
if( ($GotTime{CurrentEpoch} - ($time_to_allow_spam * 60)) < $that_unix )
{
&StandardHTML("I'm sorry, but you cannot make another post without someone replying first, or until $time_to_allow_spam minutes have passed");
}
}
else
{
&StandardHTML("I'm sorry, but you cannot make another post without someone replying first.");
}
}

# End no double post mod
Replace "1|3|23" with the numbers of all the forums you want to bypass this filter. Make sure to seperate them with a | (pipe)
You're a legend Ian, I'll try it out ASAP.
Actually, heh... what was originally posted in this thread (in 2002) never worked. I was looking through my files and noticed that I installed this instead:

Code
##################################################
# Title: No Double Posting by Username or IP Hack
# Author: Ben (Phoenix-Flame/PF)
# Email: [email protected]
# Date: 6th April 2002
#
#
# Files Modified:
# ubb_new_reply.cgi
# vars_wordlets_err.cgi
#
# Disclaimer:
# Simple: You can't blame/sue me for anything whilst using (or trying to use) this hack.
###########################

#############
#
# In vars_wordlets_err.cgi
#
# Find:
##

invalid_number => "You have entered a value that is not a number for:",

##
# Add these after it
##

double_post_user => "Sorry, we do not allow double posting, please use the edit button to add to your previous message.",
double_post_ip => "Sorry, someone using the same IP address as you was the last person to post in this message",

##
# Save and Upload
##############

#############
#
# In ubb_new_reply.cgi
#
# Find:

if ($vars_misc{FloodCheck} eq 'ON') {
# floodcheck courtesy of Michael Farris
chomp($user_profile[8]);
&floodcheck unless (($user_profile[8] eq 'Administrator') &#0124;&#0124; ($user_profile[8] eq 'MegaModerator') &#0124;&#0124; ($user_profile[8] eq 'Moderator'));
}

##
# or (if MegaMod hack isn't installed)
##

if ($vars_misc{FloodCheck} eq 'ON') {
# floodcheck courtesy of Michael Farris
chomp($user_profile[8]);
&floodcheck unless (($user_profile[8] eq 'Administrator') &#0124;&#0124; ($user_profile[8] eq 'Moderator'));
}

##
# Add this afterwards (remove the MegaMod part if you dont have the MegaMod hack installed)
##

# grab topic (a bit earlier now) ;)
@this_topic = &OpenTopic($in{t}, $in{f});

# grab last post (a bit earlier now) ;)
@rev_this_topic = reverse(@this_topic);
@last_post = split(/||/, $rev_this_topic[0]);

if ($username eq $last_post[2])
{
&StandardHTML("$vars_wordlets_err{double_post_user}") unless (($user_profile[8] eq 'Administrator') &#0124;&#0124; ($user_profile[8] eq 'MegaModerator') &#0124;&#0124; ($user_profile[8] eq 'Moderator') &#0124;&#0124; (length($last_post[6]) > 10000));
} else {
if ($ip_number eq $last_post[7])
{
&StandardHTML("$vars_wordlets_err{double_post_ip}") unless (($user_profile[8] eq 'Administrator') &#0124;&#0124; ($user_profile[8] eq 'MegaModerator') &#0124;&#0124; ($user_profile[8] eq 'Moderator'));
}
}

##
# Find and Remove
##

# grab topic
@this_topic = &OpenTopic($in{t}, $in{f});

##
# Find and Remove
##

# grab last post
@rev_this_topic = reverse(@this_topic);
@last_post = split(/||/, $rev_this_topic[0]);

##
# Save and Upload
##############

# And you're all done
Which works for 6.3 all the way up to the latest (you just remove some more code now). I only modified it for my own use to remove the IP check (and MegaMod and post length stuff), because it did more harm than good. It actually let people reply to their own posts from time to time, so I took it out and no problems since.

Does this change anything? I notice that this older mod removes 2 more chunks of code than yours Ian... but then it also goes in differently. I don't need the text in wordlets or anything, just wondering. smile
Ian?
it almost definitely changes it, try undoing that and installing my code
Actually, I was just wondering about the 2 extra chunks of code in the file modified by the old hack, but not by your own. This is what I meant:

### Find and Remove###
grab topic@this_topic = &OpenTopic($in{t}, $in{f});

### Find and Remove###
grab last post@rev_this_topic = reverse(@this_topic);@last_post = split(/||/, $rev_this_topic[0]);

--

I'm installing your hack now, just wondering what that was for in the old one, since I noticed you don't touch that in your hack.
it just seems that the previous person was moving things around, as those lines were apparently added back in other steps.
Ah, thanks. I hope to finally get around to applying this hack today, this week has been unbelievable... every time I sat down to do something, I ended up having to do something completely other, until I had no time left. smirk
Installed, and working perfectly, as far as I can see. Thanks a bunch! smile
Btw, would a time limit larger than one day present any problems or anything? I have it at 1440 minutes now (24 hours), but might extend it, so I'm wondering.
I'd say in 99.9% it shouldn't cause any problem.
© UBB.Developers