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
Conrad_Farlow
Sheffield, UK
Member
Free Members
sp_UserOfflineSmall Offline
Mar 1, 2012 - 3:26 am

So that code snippet was for the forum viewembarassed

I did have some working code for group view but it has gone forever by the looks of things and I cannot remember how I did it. I did not loop through each forum though.

So what about using the appearance of sp_ForumStatusPost.png to trigger the use of alternate forum icon in group view?

Could you suggest an easy way of doing that?

I use the same icon for all forums, it is a custom one but it is the same icon. Only the group icons differ for each group.

Conrad

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Mar 1, 2012 - 4:01 am

Looping through the forums in a group is the only way to determine the information. And it is what we will basically need to do when and if we build this support in to the core. We just wont do it in the template function.

I have not tried this and really just do not have the time today to do so but you could ty something like this:

global $spGroupView;
$unread = false;
if($spGroupView->forums) {
    foreach($spGroupView->forums as $f) {
        if($f->unread) $unread=true;
    }
}
if($unread) {
    # you have some unreadposts it at least one forum within the group
}

At the end there - if the variable $unread is true then you know there is at least one forum with the unread flag set. If I have my code right of course.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Conrad_Farlow
Sheffield, UK
Member
Free Members
sp_UserOfflineSmall Offline
Mar 1, 2012 - 6:21 am

Andy I'm really sorry for taking up your time and we are talking at crossed purposes. I did want the forum icon to change if there is an unread post but in group view. Unbelievably I found the working code and here it is:

# 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;

To illustrate what I was actually trying to achieve here is a screen shot.

 

iconUnread_Group_view.pngImage Enlarger

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Mar 1, 2012 - 11:45 am

Glad you now have it sorted.

andy-signature.png
YELLOW
SWORDFISH
Avatar
MartiL
Member
Free Members
sp_UserOfflineSmall Offline
Mar 19, 2012 - 8:13 am

Conrad_Farlow said
To illustrate what I was actually trying to achieve here is a screen shot.

That's exactly what I want (or rather, my members ;)), but I can't figure it out frown

Can anybody post which templates to edit, and how, for the latest SP (5.0.3)?

Thank you!

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Mar 19, 2012 - 8:23 am

You can use an alternate icon for forum and topic listings when those have unread posts in them but this is currently limited to the use of theme icons and not one-off custom icons. That's easy and available now.

If you want to do the same things with custom icons then it requires changes to core code which are obviously not recommended as it gets lost on future updates. This will come along at some point but it is nit there yet.

So which do you want to go with?

andy-signature.png
YELLOW
SWORDFISH
Avatar
MartiL
Member
Free Members
sp_UserOfflineSmall Offline
Mar 19, 2012 - 8:33 am

Personally, I'd simply wait for this te become part of SP, but my members really miss that new-post-icon (please, don't ask me why, there's 3 easy ways to find new posts ... confused) so I guess we'll go with option 1, the easy way, so they're happy untill custom icons become available laugh

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Mar 19, 2012 - 8:47 am

custom icons are available now... but limited to one... we already have a ticket open to do what Conrad did with his code to allow multiple icons...  probably in 5.1...

Avatar
MartiL
Member
Free Members
sp_UserOfflineSmall Offline
Mar 19, 2012 - 9:01 am

One custom icon would do the trick ...

There's 2 things stopping people from posting, because they find it too difficult: no new post icon and the editor not being visible (see https://simple-press.com/suppo.....t-or-topic).

Around 50% of my members are 55+ and not very 'computer savvy', so things have to be very self-explanatory and, I think, as much like phpBB as possible laugh

As you can see on the forum, I'm using a custom icon (http://vertrekkersinfo.nl/forum/) and I need a differt icon for forums/topics with unread posts ... ("just like all the other fora have" :)).

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Mar 19, 2012 - 10:21 am

Right. The templates are in the /templates folder of your SP theme and the icons in the /images folder.

You will need an icon to represent unread posts at forum l;evel and one at topic level. Both of these go in the /images folder with the rest of the icons. You can name these icons whatever you wish but I would avoid spaces in the name.

You will need to make edits to the spGroupView.php and spForumView.php templates. In both cases the edits are the same. So let's take spGroupView as the model.

Locate the template tag that displays the forum icons which is called sp_ForumIndexIcon(). You need to add an argument to the parameters being passed which are probably and by default:

'tagClass=spRowIcon spLeft'

Change this to:

'tagClass=spRowIcon spLeft&iconUnread=name_of_unread_icon.png'

inserting the name of your unread forum icon.

Do the same in the spForumView template for the topic icon tag - sp_TopicIndexIcon().

(Update): I should have added: As always we recommend that you create your own SP theme so that any customisation is not lost during a future update. (http://codex.simple-press.com/.....g-a-theme/)

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: 619
Members: 17361
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625