Special comment theming
maulwuff - March 15, 2008 - 16:49
| Project: | Advanced Forum |
| Version: | 6.x-1.x-dev |
| Component: | Styles |
| Category: | task |
| Priority: | normal |
| Assigned: | Michelle |
| Status: | closed |
Description
I noticed the following:
Browsing the forum as user #1 does not differentiate between published and unpublished comments. I unpublished a comment, and nothing happened - was confusing.
So I came up with this: Color the left part of a comment in another color to make unpublished comments noticable.
In the module file modify:
<?php
function advanced_forum_preprocess_comment(&$vars) {
if (_is_forum('comment',$vars)) {
// Use our combined node/comment template file
// D5 won't find templates in subdirectories so we need to give it that
$forum_theme = advanced_forum_get_forum_theme_directory();
$vars['template_files'][] = "$forum_theme/advf-forum-post";
#mod start
$vars['unpub'] = $vars['comment']->status;
#mod end
.......
?>in advanced_forum.css add
.forum-post-wrapper-unpub {
background: #808080 url(images/forum-separaterRed.jpg) repeat-y;
border-top: thin solid darkgray;
border-bottom: thin solid darkgray;
}Next, save the attached image to your themes/xyz/advforum/images directory, or use your own file. I called it forum-separaterRed.jpg
Last, edit advf-forum-post.tpl.php and add at about line 62:
leading:
<div class="clear"></div>insert:
<?php if ($unpub) : ?>
<div class="forum-post-wrapper-unpub">
<?php else : ?>
<div class="forum-post-wrapper">
<?php endif; ?>following:
<div class="forum-comment-left">| Attachment | Size |
|---|---|
| forum-separaterRed.jpg | 362 bytes |

#1
Hmm.. I'm on the fence on this one. Theming unpublished nodes/comments differently seems like it should be part of the over all site theme . But I suppose it wouldn't really hurt to add it. Any other opinions on this?
Michelle
#2
This would be a fantastic addition IMO. Like the OP, I often get confused which posts are published/unpublished while administering forums.
#3
Ok, what the heck, I'll put it in. People can always take it out of their themes if it clashes with what their main theme has set.
While I'm at it, I'll add in a class for own comments, though I don't think I'll add any default CSS for that...
I also had someone ask once for a little something extra on new comments. Might as well do that while I'm at it.
Anything else?
Michelle
#4
This might be another task/module entirely or too large of a project, but since you're listening... :)
What about a class for replies from the Author/OP?
Sony's official playstation blog implemented this not too long ago with fantastic results (see attached). They recently released their work as a wordpress plugin.
Again, I really have no idea how hard this would be to implement but I figured I may as well suggest it.
Thanks as always Michelle!
#5
Sure, I can do that, too.
I was going to work on this today but the advanced profile queue is getting really bad. I'm going to take a short break from forums and give that a bit of love. Should be able to get to this issue within the next day or two because it's an easy addition. I know just how to do it... Just need to take a bit of time and add it in.
Michelle
#6
applies still to aplha10
#7
Thanks but there's no need to update version on old issues. Whenever I have time to work on this I look at all the open issues, regardless of versions, to see what I can tackle.
Michelle
#8
ok, just had to redo this procedure because I updated to alpha10! :P
#9
Consolodating into #268684: Retheming - one way forward.
Michelle
#10
Unconsolodating since it got missed.
Michelle
#11
some help for you, based on D5 alpha12.
sorry for not providing a patch, I've got too much changed in the module.
it is a 3-step change:
1. in function advanced_forum_preprocess_comment
add this:
$variables['unpub'] = $variables['comment']->status;2. in advf-forum-post.tpl.php
at about line 63 add this:
leading code:
<?php if (!$top_post): ?><span class="post-num"><?php print $comment_link . ' ' . $page_link; ?></span>
<?php endif; ?>
</div>
insert:
<?php if ($unpub) : ?><div class="forum-post-wrapper-unpublished">
<?php else : ?>
<div class="forum-post-wrapper">
<?php endif; ?>
3. in advanced-forum.css
at around line 57 add this: (the line number may be completely wrong)
leading:
/*** FORUM THREADS ***********************************************************/
.forum-post-wrapper {
background: #F7F5EE;
}
insert:
.forum-post-wrapper-unpublished {background: #FFC8BB;
}
adjust the color to your need.
hope this saves you some time.
#12
Thanks for the effort but that isn't how I'm planning on doing it. I'll get to this as soon as we get the layout problems fixed. No sense in me adding to the CSS when it's in flux.
Michelle
#13
I've given this issue a lot of thought and I keep coming back to my original feeling that this CSS is the theme's responsibility, not AF's. However, AF needs some way of knowing what the theme wants. I took a look at some of the major themes as well as #306358: Add $classes to hook templates and it looks like the goal is to use the variable $classes to hold these special classes. Some themes are still using $node_classes and $comment_classes as well. So I ended up merging these into $classes to cover both possibilities and adding it to advf-forum-post.tpl.php. At the moment, it's only on the naked style and only in D6 as I'm adding it in along with other work being done on the forum topics. I'll leave this active until it's on all styles in both branches but wanted to give an update with "the plan".
Michelle
#14
This is now in all the styles in D6 and will end up in D5 when I copy the styles over after some other stuff gets fixed.
Michelle
#15
Automatically closed -- issue fixed for two weeks with no activity.