Support Forum
I am using a custom Icon for the forums and I have created another Icon with an indicator to show that there are unread posts in that forum when in group view.
I have used the iconUnread facility in forum view with no problems and copied what I did into spGroupView.php but to no avail.
Here's the code from the relevant section of the sp-group-view-functions.php file. Why is my alternate icon not being displayed? I figure it may have something to do with the first if statement but
function sp_ForumIndexIcon($args='') { global $spThisForum; $defs = array('tagId' => 'spForumIndexIcon%ID%', 'tagClass' => 'spRowIcon', 'icon' => 'sp_ForumIcon.png', 'iconUnread' => 'sp_ForumIcon_new_post.png', 'echo' => 1, 'get' => 0, ); $a = wp_parse_args($args, $defs); $a = apply_filters('sph_ForumIndexIcon_args', $a); extract($a, EXTR_SKIP); # sanitize before use $tagId = esc_attr($tagId); $tagClass = esc_attr($tagClass); $echo = (int) $echo; $get = (int) $get; $tagId = str_ireplace('%ID%', $spThisForum->forum_id, $tagId); # Check if a custom icon if (!empty($spThisForum->forum_icon)) { $icon = SFCUSTOMURL.$spThisForum->forum_icon; } else { if ($spThisForum->unread) $icon = $iconUnread; $icon = SPTHEMEICONS.sanitize_file_name($icon); } if ($get) return $icon; $out = "<img id='$tagId' class='$tagClass' src='$icon' alt='' />\n"; $out = apply_filters('sph_ForumIndexIcon', $out, $a); if ($echo) { echo $out; } else { return $out; }
Of course the icon is in the theme images folder, the custom icon is still displayed for the forum.
you said you have custom icons... the code above first checks for that and uses it if it exists... so your check never occurs...
Visit Cruise Talk Central and Mr Papa's World
Ah I see it now, the code below works and will insert an icon when there are unread posts whether you have a custom forum icon or not.
I don't know if it's a good way of doing it or not but if there is a better way I'd like to know it.
if ($spThisForum->unread) { $icon = $iconUnread; $icon = SPTHEMEICONS.sanitize_file_name($icon); } else if (!empty($spThisForum->forum_icon)) { $icon = SFCUSTOMURL.$spThisForum->forum_icon; } else { $icon = SPTHEMEICONS.sanitize_file_name($icon); } if ($get) { return $icon;
Yes - the way things stand at the moment if you have a custom icon set then the same one will be used in all circumstances.
This is a much bigger change than just adding something to a theme template as it would mean a change to the database tables for groups and forums, and changes to the create/edit forum and group forms in the admin so that two custom icons could be applied to items instead of one.
I am not saying it wont happen but it is beyond the scope of V5.0 now in RC. We will revisit though for a future change.
YELLOW
SWORDFISH
|
1 Guest(s)