PDA

View Full Version : Must Have First Posters Username In Your reply form


BigJohnson
11-12-2002, 09:28 AM
I was wondering if someone can help me with this. I am looking for a feature for my message board.

People post information about quads and other 4 wheel and 2 wheel vehicles on my forum.

I was wondering if only in these forums this feature can work

13, 17, 19, 20, 26, 27, 33, 34, 44, 45, 51, 52, 58, 59

For ever reply in these forum ids you need to have the FIRST POSTERS username somewhere in your reply box. If not then you are taken to a template that I will make as an error screen. I hope someone can help me out. Thanks.

This is just for the reason that no one notices the people that post information and just read the posts. This helps them understand that this person has posted this info to help you out. Thanks s much.

Xenon
11-12-2002, 04:10 PM
open newreply.php find this:
// check for subject and message
$message=trim($message);
if ($message=="") {
eval("standarderror(\"".gettemplate("error_nosubject")."\");");
exit;
}

after that add:

if (in_array($threadinfo['forumid'], array(13, 17, 19, 20, 26, 27, 33, 34, 44, 45, 51, 52, 58, 59))) {
$getfirst=$DB_site->query_first("SELECT postid,post.userid,dateline,user.username FROM post LEFT JOIN user USING(userid) WHERE threadid='$threadid' ORDER BY dateline LIMIT 1");
if(!strstr($message,$getfirst['username'])) {
eval("standarderror(\"".gettemplate("error_nofirstusername")."\");");
}


}

then create a template error_nofirstusername and write your message there ;)

BigJohnson
11-12-2002, 10:42 PM
thanks works like a charm.

Xenon
11-13-2002, 09:38 AM
:)

you're welcome as always ;)

BigJohnson
11-24-2002, 05:40 PM
One more thing. How can I make this so it is not capitalization sensative. Like if someone name is UsErNaMe all i can type in the reply box is username instead of the other way. Please help thanks.

Xenon
11-24-2002, 06:48 PM
instead of this
if(!strstr($message,$getfirst['username'])) {

use this
if(!strstr(strtoupper($message),strtoupper($getfir st['username']))) {

BigJohnson
11-26-2002, 09:14 AM
Works like a charm amazing. Your god. I love ya. keep up the great work man.

Xenon
11-26-2002, 06:28 PM
:)
i'll do my best.

you're welcome

BigJohnson
01-26-2003, 03:16 PM
Xenon I just foudn a prob. When u reply more than once in those forums u have to say there username in ever reply u make. How do u make it that they only have to do it on the first reply and then the rest they don't have to at all.

BigJohnson
01-27-2003, 07:59 AM
bump

Xenon
01-27-2003, 01:26 PM
this ^^
if($threadinfo[replycount]==0 and !strstr(strtoupper($message),strtoupper($getfirst['username']))) {

BigJohnson
01-29-2003, 01:22 PM
Originally posted by Xenon
this ^^
if($threadinfo[replycount]==0 and !strstr(strtoupper($message),strtoupper($getfirst['username']))) {

This is not working. IT works for like the first replies or two but the other people dont have to have the username in there posts. I don't know why it doesnn't work. Can ya help me. Is there anyother code we could use?

BigJohnson
02-08-2003, 10:09 PM
I need it to only have it do it for there first reply. Also how do i make it so if the person that made the new thread doesn't have t put there own name in there replies to there own threads?

Thanks.

Xenon
02-17-2003, 05:17 PM
use this:


$repliesbybbuser=$DB_site->query_first("SELECT COUNT(*) AS total FROM post WHERE userid=$bbuserinfo[userid] AND threadid=$threadid");
if($repliesbybbuser['total']==0 and $getfirst['userid'] != $bbuserinfo['userid'] and !strstr(strtoupper($message),strtoupper($getfirst['username']))) {

BigJohnson
02-19-2003, 01:42 PM
Works great but one little problem

SAY JOHN makes a new thread. And STEVE wants to reply and he doesnt use the users name of JOHN in his reply. He gets the error saying use the username but there is this line at the top of the web page

Warning: Empty Delimiter in /usr/local/psa/home/host/bburl.com/httpdocs/messageboard/newreply.php on line 102

Xenon
02-19-2003, 01:51 PM
what is line 102 and about 5 lines above and below :)

BigJohnson
02-19-2003, 02:14 PM
sorry haha

// ############################### start post reply ###############################
if ($HTTP_POST_VARS['action']=="postreply") {

// check for subject and message
$message=trim($message);
if ($message=="") {
eval("standarderror(\"".gettemplate("error_nosubject")."\");");
exit;
}

if (in_array($threadinfo['forumid'], array(23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 55, 56))) {
$repliesbybbuser=$DB_site->query_first("SELECT COUNT(*) AS total FROM post WHERE userid=$bbuserinfo[userid] AND threadid=$threadid");
if($repliesbybbuser['total']==0 and $getfirst['userid'] != $bbuserinfo['userid'] and !strstr(strtoupper($message),strtoupper($getfirst['username']))) {
eval("standarderror(\"".gettemplate("error_nofirstusername")."\");");
}
}

// decode check boxes
$parseurl=iif(trim($parseurl)=="yes",1,0);
$email=iif(trim($email)=="yes",1,0);
$allowsmilie=iif(trim($disablesmilies)=="yes",0,1);
$signature=iif(trim($signature)=="yes",1,0);
$preview=iif(trim($preview)!="",1,0);

102 is

if($repliesbybbuser['total']==0 and $getfirst['userid'] != $bbuserinfo['userid'] and !strstr(strtoupper($message),strtoupper($getfirst['username']))) {

lol

Xenon
02-19-2003, 02:20 PM
hmm, this should work normally...

maybe you can try this:
if(intval($repliesbybbuser['total'])==0 and $getfirst['userid'] != $bbuserinfo['userid'] and !strstr(strtoupper($message),strtoupper($getfirst['username']))) {

BigJohnson
02-19-2003, 02:24 PM
nope same error. Weird.

BigJohnson
02-19-2003, 04:29 PM
with the new code evn though i get that error even though u still put the name in the reply it says u need the usernames name in your reply error. Something is definately wrong. :)

Xenon
02-19-2003, 04:40 PM
replace
AND threadid=$threadid

with
AND threadid=$threadinfo[threadid]

...

BigJohnson
02-21-2003, 06:14 PM
I get the same error. I don't know why weird. What else can we do?

BigJohnson
02-21-2003, 07:00 PM
I foudn the error Xenon.

This line needs to be in there as well.

$getfirst=$DB_site->query_first("SELECT postid,post.userid,dateline,user.username FROM post LEFT JOIN user USING(userid) WHERE threadid='$threadid' ORDER BY dateline LIMIT 1");

because when u look at ur new code at this line

!strstr(strtoupper($message),strtoupper($getfirst['username']))) {

$getfirst has no where to look for. So i put that code above and it worked.

Is this right though or is there an easier better what of doing it?

Xenon
02-21-2003, 10:56 PM
yes it has to be there, i thought it would be there already, that's why i didn't mention it again..