Guestbook - Adding fields?

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
richardpettet
Posts: 24
Joined: Sat 21. Oct 2006, 11:16

Guestbook - Adding fields?

Post by richardpettet »

Hello,

Is there anyway to add fields to the guestbook? I am trying to use the guestbook as a way of posting reviews and want to add a title field and possibly a rating field (i.e. to give a review 4 stars out of 5). I'm not a php coder so would love any help that anyone has to offer. Cheers :lol:

Rich
User avatar
Oliver Georgi
Site Admin
Posts: 9938
Joined: Fri 3. Oct 2003, 22:22
Location: Dessau-Roßlau
Contact:

Post by Oliver Georgi »

not possible at the moment. But wouldn't be too difficult to do so.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn
richardpettet
Posts: 24
Joined: Sat 21. Oct 2006, 11:16

Post by richardpettet »

Thanks for the quick reply. I know you're constantly making enhancements to phpwcms and so don't want to hassle you and seem like I don't appreciate the great work you do, because I truly do, but is this something you could add as an enhancement for the future? I've had a look for hacks but there isn't much. Not being a coder, I have almost no idea how to begin doing it. :(

Cheers again.
larmann
Posts: 311
Joined: Thu 23. Jun 2005, 10:51
Location: Hamburg
Contact:

Re: Guestbook - Adding fields?

Post by larmann »

Are there any news concerning adding additonal fields to the guestbook?
novallis
Posts: 121
Joined: Tue 7. Dec 2004, 11:23
Location: Hassloch, Germany

Re: Guestbook - Adding fields?

Post by novallis »

Hy larmann,

i have succesfull enhanced my guestbook for a further field which could be edited now also at the backend.
But this is a "core-hack" and you have to add the field manually at the database by phpMyAdmin.

I am looking for a little bit time during the next days and this weekend to give you a hint (i have to recapitulate and to describe).

You will hear about ...

regards
- Ralf
novallis
Posts: 121
Joined: Tue 7. Dec 2004, 11:23
Location: Hassloch, Germany

Re: Guestbook - Adding fields?

Post by novallis »

Adding Custum Field - (Core-Hack): Here we go:

based at the posting hier at the forum (thank you starletina)
http://forum.phpwcms.org/viewtopic.php?f=1&t=4164

Example for a custom field called "guestbook_clubname" at the database
Replacer at the template

Code: Select all

 {CLUBNAME}
/ description: "Clubname"[/b][/color]


1) In your phpwcms database there's a table called [prefix]phpwcms_guestbook. In this table you need to add a field called "guestbook_clubname", type: text

2) Edit the following file on your server /include/inc_front/content/cnt18.article.inc.php

find the following text (arround line 93):

Code: Select all

$guestbook['post']['name']	= clean_slweg(remove_unsecure_rptags($_POST['guestbook_name']));
after this add:

Code: Select all

$guestbook['post']['clubname']	= clean_slweg(remove_unsecure_rptags($_POST['guestbook_clubname']));
find the following text (arround line 269):

Code: Select all

$guestbook['post']['msg'] 		= '';
after this add:

Code: Select all

$guestbook['post']['clubname'] 		= '';
find the following text (arround line 388):

Code: Select all

$guestbook['sql'] .= "guestbook_name='".aporeplace($guestbook['post']['name'])."', ";
after this add:

Code: Select all

$guestbook['sql'] .= "guestbook_clubname='".aporeplace($guestbook['post']['clubname'])."', ";
find the following text (arround line 520):

Code: Select all

$guestbook['form'] = render_cnt_template($guestbook['form'], 'URL',		html_specialchars($guestbook['post']['url']));
after this add:

Code: Select all

$guestbook['form'] = render_cnt_template($guestbook['form'], 'CLUBNAME',		html_specialchars($guestbook['post']['clubname']));
find the following text (arround line 553):

Code: Select all

$guestbook['signed'] = render_cnt_template($guestbook['signed'], 'URL',		html_specialchars($guestbook['post']['url']));
after this add:

Code: Select all

$guestbook['signed'] = render_cnt_template($guestbook['signed'], 'CLUBNAME',		html_specialchars($guestbook['post']['clubname']));
find the following text (arround line 781):

Code: Select all

$guestbook['c'] = render_cnt_template($guestbook['c'], 'NAME',	html_specialchars($guestbook['row']['guestbook_name']));
after this add:

Code: Select all

$guestbook['c'] = render_cnt_template($guestbook['c'], 'CLUBNAME',	html_specialchars($guestbook['row']['guestbook_clubname']));

3. Modify guestbook-template file on your server template/inc_cntpart/guestbook/[name-of-the-file]

Modified lInes (example) at the entry-section of the template:

Code: Select all

<p style="background-color:#D7E3E2 "><strong>Guestbook HTML form and form error message <br>
  </strong>{EMAIL}, {NAME}, {CLUBNAME}, {URL}, {MSG}, {CAPTCHA}</p>
and

Code: Select all

		<div class="gbLine">
			<div class="gbDescription"><label for="guestbook_clubname">Clubname:<span style="color:#CC3300;">*</span>:</label></div>
			<input name="guestbook_clubname" type="text" id="guestbook_clubname" class="gbInputField" value="{CLUBNAME}" size="50" maxlength="500" />
		</div>	
Modified lInes (example) at the view-section of the template:

Code: Select all

<p style="background-color:#D7E3E2 "> <strong>Guestbook listing<br>
  </strong>{EMAIL}, {NAME}, {CLUBNAME}, {URL:HTML}, {MSG}, {URL}, {ID},
  {DBID}, {TIMESTAMP:FORMAT} (<a href="http://www.php.net/manual/en/function.date.php" target="_blank" style="text-decoration:underline">FORMAT&nbsp;=&nbsp;d.m.Y&nbsp;or&nbsp;H:i:s</a>)</p>
<p>
and at the section

Code: Select all

<!--GUESTBOOK_ENTRY_START//-->

Code: Select all

		<h6>Eintrag von: {NAME} | {CLUBNAME} [URL] | <a href="{URL}" target="_blank">Website</a>[/URL][URL_ELSE][/URL_ELSE] [EMAIL] | <a href="mailto:{EMAIL}">eMail</a>[/EMAIL]</h6>
4) For editing the new field at the backend you need to modify the following file on your server /include/inc_act/act_guestbook.php

find the following text (arround line 53):

Code: Select all

$gbname		= clean_slweg(remove_unsecure_rptags($_POST['gbname']));
after this add:

Code: Select all

$gbclubname	= clean_slweg(remove_unsecure_rptags($_POST['gbclubname']));
find the following text (arround line 69):

Code: Select all

$sql .= "guestbook_name='".aporeplace($gbname)."', ";
after this add:

Code: Select all

$sql .= "guestbook_clubname='".aporeplace($gbclubname)."', ";
find the following text (arround line 151 and 152):

Code: Select all

echo htmlspecialchars($row['guestbook_name']);
echo ', <br> ';
after this add:

Code: Select all

echo htmlspecialchars($row['guestbook_clubname']);
echo ', ';
find the following text (arround line 191 and 192):

Code: Select all

  <tr>
  <td>name:&nbsp;</td>
  <td><input name="gbname" type="text" id="gbname" style="width:350px;" value="<?php echo htmlspecialchars($row['guestbook_name']) ?>" /></td>
  </tr>

Code: Select all

after this add:
  <td>clubname:&nbsp;</td>
  <td><input name="gbclubname" type="text" id="gbclubname" style="width:350px;" value="<?php echo htmlspecialchars($row['guestbook_clubname']) ?>" /></td>
  </tr>
  <tr>
Hope this are all necessary modifications.

Good look,

Regard,
Ralf (novallis)
Post Reply