How to make Guestbook messages "invisible"?+encodi

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
Nik2004
Posts: 132
Joined: Mon 9. Aug 2004, 14:31
Location: Athens,Greece

How to make Guestbook messages "invisible"?+encodi

Post by Nik2004 »

Hi,

My question is: can I make the guestbook moderated? That is, when someone submits a message, this would not be displayed directly, but it would be available to the administrator who would decide whether to authorize the message or not.

Even at the code level, what should I change in the code to make messages to be stored in the database with a "hidden" status, so I can examine them later and decide to make them visible or not (possibly by manually changing some column value in the database table associated with the guestbook messages)?

For example, if I know where is the sql query to store the message, I can possibly change the initial value of guestbook_trashed (in phpwcms_guestbook table) to some other value (to 9, as I have noticed) to make the message hidden. Then, I can check the message and change the value of guestbook_trashed to 0, so it can be visible. So, where is the sql for storing the messages?

Also, one problem: in the guestbook content part administration page I see (at the bottom of the page) the list of messages displayed. However, those written in the greek language are not displayed with correct characters, even though the page codepage is correct and all other greek characters in the page are showing fine. What should I edit to correct this problem?

Thanks,
Nick
Nik2004
Posts: 132
Joined: Mon 9. Aug 2004, 14:31
Location: Athens,Greece

Making Guestbook moderated

Post by Nik2004 »

Answering my own questions:

I found that I can edit: include\inc_front\content\cnt18.article.inc.php.

I modified the query as follows:

Code: Select all

		$guestbook['sql']  = "INSERT INTO ".DB_PREPEND."phpwcms_guestbook SET ";
		$guestbook['sql'] .= "guestbook_cid='".intval($crow["acontent_id"])."', ";
		$guestbook['sql'] .= "guestbook_msg='".substr(aporeplace($guestbook['post']['msg']),0,1000)."', ";
		$guestbook['sql'] .= "guestbook_name='".substr(aporeplace($guestbook['post']['name']),0,50)."', ";
		$guestbook['sql'] .= "guestbook_email='".substr(aporeplace($guestbook['post']['email']),0,100)."', ";
		$guestbook['sql'] .= "guestbook_created='".time()."', ";
		$guestbook['sql'] .= "guestbook_trashed=9,";
		$guestbook['sql'] .= "guestbook_url='".substr(aporeplace($guestbook['post']['url']),0,50)."';";
You notice that I have also modified code to restrict the max no. of characters in the message textbox (for security reasons).

This code will allow the messages to be stored but not displayed in the page. I can then use mysql client (via telnet) OR webmin to review messages and change the value of guestbook_trashed to 0 only for those messages that I want to be displayed.

Note that when the administrator deletes messages from the admin page, the messages are not really deleted but only changed to guestbook_trashed=9, which means that if one needs to delete messages from the database, (s)he must use mysql client of webmin. I hope Oliver can extend the message administration functionality to allow better management from the admin.

Finally, on the encoding problem: I found that in include/inc_act/act_guestbook.php the encoding is hardcoded to iso-8859-1. I had to manually change this value to iso-8859-7.

That's it. I document the above for anyone who is interested. I just want to add my two cents to this great software.
ederhj
Posts: 7
Joined: Mon 24. Jan 2005, 23:11

Re: Making Guestbook moderated

Post by ederhj »

Look here http://www.phpwcms.de/forum/viewtopic.php?t=5294

I wrote it a few days ago!

CIAO
User avatar
pSouper
Posts: 1552
Joined: Tue 11. Nov 2003, 15:45
Location: London
Contact:

Post by pSouper »

phpwcms allows you to moderate guestbook messages in the backend...
just go to the category>article>contentpart and edit the guestbook content part. at the bottom of the content part (once someone has posted a comment) you are able to edit/delete any individual message
ederhj
Posts: 7
Joined: Mon 24. Jan 2005, 23:11

Post by ederhj »

pSouper wrote:phpwcms allows you to moderate guestbook messages in the backend...
just go to the category>article>contentpart and edit the guestbook content part. at the bottom of the content part (once someone has posted a comment) you are able to edit/delete any individual message
Yes, but it is not possible, that the entry is not shown until die administrator released it.
This is a problem if somone writes bad messages!!

CIAO
User avatar
pSouper
Posts: 1552
Joined: Tue 11. Nov 2003, 15:45
Location: London
Contact:

Post by pSouper »

ok: i understand now :)
that would be a nice option to have i guess.
Post Reply