Support Forum
I had a scour of the changelog and so all I can assume is that my version control is lousy, this is likely because as you know I spend much of my time in a befuddled state. So Andy help me get it working again.
To reiterate.
I have custom group and forum icons
I have the need for iconUnread in group view.
Step1 should be to declare the iconUnread in the array, correct?
I am pretty sure that the previous code worked or I would not have posted it up as a solution.
I really am confused here.
When I use what I think is the correct code then the custom group icons stop working and the iconUnread does not work either.
Here is what I think is the correct code:
<?php /* Simple:Press Template Function Handler $LastChangedDate: 2012-02-15 17:45:19 -0700 (Wed, 15 Feb 2012) $ $Rev: 7951 $ */ if (preg_match('#'.basename(__FILE__).'#', $_SERVER['PHP_SELF'])) die('Access denied - you cannot directly call this file'); # ====================================================================================== # # GROUP VIEW # Group Loop Functions # # ====================================================================================== # -------------------------------------------------------------------------------------- # # sp_GroupHeaderIcon() # Display Group Icon # Scope: Group Loop # # -------------------------------------------------------------------------------------- function sp_GroupHeaderIcon($args='') { global $spThisGroup; $defs = array('tagId' => 'spGroupHeaderIcon%ID%', 'tagClass' => 'spHeaderIcon', 'icon' => 'sp_GroupIcon.png', 'iconUnread' => 'sp_ForumIcon_new_post.png' , 'echo' => 1, 'get' => 0, ); $a = wp_parse_args($args, $defs); $a = apply_filters('sph_GroupHeaderIcon_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%', $spThisGroup->group_id, $tagId); # Check if a custom icon if ($spThisForum->unread) { $icon = $iconUnread; $icon = SPTHEMEICONSURL.sanitize_file_name($icon); } else if (!empty($spThisForum->forum_icon)) { $icon = SFCUSTOMURL.$spThisForum->forum_icon; } else { $icon = SPTHEMEICONSURL.sanitize_file_name($icon); } if ($get) return $icon;
then the custom group icons stop working and the iconUnread does not work either.
Whats that if not a description of the problem
To be more specific when in Group View before I latest upgrade the I had the following functionality:
- custom group Icon
- custom forum icon
- custom iconUnread
When there was a new post in a forum my custom group Icon displayed correctly, and the forum icon changed to the custom iconUnread. If there were no new posts then I would see the custom group icon and custom forum icon. I believe that the code I have posted used to work.
Now what happens is that the custom group icon defaults to the theme default, the custom forum icon still works OK and the iconUnread does not function. I have tried to find a full system backup of the overwritten core file but I use rsync to back up the site and then delete stuff older than a week so I have lost the original file.
Conrad
Yes it is there in the current custom theme. Furthermore why does the Group icon set as a custom icon in the admin forum editor cease to display and instead sp_GroupIcon.png is displayed? If I revert to the standard sp-group-view-functions.php file as provided with the current release then the custom icon is displayed.
It is most odd and has me utterly flummoxed.
Conrad
its part of the 'if' check... if a custom icon does not exist, that means saved on the group edit panel, the default is used...
Visit Cruise Talk Central and Mr Papa's World
Yes but it DOES exist and it is saved on the group edit panel. As I repeatedly keep saying when I use the current default file from the current release version of 5.0 the custom icon displays correctly, that is what I don't understand. Clearly if it did not exist then the custom icon would not display in this case.
Conrad
OK - I see what you are doing.
This will not now and never would have worked. And that is 100% never.
You are trying to use $spThisForum->unread at the group level. This data object exists at the forum level - NOT group. Even if you made it global and even if it had a pointer to a forum at that point (which it should not have) you would still only interrogate the first forum in the list.
There is no Group level unread flag available and never has been. One would need to loop through each forum in the group to determine if any of them had an unread flag set before this could happen. And it does not happen.
What you did at forum level - which is fine - can not just be replicated on a different data object.
YELLOW
SWORDFISH
|
1 Guest(s)