Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
themes-topic
Change Forum & Topic Icon in case of new post
Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 28, 2012 - 9:54 am

I am unaware of any changes in that area. Was there anything in the changelog?

andy-signature.png
YELLOW
SWORDFISH
Avatar
Conrad_Farlow
Sheffield, UK
Member
Free Members
sp_UserOfflineSmall Offline
Feb 28, 2012 - 10:31 am

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;
Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 28, 2012 - 10:38 am

But you still have not answered the question. You keep saying it doesn't work but you don't say in what way it doesn't work.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Conrad_Farlow
Sheffield, UK
Member
Free Members
sp_UserOfflineSmall Offline
Feb 28, 2012 - 11:22 am

then the custom group icons stop working and the iconUnread does not work either.

Whats that if not a description of the problem wink

 

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

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 28, 2012 - 11:37 am

'does not work' does not necessarily mean 'does not display'. It can mean it displays something else.

Then the code looks fine. So what about the custom unread icon? You have that in the theme folder... is it actually there?

andy-signature.png
YELLOW
SWORDFISH
Avatar
Conrad_Farlow
Sheffield, UK
Member
Free Members
sp_UserOfflineSmall Offline
Feb 28, 2012 - 8:05 pm

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

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Feb 28, 2012 - 8:11 pm

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...

Avatar
Conrad_Farlow
Sheffield, UK
Member
Free Members
sp_UserOfflineSmall Offline
Feb 28, 2012 - 9:17 pm

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

Avatar
Conrad_Farlow
Sheffield, UK
Member
Free Members
sp_UserOfflineSmall Offline
Feb 29, 2012 - 5:28 am

Andy is there any possibility that you could try that code on a test site for me today? I'm convinced that something has caused the behaviour of the code to change.

I'm under pressure to get the facility working before launching V5.0 on the live site early next week.

Conrad

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 29, 2012 - 7:14 am

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.

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17365
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626