Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Mar 2001
Posts: 172
Member
Member
Offline
Joined: Mar 2001
Posts: 172
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?

Sponsored Links
Joined: Jan 2000
Posts: 15
Junior Member
Junior Member
Offline
Joined: Jan 2000
Posts: 15
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

Joined: Mar 2001
Posts: 172
Member
Member
Offline
Joined: Mar 2001
Posts: 172
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

Joined: Mar 2001
Posts: 172
Member
Member
Offline
Joined: Mar 2001
Posts: 172
Anyone? Come on people, I haven't posted a request here yet that someone couldn't hack together... Don't disappoint me. smile

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
It might help if you posts requests in the requests forum, moving there.


- Allen wavey
- What Drives You?
Sponsored Links
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
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?


- Allen wavey
- What Drives You?
Joined: Jun 2001
Posts: 729
Coder
Coder
Offline
Joined: Jun 2001
Posts: 729
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?

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
done smile er, copied to request forum smile


- Allen wavey
- What Drives You?
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
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


- Allen wavey
- What Drives You?
Joined: Mar 2001
Posts: 172
Member
Member
Offline
Joined: Mar 2001
Posts: 172
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?

Sponsored Links
Joined: Mar 2001
Posts: 172
Member
Member
Offline
Joined: Mar 2001
Posts: 172
Anyone? Pretty please?

Joined: Jan 2003
Posts: 3,456
Likes: 2
Master Hacker
Master Hacker
Offline
Joined: Jan 2003
Posts: 3,456
Likes: 2
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

Joined: Mar 2001
Posts: 172
Member
Member
Offline
Joined: Mar 2001
Posts: 172
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?

Joined: Jan 2003
Posts: 3,456
Likes: 2
Master Hacker
Master Hacker
Offline
Joined: Jan 2003
Posts: 3,456
Likes: 2
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)

Joined: Mar 2001
Posts: 172
Member
Member
Offline
Joined: Mar 2001
Posts: 172
You're a legend Ian, I'll try it out ASAP.

Joined: Mar 2001
Posts: 172
Member
Member
Offline
Joined: Mar 2001
Posts: 172
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

Joined: Mar 2001
Posts: 172
Member
Member
Offline
Joined: Mar 2001
Posts: 172
Ian?

Joined: Jan 2003
Posts: 3,456
Likes: 2
Master Hacker
Master Hacker
Offline
Joined: Jan 2003
Posts: 3,456
Likes: 2
it almost definitely changes it, try undoing that and installing my code

Joined: Mar 2001
Posts: 172
Member
Member
Offline
Joined: Mar 2001
Posts: 172
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.

Joined: Jan 2003
Posts: 3,456
Likes: 2
Master Hacker
Master Hacker
Offline
Joined: Jan 2003
Posts: 3,456
Likes: 2
it just seems that the previous person was moving things around, as those lines were apparently added back in other steps.

Joined: Mar 2001
Posts: 172
Member
Member
Offline
Joined: Mar 2001
Posts: 172
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

Joined: Mar 2001
Posts: 172
Member
Member
Offline
Joined: Mar 2001
Posts: 172
Installed, and working perfectly, as far as I can see. Thanks a bunch! smile

Joined: Mar 2001
Posts: 172
Member
Member
Offline
Joined: Mar 2001
Posts: 172
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.

Joined: Mar 2001
Posts: 7,394
LK Offline
Admin / Code Breaker
Admin / Code Breaker
Offline
Joined: Mar 2001
Posts: 7,394
I'd say in 99.9% it shouldn't cause any problem.


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)