View previous topic :: View next topic |
Author |
Message |
jomamma
Joined: 24 May 2004 Posts: 12
|
Posted: Tue Jun 08, 2004 3:21 am Post subject: Help!! Please desperatley needed help here (prob a stupid ?) |
|
|
ok, when people post there comments on my site, the name never shows up, could someone please help me with this? please!
-ryan |
|
Back to top |
|
 |
Sigg3
Joined: 03 Jul 2003 Posts: 465 Location: Oslo, Norway
|
|
Back to top |
|
 |
jomamma
Joined: 24 May 2004 Posts: 12
|
Posted: Tue Jun 08, 2004 8:01 pm Post subject: |
|
|
it doesnt seem that way.. heres my code for b2comments.php:
Code: | <?php // Do not delete these lines
if (basename($HTTP_SERVER_VARS["SCRIPT_FILENAME"]) == "b2comments.php")
die ("please, do not load this page directly");
if (($withcomments) or ($c)) {
$comment_author = (empty($HTTP_COOKIE_VARS["comment_author"])) ? "name" : $HTTP_COOKIE_VARS["comment_author"];
$comment_author_email = (empty($HTTP_COOKIE_VARS["comment_author"])) ? "email" : trim($HTTP_COOKIE_VARS["comment_author_email"]);
$comment_author_url = (empty($HTTP_COOKIE_VARS["comment_author"])) ? "http://url" : trim($HTTP_COOKIE_VARS["comment_author_url"]);
$queryc = "SELECT * FROM $tablecomments WHERE comment_post_ID = $id AND comment_content NOT LIKE '%<trackback />%' AND comment_content NOT LIKE '%<pingback />%' ORDER BY comment_date";
$resultc = mysql_query($queryc);
if ($resultc) {
?>
<!-- you can start editing here -->
<a name="comments"></a>
<p> </p>
<div><strong>Comments</strong></div>
<p> </p>
<?php /* this line is b2's motor, do not delete it */ $wxcvbn_c=0; while($rowc = mysql_fetch_object($resultc)) { $wxcvbn_c++; $commentdata = get_commentdata($rowc->comment_ID); ?>
<a name="c<?php comment_ID() ?>"></a>
<!-- comment -->
<p>
<b><?php comment_author() ?> <?php comment_author_email_link("email", " - ", "") ?><?php comment_author_url_link("url", " - ", "") ?></b>
<br />
<?php comment_text() ?>
<br />
<?php comment_date() ?> @ <?php comment_time() ?>
</p>
<p> </p>
<!-- /comment -->
<?php /* end of the loop, don't delete */ } if (!$wxcvbn_c) { ?>
<!-- this is displayed if there are no pingbacks so far -->
<p>No Comment on this post so far.</p>
<?php /* if you delete this the sky will fall on your head */ } ?>
<div><strong>Leave a comment</strong></div>
<p> </p>
<!-- form to add a comment -->
<form action="<?php echo $siteurl; ?>/b2comments.post.php" method="post">
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars($HTTP_SERVER_VARS["REQUEST_URI"]); ?>" />
<p class="commentfield">
name<br />
<input type="text" name="name" class="textarea" value="<?php echo $comment_author ?>" size="20" tabindex="1"
onfocus="this.value=(this.value=='name') ? '' : this.value;" onblur="this.value=(this.value=='') ? 'name' : this.value;" />
</p>
<p class="commentfield">
email<br />
<input type="text" name="email" class="textarea" value="<?php echo $comment_author_email ?>" size="20" tabindex="2"
onfocus="this.value=(this.value=='email') ? '' : this.value;" onblur="this.value=(this.value=='') ? 'email' : this.value;" />
</p>
<p class="commentfield">
url<br />
<input type="text" name="url" class="textarea" value="<?php echo $comment_author_url ?>" size="20" tabindex="3"
onfocus="this.value=(this.value=='http://url') ? '' : this.value;" onblur="this.value=(this.value=='') ? 'http://url' : this.value;" />
</p>
<p class="commentfield">
your comment<br />
<textarea cols="30" rows="5" name="comment" tabindex="4" class="textarea"
onfocus="this.value=(this.value=='comment') ? '' : this.value;" onblur="this.value=(this.value=='') ? 'comment' : this.value;" >comment</textarea>
</p>
<p class="commentfield">
<input type="checkbox" name="comment_autobr" value="1" <?php
if ($autobr)
echo " checked=\"checked\"" ?> tabindex="6" /> Auto-BR (line-breaks become <br> tags)<br />
<input type="submit" name="submit" class="buttonarea" value="ok" tabindex="5" />
</p>
</form>
<!-- /form -->
<p> </p>
<div><b><a href="javascript:history.go(-1)">Return to the blog!</a></b></div>
<?php // if you delete this the sky will fall on your head
}
} else {
return false;
}
?> |
|
|
Back to top |
|
 |
Sigg3
Joined: 03 Jul 2003 Posts: 465 Location: Oslo, Norway
|
|
Back to top |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 194
|
Posted: Thu Jun 10, 2004 6:31 pm Post subject: |
|
|
In b2config.php do you have $require_name_email = 1; You will find it in this section:
Code: | // ** Comments options **
# set this to 1 to require e-mail and name, or 0 to allow comments without e-mail/name
$require_name_email = 1; |
|
|
Back to top |
|
 |
jomamma
Joined: 24 May 2004 Posts: 12
|
Posted: Thu Jun 10, 2004 9:35 pm Post subject: |
|
|
no, i dont, i made sure i took that off, because then i got an error saying that not all the required fields were filled in (name,email) so i set it to 0. if you need to see any of my codes ill gladly post them. |
|
Back to top |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 194
|
Posted: Thu Jun 10, 2004 9:49 pm Post subject: |
|
|
Are you able to view the database using something like phpMyAdmin? Then we can check to see if it is actually saving the name. Have a look in b2comments table and see if there's anything under comment_author. |
|
Back to top |
|
 |
jomamma
Joined: 24 May 2004 Posts: 12
|
Posted: Fri Jun 11, 2004 2:45 am Post subject: |
|
|
im not able to view the database..i am hosted by brandon. as far as b2 comments table.. what do u mean if theres anything under it?[/url] |
|
Back to top |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 194
|
Posted: Fri Jun 11, 2004 4:26 pm Post subject: |
|
|
Are you sure that in your host's control panel there's no way to look at the database. Were you able to create a database because if so there should be something like phpmyadmin in the same place.
If not, create a new text file called b2test.php with the following:
Code: | <?php
require_once ('b2config.php');
require_once($b2inc."/b2functions.php");
dbconnect();
$query = "SELECT * FROM $tablecomments ORDER BY comment_date";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)) {
echo $row["comment_ID"]." ";
echo $row["comment_date"]." ";
echo $row["comment_author"]." ";
echo Substr($row["comment_content"],0,20)."<br>";
}
?> |
Then upload it and run it by going to http://yoursite/b2test.php
This should give you a list of the comments and on each line
comment number, date, author, the first part of the comment
Is this list correct? Is there an author? |
|
Back to top |
|
 |
jomamma
Joined: 24 May 2004 Posts: 12
|
Posted: Fri Jun 11, 2004 9:16 pm Post subject: |
|
|
Quote: | 3 2004-05-24 18:55:22 testing testing 123
4 2004-05-24 19:24:04 Yay! Your back!
5 2004-05-29 20:08:12 u... i luv starbucks
6 2004-06-02 11:38:19 Guys, cmon, u gotta
7 2004-06-02 20:35:30 Hey your pic is look
8 2004-06-02 20:36:41 p.s why doesn\'t it
9 2004-06-04 07:55:07 woohoo.. i like your
10 2004-06-06 01:22:03 lol i love it!
11 2004-06-06 19:27:12 Cool, a little hard
12 2004-06-06 19:28:15 ha ha i meant - Cath
13 2004-06-08 00:50:32 I\'m just checking w |
is exactly what i get when i run it, no more no less. i havent edited a thing |
|
Back to top |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 194
|
Posted: Fri Jun 11, 2004 10:31 pm Post subject: |
|
|
That confirms that the author is not being saved in the database. Do you get the author when you insist on a name with $require_name_email = 1;
Is the author's name included in the email you get when someone comments?
Have you changed anything in b2comments.post.php which is where the author's name is saved? |
|
Back to top |
|
 |
jomamma
Joined: 24 May 2004 Posts: 12
|
Posted: Sat Jun 12, 2004 1:19 am Post subject: |
|
|
no; didnt set to recieve emails; no |
|
Back to top |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 194
|
Posted: Sun Jun 13, 2004 12:40 pm Post subject: |
|
|
We need to see what is in your database and whether the autor field is there. Can you change b2test.php to the code below and let us know what it says when you run it?
Code: | <?php
require_once ('b2config.php');
require_once($b2inc."/b2functions.php");
dbconnect();
$result = mysql_list_fields($dbname, $tablecomments);
for($i=0; $i < mysql_num_fields($result); $i++ ) {
echo mysql_field_name($result,$i );
echo "(" . mysql_field_len($result, $i) . ")";
echo " - " . mysql_field_type($result, $i) . "<BR>";
}
$query = "SELECT * FROM $tablecomments ORDER BY comment_date";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)) {
echo $row["comment_ID"]." ";
echo $row["comment_date"]." ";
echo $row["comment_author"]." ";
echo Substr($row["comment_content"],0,20)."<br>";
}
?> |
|
|
Back to top |
|
 |
jomamma
Joined: 24 May 2004 Posts: 12
|
Posted: Mon Jun 14, 2004 6:54 am Post subject: |
|
|
i get this: Quote: | comment_ID(11) - int
comment_post_ID(11) - int
comment_author(255) - blob
comment_author_email(100) - string
comment_author_url(100) - string
comment_author_IP(100) - string
comment_date(19) - datetime
comment_content(65535) - blob
comment_karma(11) - int
3 2004-05-24 18:55:22 testing testing 123
4 2004-05-24 19:24:04 Yay! Your back!
5 2004-05-29 20:08:12 u... i luv starbucks
6 2004-06-02 11:38:19 Guys, cmon, u gotta
7 2004-06-02 20:35:30 Hey your pic is look
8 2004-06-02 20:36:41 p.s why doesn\'t it
9 2004-06-04 07:55:07 woohoo.. i like your
10 2004-06-06 01:22:03 lol i love it!
11 2004-06-06 19:27:12 Cool, a little hard
12 2004-06-06 19:28:15 ha ha i meant - Cath
13 2004-06-08 00:50:32 I\'m just checking w | nottin changed. lol i hope this is fixed soon (not rushing you or nothing cuz i know ur workin hard and i thank you VERY much) |
|
Back to top |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 194
|
Posted: Mon Jun 14, 2004 8:47 pm Post subject: |
|
|
This is very odd as that is what I expect to see ie there is space in the database for the author's name. Can you email me your copy of b2comments.post.php so I can compare it with mine in case there's a problem there? Email address is in PM |
|
Back to top |
|
 |
|