Activity Stream background different for admins and groups
-
Is there a tutorial or has someone been able to create a quick step by step on how to get the background color unique in the site wide activity stream for admins or different groups? What I’d like is all the admins activity to have a light blue background. Is this even possible?
-
Well I don’t know the best way to do this but you could just wrap a div around the activity if bp_activity_id is an admin id and just format that div with css… the hooks you need are ‘bp_before_activity_entry’ and ‘bp_after_activity_entry’
After some help on other issues, this one is back to the forefront. The suggestion for a div tag seems reasonable, except the particulars are not very clear.
This was done in the forums using functions:
`function my_forum_is_first_post() {
global $topic_template;if ( $topic_template->post->post_position == 1 )
return true;
return false;
}function my_admin_post() {
global $topic_template;if ( $topic_template->post->poster_id == 1 || $topic_template->post->poster_id == 117 || $topic_template->post->poster_id == 126 )
return true;
return false;
}`might point you in the right direction
http://etivite.com/groups/buddypress/forum/topic/quick-tip-highlight-friends-following-own-activity-stream-items/#topicThank you!
This is the function added:
`function my_activity_css_class( $class ) {
global $bp, $activities_template;if ( $activities_template->activity->user_id == 1 )
return trim( $class .’ highlightpost-mine’ );return $class;
}
add_filter( ‘bp_get_activity_css_class’, ‘my_activity_css_class’ );`This is the css put with that code and the css sort of works in the activity stream but is not beautiful.
`ul.activity-list li.highlightpost-mine {
background-color:#ebf7ff;
}`It’s late so maybe next weekend.
CSS can’t make something beautiful that’s a design consideration, you have the control required now though.
p.s always use shorthand CSS property declarations, unless there is a specific reason to need to state the sub properties so ‘background’ rather than background-color’ initially, background-color if preserving a previously declared background containing an image call or other background properties.On a sidenote as a rule of thumb adding markup should be considered a last resort, especially ‘divs’, unless generating actual new elements.
As is often the case dynamic site apps such as WP, Drupal et al have a tendency to divitis or markup bloat, generating much markup where it’s not absolutely necessary, not a huge problem, but slows page loads, and creates overcomplicated DOM structures.
@hnla – thank you.
So, the proper css for the function would be:
`ul.activity-list li.highlightpost-mine {
background: #ebf7ff url(/images/ctr.png) no-repeat;
background-position:100% 99%;
padding: 4px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
-moz-box-shadow: 2px 2px 2px #ebf7ff;
-webkit-box-shadow: 2px 2px 2px #ebf7ff;
margin:40px;
}div.activity-comments ul li {
background: #ebf7ff url(/images/ctr.png) no-repeat;
background-position:100% 99%;
padding: 4px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
-moz-box-shadow: 2px 2px 2px #ebf7ff;
-webkit-box-shadow: 2px 2px 2px #ebf7ff;
}`Somewhat depends; are you only styling the highlighted li and li elements in comments as that has a bearing on the placement of the graphic.
Only the properties that actually change need be stated so you would really state your more generic li styles first, setting up the overall styling for a list in this parent or antecedent then state the more specific li elements with a classSo all li elements that have styles in common are declared first, something like:
ul.activity-list ul li {}
Then your commnets li styling
and lastly your more specific li.highlightpost-mine class which would carry only the styles needed to override existing ones or add new ones; If that is just a background color then as you have declared previously a ‘background’ stating color and image you would use background-color to override just the color otherwise you would lose the graphic.
If the background for those two elements is as wanted i.e you want the graphic on the activity-commnets li elements as well as the highlight class then it would be easiest to group the declaration and lose the background-position (shorthand statements cover all sub properties) so ‘position’ should be within the ‘background’ declaration
`
ul.activity-list li.highlightpost-mine,
div.activity-comments ul li {
background: #ebf7ff url(/images/ctr.png) no-repeat 100% 99%;
}
`Thank you. There is so much to learn about css.
- The topic ‘Activity Stream background different for admins and groups’ is closed to new replies.