Welcome, Guest. Please Login or Register.
May 14, 2025, 09:25:35 PM
Home Help Search Log in Register
News: If you are still using YaBB SE, please consider upgrading to SMF as soon as possible.

YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Single reply aloowed per user on topic « previous next »
Pages: [1] Reply Ignore Print
Author Topic: Single reply aloowed per user on topic  (Read 1988 times)
DVS
Noobie
*
Posts: 28


WWW
Single reply aloowed per user on topic
« on: August 22, 2003, 10:26:43 AM »
Reply with quote

I'd like to see a mod that will allow a user to reply to a topic only once.  This would come in handy for contest-related posts to allow a user to only enter once to register.

Thanks!

Anthony
Logged

Digital Vision Syndicate - www.dvsyndicate.com
Detroit Electronic Expo - www.detroitelectronic.com
Detroit Entertainment - www.detroitentertainment.tv
Grudge
Global Moderator
Full Member
*****
Posts: 178


Damn llama's don't like me :(

Re:Single reply aloowed per user on topic
« Reply #1 on: August 23, 2003, 11:14:56 PM »
Reply with quote

This is only a very basic guideline but in something like post() in post.php add:

$result = mysql_query("SELECT ID_MSG FROM {$db_prefix}messages WHERE ID_TOPIC = $threadid LIMIT 1") or database_error(__FILE__, __LINE__ );

if(mysql_num_rows($result))
fatal_error("You have already had your one post in this thread")

This should pretty much work (albeit with maybe a spelling error or two). I'm sure you can make it work from here ;)
Logged
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:Single reply aloowed per user on topic
« Reply #2 on: August 24, 2003, 02:19:01 AM »
Reply with quote

Might add AND ID_MEMBER = $ID_MEMBER to that.

-[Unknown]
Logged
Grudge
Global Moderator
Full Member
*****
Posts: 178


Damn llama's don't like me :(

Re:Single reply aloowed per user on topic
« Reply #3 on: August 24, 2003, 08:20:02 PM »
Reply with quote

LOL. Can't believe I missed that! doh!

As Unknown said it should become:

$result = mysql_query("SELECT ID_MSG FROM {$db_prefix}messages WHERE ID_TOPIC = $threadid AND ID_MEMBER=$ID_MEMBER LIMIT 1") or database_error(__FILE__, __LINE__ );
Logged
DVS
Noobie
*
Posts: 28


WWW
Re:Single reply aloowed per user on topic
« Reply #4 on: August 26, 2003, 10:06:53 AM »
Reply with quote

Thanks a bunch, but I assume that changing this will affect ALL the boards when using post, correct?

A
Logged

Digital Vision Syndicate - www.dvsyndicate.com
Detroit Electronic Expo - www.detroitelectronic.com
Detroit Entertainment - www.detroitentertainment.tv
Grudge
Global Moderator
Full Member
*****
Posts: 178


Damn llama's don't like me :(

Re:Single reply aloowed per user on topic
« Reply #5 on: August 26, 2003, 08:24:46 PM »
Reply with quote

Yes you are correct. You can do one of two things to make it applicable only on certain threads. The easy way:

Set a whole board where you can only make one reply per thread and HARD CODE the board ID into the code. IE - if board number 3 should only allow one reply per topic use:

$result = mysql_query("SELECT m.ID_MSG FROM {$db_prefix}messages As m
LEFT JOIN {$db_prefix}topics AS t ON (t.ID_TOPIC = m.ID_TOPIC) WHERE m.ID_TOPIC = $threadid AND m.ID_MEMBER=$ID_MEMBER AND t.ID_BOARD = 3 LIMIT 1") or database_error(__FILE__, __LINE__ );

(I think the join is necessary unless messages contains ID_BOARD (Which I don't think it does).

The harder but better way is probably to add a column to the topics table, for arguments sake called CAN_MASS_REPLY - default 1.

Then just use:
$result = mysql_query("SELECT m.ID_MSG FROM {$db_prefix}messages As m
LEFT JOIN {$db_prefix}topics AS t ON (t.ID_TOPIC = m.ID_TOPIC) WHERE m.ID_TOPIC = $threadid AND m.ID_MEMBER=$ID_MEMBER AND t.CAN_MASS_REPLY != 1 LIMIT 1") or database_error(__FILE__, __LINE__ );

Then of course you have to be able to set the value for a thread. You can either do this using phpmyadmin or make an edit box for the topic starter, obviously all this takes time :D

Another way to do it is to make it so all topics which allow one reply have the subject line starting [SINGLE] (or similar). Then do a query to get the first reply of the topic, get the subject and then strpos [SINGLE] in the subject, and if it's there check if the user has replied and if so stop them doing it again.

Lots of possibilities ranging in usefulness and easiness :D
Logged
DVS
Noobie
*
Posts: 28


WWW
Re:Single reply aloowed per user on topic
« Reply #6 on: August 28, 2003, 10:10:03 AM »
Reply with quote

Thanks again for the help   ;D

I used the first code section by hard coding the board into the string, but got this error:

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND m.ID_MEMBER= AND t.ID_BOARD = 5 LIMIT 1' at line 2

Could this be due to the fact that Im using the sub-board Mod?
Logged

Digital Vision Syndicate - www.dvsyndicate.com
Detroit Electronic Expo - www.detroitelectronic.com
Detroit Entertainment - www.detroitentertainment.tv
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Single reply aloowed per user on topic « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.162 seconds with 20 queries.