1

Topic: vldCrowd Mod for adding Comments to Custom Pages - Thanks Ramil

The following are instructions for the CUSTOM PAGE COMMENT MOD. Tested on and being used on vldPersonals 2.5.3 at http://www.filipina-lady.net.

You can find out more about vldCrowd mods at: http://www.vldcrowd.com/

With this mod you can add a comment section to your custom pages. You also have the option to NOT add comments to a custom page. For example, you may NOT want to add comments to your TOS custom page but may want to have comments for a custom page you created on a topic you want feedback or discussion on.  A great way to let your members interact with your custom pages and to create more content for google to index.

Backing up is always recommended before making changes to current site.

To download the files needed click http://www.filipina-lady.net/test253/CUS_COM_page.zip

After download, unzip folder.  You may  want to take your site off line while making changes.

COPY THE FOLLOWING DOWNLOADED FILES TO YOUR SITE ACCORDING TO THE FOLDER STRUCTURE BELOW. The dowloaded files will either replace or be additional files. Recommend backing up original files if being replaced.

includes/cp/cp.pages.php
includes/lib/lib.pages.php
includes/templates/pages.php
includes/templates/pages_comments.php
includes/templates/pages_comments_edit.php
includes/templates/pages_edit.php

yourtemplate/page_default.tpl

SQL UPDATE. You must make changes to your vldPersonals database for this mod to work. If you do not know how to make a sql query, recommend you do not install this mod. Recommend backing up your database before making changes.

NOTE: Do the following sql queries one by one.

CREATE TABLE `vld_pages_comments` (
  `comment_id` bigint(12) unsigned NOT NULL auto_increment,
  `page_id` int(9) unsigned NOT NULL,
  `poster_id` int(9) unsigned NOT NULL,
  `body` text NOT NULL,
  `postdate` int(9) unsigned NOT NULL,
  PRIMARY KEY  (`comment_id`),
  KEY `page_id` (`page_id`),
  KEY `poster_id` (`poster_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1
ALTER TABLE `vld_pages` ADD `comments` TINYINT( 1 ) UNSIGNED DEFAULT '0' NOT NULL ,
ADD `totalcomments` SMALLINT( 5 ) UNSIGNED DEFAULT '0' NOT NULL ;
INSERT INTO `vld_settings_groups` ( `group_id` , `label` , `orderid` )
VALUES (
'', 'pages', '67'
);
INSERT INTO `vld_settings` VALUES ('', 'boolean', 'enable_page_comments', '1', 1, 'pages', 'comments');
INSERT INTO `vld_settings` VALUES ('', 'number', 'pages_comment_max_length', '500', 2, 'pages', 'comments');
INSERT INTO `vld_settings` VALUES ('', 'number', 'pages_comments_per_page', '8', 3, 'pages', 'comments');
INSERT INTO `vld_settings` VALUES ('', 'boolean', 'pages_comments_captcha', '1', 4, 'pages', 'comments');
INSERT INTO `vld_settings_subgroups` ( `subgroup_id` , `group_id` , `label` , `orderid` )
VALUES (
'', 'pages', 'comments', '1'
);

IMAGE EXAMPLE OF A QUERY FOR ONE OF THE ABOVE QUERY STATEMENTS

[img]http://www.filipina-lady.net/test253/query.jpg[/img]



Add the following to  lang.lib.pages.php

"total_comments" =>
"Comments",

"add_comment" =>
"Add comment",

"comments" =>
"comments",

"comments_list" =>
"Comments/Discussion",

"submit" =>
"Submit",

"verify_number" =>
"Verification number",

"empty_comment_body" =>
"Comment cannot be empty.",

"comment_saved" =>
"Comment has been successfully added.",

"comment_too_long" =>
"Comment cannot exceed %max% characters.",

"comments_not_allowed" =>
"Comments are not allowed for this page.",

"invalid_catcha" =>
"Invalid verification number.",

Add the following to lang.cp.pages.php

"app_comments" =>
"Comments",

"app_comments_edit" =>
"Edit comment",

"nav_comments" =>
"Comments",

"nav_comments_edit" =>
"Edit comment",

"edit_comment" =>
"Edit comment",

"comments" =>
"Comments",

"delete_comment" =>
"Delete comment",

"delete_comment?" =>
"Are you sure you want to delete this comment?",

"allow_comments" =>
"Enable comments",

"comments_off" =>
"Disabled",

"comment" =>
"Comment",

"view" =>
"View",

"author" =>
"Author",

"postdate" =>
"Post date",

Make the following changes to includes/hp/hp.comments.php

FIND:

$type = isset($_POST['type']) && in_array($_POST['type'], array('blog','picture','video','event','news')) ? trim($_POST['type']) : '';

CHANGE TO:

$type = isset($_POST['type']) && in_array($_POST['type'], array('blog','picture','video','event','news','page')) ? trim($_POST['type']) : '';

HOW TO USE

[img]http://www.filipina-lady.net/test253/customCC01.jpg[/img]

[img]http://www.filipina-lady.net/test253/customCC02.jpg[/img]

[img]http://www.filipina-lady.net/test253/customCC03.jpg[/img]

[img]http://www.filipina-lady.net/test253/viewC.jpg[/img]

IMPORTANT NOTE

If you  created  external custom pages, you may have to re-create custom pages  to use the new page_default.tpl. That is what I had to do. But it was easy. All I did was copy the content and pasted it in the new external template (rename your external template, do not overwrite page_default.tpl).

There are plenty of instructions on the forum on how to create both a custom page from the CP or an external custom page.

Here is a link to one of my older posts you can use as a guide to understand the difference between custom pages created in the CP and external custom pages: http://www.vldpersonals.com/forum/viewtopic.php?id=2656

Last edited by db3204 (2009-07-19 09:00:25)