summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/comment/comment.install26
-rw-r--r--modules/comment/comment.module8
2 files changed, 32 insertions, 2 deletions
diff --git a/modules/comment/comment.install b/modules/comment/comment.install
index 454d6e16a..272c50944 100644
--- a/modules/comment/comment.install
+++ b/modules/comment/comment.install
@@ -159,6 +159,22 @@ function comment_update_7007() {
}
/**
+ * Add language column to the {comment} table.
+ */
+function comment_update_7008() {
+ // Create a language column.
+ db_add_field('comment', 'language', array(
+ 'type' => 'varchar',
+ 'length' => 12,
+ 'not null' => TRUE,
+ 'default' => '',
+ ));
+
+ // Create the index.
+ db_add_index('comment', 'comment_nid_language', array('nid', 'language'));
+}
+
+/**
* @} End of "defgroup updates-6.x-to-7.x"
* The next series of updates should start at 8000.
*/
@@ -263,12 +279,20 @@ function comment_schema() {
'length' => 255,
'not null' => FALSE,
'description' => "The comment author's home page address from the comment form, if user is anonymous, and the 'Anonymous users may/must leave their contact information' setting is turned on.",
- )
+ ),
+ 'language' => array(
+ 'description' => 'The {languages}.language of this comment.',
+ 'type' => 'varchar',
+ 'length' => 12,
+ 'not null' => TRUE,
+ 'default' => '',
+ ),
),
'indexes' => array(
'comment_status_pid' => array('pid', 'status'),
'comment_num_new' => array('nid', 'changed', 'status'),
'comment_uid' => array('uid'),
+ 'comment_nid_language' => array('nid', 'language'),
),
'primary key' => array('cid'),
'foreign keys' => array(
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index db36e0a7a..266b35499 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -1289,6 +1289,7 @@ function comment_save($comment) {
'name' => $comment->name,
'mail' => $comment->mail,
'homepage' => $comment->homepage,
+ 'language' => $comment->language,
))
->condition('cid', $comment->cid)
->execute();
@@ -1368,6 +1369,7 @@ function comment_save($comment) {
'name' => $comment->name,
'mail' => $comment->mail,
'homepage' => $comment->homepage,
+ 'language' => $comment->language,
))
->execute();
@@ -1641,7 +1643,7 @@ function comment_get_display_page($cid, $node_type) {
* @see comment_form_submit()
*/
function comment_form($form, &$form_state, $comment) {
- global $user;
+ global $user, $language;
$op = isset($_POST['op']) ? $_POST['op'] : '';
$node = node_load($comment->nid);
@@ -1855,6 +1857,10 @@ function comment_form($form, &$form_state, $comment) {
'#type' => 'value',
'#value' => $comment->nid,
);
+ $form['language'] = array(
+ '#type' => 'value',
+ '#value' => isset($comment->language) ? $comment->language : $language->language,
+ );
$form['uid'] = array(
'#type' => 'value',
'#value' => !empty($comment->uid) ? $comment->uid : 0,