Guestbook database table btGuestBookEntries user_name empty
Permalink
Is this normal?
I was trying to pull comments and the user from the database to display on front page and on checking the phpMyAdmin found that user_name and user_email are empty. So I can only pull the comment.
The guestbook itself however shows the poster's name.
I was trying to pull comments and the user from the database to display on front page and on checking the phpMyAdmin found that user_name and user_email are empty. So I can only pull the comment.
The guestbook itself however shows the poster's name.
![AngusHume](/files/avatars/74978.jpg)
Anyone?
that's not supposed to be like that. waht c5 version do you use?
are you sure you add name when insert the guestbook form? did you make modification in the guestbook form? like name or id input?
or just try make new fresh default guestbook and see what happen.
or you can tryhttp://www.concrete5.org/marketplace/addons/advanced-comments/... from jack :)
it's really cool!
are you sure you add name when insert the guestbook form? did you make modification in the guestbook form? like name or id input?
or just try make new fresh default guestbook and see what happen.
or you can tryhttp://www.concrete5.org/marketplace/addons/advanced-comments/... from jack :)
it's really cool!
Yep, it looked pretty wrong to me. I'm using 5.4.2.2 and 5.4.2.1 and have checked the db tables on 3 installs and all are the same. But I decided to be logical before I tried yet another install. On each one I was using the option to require C5 login to comment. When you pick option that the username and email of the commentor are NOT pushed into the database. They are being pulled into guestbook display though, from somewhere. This strikes me as a bug, and an annoying one.
I'm using the guestbook to capture testimonials from members so I cannot have it open. And I wanted to pull the name out of the db to display random quotes.
Advanced comments looks good, but I just tried it and it has the same problem.
I'm using the guestbook to capture testimonials from members so I cannot have it open. And I wanted to pull the name out of the db to display random quotes.
Advanced comments looks good, but I just tried it and it has the same problem.
you are right angus, i try with checkbock 'require c5 login', the username and email empty when insert.
maybe like you said, it, the logical flow.
thats why you must pull out from uID, since the member already known.
that's not c5 style, but maybe can help you
for more safety maybe you can add real_name in user attribut, and select it from table usersearchindexattributes not from users, but when you change username with real_name, it's quite though :)
http://www.concrete5.org/community/forums/chat/username-vs-real-nam...
btw the best way, maybe you can imitate the guesbook , how to pull out the comment entries.
i'm still lerning too
:lol:
maybe like you said, it, the logical flow.
thats why you must pull out from uID, since the member already known.
that's not c5 style, but maybe can help you
for more safety maybe you can add real_name in user attribut, and select it from table usersearchindexattributes not from users, but when you change username with real_name, it's quite though :)
http://www.concrete5.org/community/forums/chat/username-vs-real-nam...
btw the best way, maybe you can imitate the guesbook , how to pull out the comment entries.
i'm still lerning too
:lol:
Thanks for the tip, but I'm nto sure how to use the code you suggested. I'm just a humble designer ;-)
I looked through the controller and view php for the guestbook, I can kind of see what is going on but it is way to complicated for me to adapt myself.
The code I am using now to pull comments from the database is as follows, and I have put this into my page using the php block addon from the marketplace (Very handy!)...
I looked through the controller and view php for the guestbook, I can kind of see what is going on but it is way to complicated for me to adapt myself.
The code I am using now to pull comments from the database is as follows, and I have put this into my page using the php block addon from the marketplace (Very handy!)...
echo '<h3>Last 3 comments</h3>'; $db = Loader::db(); $rs=$db->Execute('SELECT * FROM btGuestBookEntries where approved = 1 ORDER BY entryID DESC LIMIT 3'); $num = 1; while ( $num <=3 ) { $row = $rs->FetchRow(); $commentText=$row['commentText']; echo "<blockquote>$commentText</blockquote>"; $num++; }
like this :
actually you can archieve this using page_list block, and add your custom template, like this
http://www.concrete5.org/community/forums/customizing_c5/creating-m...
<?php echo '<h3>Last 3 comments</h3>'; $db = Loader::db(); $rs=$db->Execute('SELECT * FROM btGuestBookEntries where approved = 1 ORDER BY entryID DESC LIMIT 3'); $num = 1; while ( $num <=3 ) { $row = $rs->FetchRow(); $sql = "select uName, uEmail from users where uID = ?"; $vals = array($row['uID']);//uID from btguestbookentries $res = $db->execute($sql, $vals); $pg = $res->fetchRow(); echo $pg['uName']; echo $pg['uEmail']; $commentText=$row['commentText'];
Viewing 15 lines of 19 lines. View entire code block.
actually you can archieve this using page_list block, and add your custom template, like this
http://www.concrete5.org/community/forums/customizing_c5/creating-m...
You are a star, thanks so much. It gave me mySQL dbname.users not found error at first. Knowing how literal these things might be I tried capping the "users" to "Users" and it worked. Then I created a new value from your uName lookup and integrated into my code properly.
echo '<h3>Last 3 comments with logged in name</h3>'; $db = Loader::db(); $rs=$db->Execute('SELECT * FROM btGuestBookEntries where approved = 1 ORDER BY entryID DESC LIMIT 3'); $num = 1; while ( $num <=3 ) { $row = $rs->FetchRow(); $sql = "select uName, uEmail from Users where uID = ?"; $vals = array($row['uID']);//uID from btGuestBookEntries $res = $db->execute($sql, $vals); $pg = $res->fetchRow(); $logname=$pg['uName']; $username=$row['user_name']; $commentText=$row['commentText']; echo "<blockquote>$commentText<cite>$logname</cite></blockquote>";
Viewing 15 lines of 17 lines. View entire code block.