php forum
php mysql forum
php mysql smarty
 
Page 1 of 2 1 2 >
Topic Options
#57953 - 07/28/02 02:41 PM [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
Gladius Offline
Member

Registered: 03/29/01
Posts: 148
A minor hack request... I need the exact same thing as here: http://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?

Top
#57954 - 07/28/02 04:08 PM Re: [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
Graeme Offline
Junior Member

Registered: 01/05/00
Posts: 10
Loc: Canada
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

Top
#57955 - 07/28/02 05:10 PM Re: [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
Gladius Offline
Member

Registered: 03/29/01
Posts: 148
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

Top
#57956 - 07/29/02 03:09 PM Re: [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
Gladius Offline
Member

Registered: 03/29/01
Posts: 148
Anyone? Come on people, I haven't posted a request here yet that someone couldn't hack together... Don't disappoint me. smile

Top
#57957 - 07/29/02 03:56 PM Re: [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
AllenAyres Administrator Offline
I type Like navaho

Registered: 03/10/00
Posts: 25448
Loc: Texas
It might help if you posts requests in the requests forum, moving there.
_________________________
- Allen wavey
- What Drives You?

Top
#57958 - 01/29/05 10:03 PM Re: [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
AllenAyres Administrator Offline
I type Like navaho

Registered: 03/10/00
Posts: 25448
Loc: Texas
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?

Top
#57959 - 01/30/05 06:02 PM Re: [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
1QuickSI Offline
Coder

Registered: 06/10/01
Posts: 705
Loc: CT
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?
_________________________
...Steven
Hostboard.com
Running UBB v6.1.0.4
Doing what NO other UBB in the world is doing.
The first & only production UBB powered by MySQL.

Top
#57960 - 01/30/05 07:14 PM Re: [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
AllenAyres Administrator Offline
I type Like navaho

Registered: 03/10/00
Posts: 25448
Loc: Texas
done smile er, copied to request forum smile
_________________________
- Allen wavey
- What Drives You?

Top
#57961 - 02/01/05 07:46 PM Re: [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
AllenAyres Administrator Offline
I type Like navaho

Registered: 03/10/00
Posts: 25448
Loc: Texas
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?

Top
#57962 - 06/28/05 08:54 AM Re: [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
Gladius Offline
Member

Registered: 03/29/01
Posts: 148
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?

Top
#57963 - 06/30/05 02:58 PM Re: [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
Gladius Offline
Member

Registered: 03/29/01
Posts: 148
Anyone? Pretty please?

Top
#57964 - 06/30/05 03:52 PM Re: [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
Ian Spence Offline
Master Hacker

Registered: 01/25/03
Posts: 3765
Loc: Saint Johns, PA
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
_________________________
Code monkey like Fritos

Top
#57965 - 06/30/05 07:53 PM Re: [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
Gladius Offline
Member

Registered: 03/29/01
Posts: 148
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?

Top
#57966 - 07/01/05 06:55 PM Re: [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
Ian Spence Offline
Master Hacker

Registered: 01/25/03
Posts: 3765
Loc: Saint Johns, PA
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)
_________________________
Code monkey like Fritos

Top
#57967 - 07/02/05 08:44 AM Re: [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
Gladius Offline
Member

Registered: 03/29/01
Posts: 148
You're a legend Ian, I'll try it out ASAP.

Top
#57968 - 07/02/05 10:09 AM Re: [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
Gladius Offline
Member

Registered: 03/29/01
Posts: 148
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: Phoenix-Flame@ffaddicts.com
# 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

Top
#57969 - 07/06/05 01:58 PM Re: [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
Gladius Offline
Member

Registered: 03/29/01
Posts: 148
Ian?

Top
#57970 - 07/06/05 02:33 PM Re: [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
Ian Spence Offline
Master Hacker

Registered: 01/25/03
Posts: 3765
Loc: Saint Johns, PA
it almost definitely changes it, try undoing that and installing my code
_________________________
Code monkey like Fritos

Top
#57971 - 07/06/05 03:59 PM Re: [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
Gladius Offline
Member

Registered: 03/29/01
Posts: 148
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.

Top
#57972 - 07/06/05 08:09 PM Re: [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
Ian Spence Offline
Master Hacker

Registered: 01/25/03
Posts: 3765
Loc: Saint Johns, PA
it just seems that the previous person was moving things around, as those lines were apparently added back in other steps.
_________________________
Code monkey like Fritos

Top
#57973 - 07/07/05 06:10 AM Re: [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
Gladius Offline
Member

Registered: 03/29/01
Posts: 148
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

Top
#57974 - 07/08/05 08:38 PM Re: [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
Gladius Offline
Member

Registered: 03/29/01
Posts: 148
Installed, and working perfectly, as far as I can see. Thanks a bunch! smile

Top
#57975 - 07/08/05 08:46 PM Re: [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
Gladius Offline
Member

Registered: 03/29/01
Posts: 148
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.

Top
#57976 - 07/12/05 07:56 PM Re: [6.3.x] [beta] Preventing Users to Reply to Their Own Posts
LK Offline
Admin / Code Breaker

Registered: 03/24/01
Posts: 7396
I'd say in 99.9% it shouldn't cause any problem.
_________________________

My Hacks Page (will be back with UBB 7!)
UBBDev - We put the class into UBB.classic!

Top
Page 1 of 2 1 2 >


Moderator:  Gizmo 
Who's Online
0 registered (), 31 Guests and 16 Spiders online.
Key: Admin, Global Mod, Mod
Shout Box

Latest Posts
Forum 'Trader Ratings'.
by blaaskaak
11/20/08 08:27 AM
Problems reading a lot of old posts here
by Ruben Rocha
11/18/08 04:33 PM
PhotoPost BB Code Popup
by Iann128
11/15/08 01:24 PM
Customization needed
by Gizmo
11/12/08 12:28 PM
Team UBBDev Rides Again!
by AllenAyres
11/11/08 02:16 PM
Active Topics.
by AllenAyres
11/11/08 02:13 PM
Looking for a simple upload script
by AllenAyres
11/11/08 02:12 PM
New Mods
Forum 'Trader Ratings'.
by McLemore
11/19/08 02:14 PM
[7.4] Keep log of custom title changes
by blaaskaak
10/27/08 07:51 AM
User Authentication Class
by
01/19/07 02:59 PM
Multiple Identity Detector
by
12/30/06 06:39 PM
PhotoPost BB Code Popup
by
11/06/06 05:43 PM
Newest Members
Begbie, cenk, MATTO, DougMMcts, tim Anderson
13361 Registered Users