diff --git a/groups.info b/groups.info
index 3ebd944..b5528b8 100644
--- a/groups.info
+++ b/groups.info
@@ -151,6 +151,7 @@ dependencies[] = groups_directory
dependencies[] = groups_footer
dependencies[] = groups_homepage
dependencies[] = groups_common
+dependencies[] = groups_comment
dependencies[] = groups_auth
dependencies[] = groups_oauth2
dependencies[] = groups_oauth2_picture
diff --git a/groups.install b/groups.install
index a5fe0aa..825b908 100644
--- a/groups.install
+++ b/groups.install
@@ -191,6 +191,16 @@ function groups_update_7108() {
}
}
+/**
+ * Enable groups_comment module.
+ */
+function groups_update_7109() {
+ if ((!module_exists('groups_comment')) && (!module_exists('groups_comment'))) {
+ module_enable(array('groups_comment'));
+ drupal_flush_all_caches();
+ }
+}
+
/**
* Add markdown filter with permissions.
*/
diff --git a/groups.profile b/groups.profile
index 3bc147c..d61e44a 100644
--- a/groups.profile
+++ b/groups.profile
@@ -278,6 +278,7 @@ function groups_demo_create_group($title, $location, $attributes = null) {
$group->created = time() - 604800;
$group->status = 1;
$group->field_group_location[LANGUAGE_NONE][0] = $location;
+ $group->comment = 0; // disable comments
if (isset($attributes)) {
$attr = array();
foreach ($attributes as $attribute) {
diff --git a/modules/groups/groups_comment/groups_comment.info b/modules/groups/groups_comment/groups_comment.info
new file mode 100644
index 0000000..bf1ef3d
--- /dev/null
+++ b/modules/groups/groups_comment/groups_comment.info
@@ -0,0 +1,7 @@
+name = Groups Comment
+description = Alter default comment system.
+core = 7.x
+package = groups
+version = 7.x-1.0
+project = groups_comment
+dependencies[] = groups_common
\ No newline at end of file
diff --git a/modules/groups/groups_comment/groups_comment.module b/modules/groups/groups_comment/groups_comment.module
new file mode 100644
index 0000000..b66d07e
--- /dev/null
+++ b/modules/groups/groups_comment/groups_comment.module
@@ -0,0 +1,45 @@
+picture) ? variable_get('user_picture_default') : $wrapper->value()->picture->uri;
+ $form['user_picture'] = array(
+ '#theme' => 'image_style',
+ '#style_name' => '50x50_avatar',
+ '#path' => $path,
+ '#prefix' => '
',
+ '#suffix' => '
',
+ '#weight' => -20,
+ );
+ // hide subject field
+ $form['subject']['#access'] = False;
+ $form['author']['#access'] = False;
+ $form['comment_body'][LANGUAGE_NONE][0]['#placeholder'] = t('Write a comment...');
+ $form['comment_body'][LANGUAGE_NONE][0]['#resizable'] = False;
+ $form['comment_body'][LANGUAGE_NONE][0]['#rows'] = 3;
+ $form['comment_body'][LANGUAGE_NONE][0]['#title_display'] = 'invisible';
+ // remove preview button
+ unset($form['actions']['preview']);
+}
+
+/**
+ * Implements hook_text_format_alter.
+ *
+ * Set default text format to markdown for the group/body field.
+ */
+function groups_comment_text_format_alter(&$element) {
+ if (($element['#bundle'] == 'comment_node_post') && ($element['#field_name'] == 'comment_body')) {
+ // set default value to markdown
+ $element['format']['format']['#default_value'] = 'markdown';
+ // hide text format filter
+ $element['format']['#access'] = FALSE;
+ }
+}
\ No newline at end of file
diff --git a/modules/groups/groups_common/groups_common.api.php b/modules/groups/groups_common/groups_common.api.php
new file mode 100644
index 0000000..de12284
--- /dev/null
+++ b/modules/groups/groups_common/groups_common.api.php
@@ -0,0 +1,18 @@
+field_group_status->set('0');
$wrapper->save();
}
+}
+
+/**
+ * Disable commenting on existing group nodes.
+ */
+function groups_groups_update_7303() {
+ $query = new EntityFieldQuery();
+ $query->entityCondition('entity_type', 'node')
+ ->entityCondition('bundle', 'group');
+ $result = $query->execute();
+ if (isset($result['node'])) {
+ $nids = array_keys($result['node']);
+ $nodes = node_load_multiple($nids, NULL, TRUE);
+ foreach ($nodes as $node) {
+ $node->comment = 0;
+ node_save($node);
+ }
+ }
}
\ No newline at end of file
diff --git a/modules/groups/groups_groups/groups_groups.module b/modules/groups/groups_groups/groups_groups.module
index 2b43cfe..13d5156 100644
--- a/modules/groups/groups_groups/groups_groups.module
+++ b/modules/groups/groups_groups/groups_groups.module
@@ -130,36 +130,17 @@ function groups_groups_theme() {
}
/**
- * Implements hook_element_info_alter()
+ * Implements hook_text_format_alter.
*
- * Override filter_process_format.
- *
- * @see _groups_groups_set_default_format()
+ * Set default text format to markdown for the group/body field.
*/
-function groups_groups_element_info_alter(&$type) {
- if (isset($type['text_format']['#process'])) {
- foreach ($type['text_format']['#process'] as &$callback) {
- if ($callback === 'filter_process_format') {
- $callback = '_groups_groups_set_default_format';
- }
- }
- }
-}
-
-/**
- * Callback to set body text format of group content type
- * to markdown, and hide text filter form elements.
- */
-function _groups_groups_set_default_format($element) {
- // set body filter default to 'markdown'
- $element = filter_process_format($element);
+function groups_groups_text_format_alter(&$element) {
if (($element['#bundle'] == 'group') && ($element['#field_name'] == 'body')) {
// set default value to markdown
$element['format']['format']['#default_value'] = 'markdown';
// hide text format filter
$element['format']['#access'] = FALSE;
}
- return $element;
}
/**
diff --git a/themes/openstack_bootstrap/custom-sass/partials/_comment.scss b/themes/openstack_bootstrap/custom-sass/partials/_comment.scss
new file mode 100644
index 0000000..1cf8639
--- /dev/null
+++ b/themes/openstack_bootstrap/custom-sass/partials/_comment.scss
@@ -0,0 +1,44 @@
+#comments {
+ h2 {
+ margin-left: -68px;
+ color: #2A4E68;
+ font-weight: 300;
+ font-size: 18px;
+ }
+}
+
+.comment {
+ h3 {
+ margin-bottom: 0px;
+ margin-top: 0px;
+ a {
+ color: #2A4E68;
+ font-weight: 300;
+ font-size: 18px;
+ }
+ }
+ .user-picture img {
+ width: 50px;
+ }
+ ul {
+ margin-top: 1em;
+ margin-left: 0px;
+ margin-bottom: 1em;
+ a {
+ color: #2A4E68;
+ }
+ }
+ /* hide the like button */
+ .rate-widget {
+ display: none;
+ }
+}
+
+.page-comment .comment-form {
+ margin-left: 68px;
+ .user-picture {
+ margin-left: -68px;
+ position: absolute;
+ float: left;
+ }
+}
\ No newline at end of file
diff --git a/themes/openstack_bootstrap/custom-sass/style.scss b/themes/openstack_bootstrap/custom-sass/style.scss
index 54a8f8a..2506f9b 100644
--- a/themes/openstack_bootstrap/custom-sass/style.scss
+++ b/themes/openstack_bootstrap/custom-sass/style.scss
@@ -16,6 +16,7 @@
@import 'partials/social_icons';
@import 'partials/group_node_form';
@import 'partials/group';
+@import 'partials/comment';
/* Custom override */
diff --git a/themes/openstack_bootstrap/template.php b/themes/openstack_bootstrap/template.php
index 2cbaf57..b5510ce 100755
--- a/themes/openstack_bootstrap/template.php
+++ b/themes/openstack_bootstrap/template.php
@@ -145,8 +145,6 @@ function openstack_bootstrap_preprocess_node(&$variables, $hook) {
'!date' => $variables['date'],
'@interval' => format_interval(REQUEST_TIME - $node->created),
);
- // $node_user = user_load($node->uid);
- // $placeholders['!user'] = format_username($node_user);
if (!empty($node->{OG_AUDIENCE_FIELD}) && $wrapper->{OG_AUDIENCE_FIELD}->count() == 1) {
$placeholders['!group'] = l($wrapper->{OG_AUDIENCE_FIELD}->get(0)->label(), 'node/' . $wrapper->{OG_AUDIENCE_FIELD}->get(0)->getIdentifier());
if ($use_timeago_date_format == TRUE) {
@@ -169,4 +167,4 @@ function openstack_bootstrap_preprocess_node(&$variables, $hook) {
// overwrites the original submitted variable, so we are passing submitted_ now.
// @see templates/node.tpl.php
$variables['submitted_'] = $variables['submitted'];
-}
\ No newline at end of file
+}
diff --git a/themes/openstack_bootstrap/templates/comment.tpl.php b/themes/openstack_bootstrap/templates/comment.tpl.php
new file mode 100644
index 0000000..8bac4e0
--- /dev/null
+++ b/themes/openstack_bootstrap/templates/comment.tpl.php
@@ -0,0 +1,83 @@
+created variable.
+ * - $changed: Formatted date and time for when the comment was last changed.
+ * Preprocess functions can reformat it by calling format_date() with the
+ * desired parameters on the $comment->changed variable.
+ * - $new: New comment marker.
+ * - $permalink: Comment permalink.
+ * - $submitted: Submission information created from $author and $created during
+ * template_preprocess_comment().
+ * - $picture: Authors picture.
+ * - $signature: Authors signature.
+ * - $status: Comment status. Possible values are:
+ * comment-unpublished, comment-published or comment-preview.
+ * - $title: Linked title.
+ * - $classes: String of classes that can be used to style contextually through
+ * CSS. It can be manipulated through the variable $classes_array from
+ * preprocess functions. The default values can be one or more of the following:
+ * - comment: The current template type, i.e., "theming hook".
+ * - comment-by-anonymous: Comment by an unregistered user.
+ * - comment-by-node-author: Comment by the author of the parent node.
+ * - comment-preview: When previewing a new or edited comment.
+ * The following applies only to viewers who are registered users:
+ * - comment-unpublished: An unpublished comment visible only to administrators.
+ * - comment-by-viewer: Comment by the user currently viewing the page.
+ * - comment-new: New comment since last the visit.
+ * - $title_prefix (array): An array containing additional output populated by
+ * modules, intended to be displayed in front of the main title tag that
+ * appears in the template.
+ * - $title_suffix (array): An array containing additional output populated by
+ * modules, intended to be displayed after the main title tag that appears in
+ * the template.
+ *
+ * These two variables are provided for context:
+ * - $comment: Full comment object.
+ * - $node: Node object the comments are attached to.
+ *
+ * Other variables:
+ * - $classes_array: Array of html class attribute values. It is flattened
+ * into a string within the variable $classes.
+ *
+ * @see template_preprocess()
+ * @see template_preprocess_comment()
+ * @see template_process()
+ * @see theme_comment()
+ *
+ * @ingroup themeable
+ */
+
+hide($content['report_link']);
+?>
+>
+
+
+
+
+
+
+
+
+
+
>
+
+
+
+
+
\ No newline at end of file