Support Forum

Change Forum & Topic Icon in case of new post

CU CuberToy
CuberToy
Member

Hi!

 

So, after taking care of my issues, I began to make my own theme editing the css-only one.

Is there any way to make the Forum Icon and Topic Icon change in case of new post ? Personnaly, I don’t dislike your method (the little bubble) but most of people are used to the Icon changing and It could be usefull to add it.

 

Thanks in advance ! ^^

55 Answers

New Answer

PR Propheticus
Propheticus
Member

Sadly, using just CSS styling and the available options there currently doesn’t seem to be an easy way to do this. The standard themes do not change the Class or ID for Forum/Topic icons when there’s a new post. So, there’s no class/id to refer to in your CSS styling.

It is possible though. It just takes quite a bit of coding in some of the template files. Our own community is lucky to have an in-house programmer that knows his way around PHP. He has recently ‘hacked’ this feature into our custom theme, after receiving similar requests from our user base.

I do understand some PHP and could post the code and try to explain it a bit. Nevertheless, I think it’s wiser to let him elaborate on the matter if he feels like it 😛

MP Mr Papa
Mr Papa
Member

we have added a new class to an forum or topic row if it has unread topics/posts in it…  its in svn, but not sure it was in last update… should be tomorrow…

also thought we had a separate icon already, but will have to let Andy jump in here…

YS Yellow Swordfish
Yellow Swordfish
Member

You need to supply the alternate icon but you can change both the forum icon (Group View) and the topic icon (Forum View) by passing the argument ‘iconUnread=xxxx.png’ in the arguments list of the relevant function in the group and forum templates. This will then use the alternate ‘unread’ icon if the parent contains unread posts.

CU CuberToy
CuberToy
Member

Nice ! Thanks all of you. I’ll try that tomorrow (getting late here :p) and report.

DA Dave
Dave
Member

Would you mind giving an example of iconUnread=xxxx.png in use?

CU CuberToy
CuberToy
Member

Ok so I’ve change the line (2245 in sp-forum-view-functions.php & 659 in sp-group-view-functions.php) and it works great. The only question is, is this possible without midifiying the core file (directly in the theme… cant find out where to put it if there’s a way).

YS Yellow Swordfish
Yellow Swordfish
Member

For both Dave H and CuberToy:

As we have not got the documentation up and running yet here is a quick shot at it.

You will be editing the template for the theme you are using. As always – remember that if you edit one of the supplied themes then it will be overwritten on a subsequent update so it is recommended to make your own theme by copying the exiting one you are using.

So – to make this change to the forum view (list of topics) go to the templates folder of the thee and open the template for Forum View.

If you take a little time to read through it you will see how this constructs the forum view display. It is really pretty straightforward.

In this case the function that displays the topic icon is probably in the theme as:

sp_TopicIndexIcon('tagClass=spRowIcon spLeft');

each function has a pre-defined set of arguments that can be passed but you only need to pass one if you want to change the default. To add an alternative icon  as requested then change the above to read:

sp_TopicIndexIcon('tagClass=spRowIcon spLeft&iconUnread=iconname.png');

Note the ampersand delimiter (just like WP template tag functions) and no spaces between arguments. You will, of course, have to supply the icon in the themes images folder and name it correctly in the argument above.

CU CuberToy
CuberToy
Member

Totally missed that line while searching. It works great.

Thanks a lot ! (Now, just have to make thess icons :p)

 

If it can help. Theses lines are in :

For Forum : spForumView.php line 143

For Group : spGroupView.php line 47

on the css-only theme.

 

Don’t worry, I’ve created a new folder as well ^^

DA Dave
Dave
Member

Will a path work so we can store the icons in the custom icons folder alongside our other custom icons(I’m thinking of the custom forum icons I’ve created)?

CU CuberToy
CuberToy
Member

I’ve tried (just to see) don’t seems to work. In fact that make sense.

Personnally, I put them in the images folder in the theme folder (as it is my theme, no need for other icon than the one I’m doing right now).

YS Yellow Swordfish
Yellow Swordfish
Member

No sorry – these need to go with the theme.

FYI however, the next updates we release to SP core and plugins WILL allow you to store custom icons you might create for plugins also in the theme images folder which will preserve them from future plugin updates. This was already the case for a plugin’s CSS file.

DA Dave
Dave
Member

OK, Maybe my eyes are tired, but I’ve added the following (along with a corresponding icon in the theme folder)…

# Start the ‘groupHeader’ section
sp_SectionStart(‘tagClass=spGroupViewSection’, ‘groupHeader’);
sp_GroupHeaderRSSButton(‘tagClass=spButton spRight’, __sp(‘Group RSS’), __sp(‘Subscribe to the RSS feed for this forum group’));

sp_GroupHeaderIcon(‘tagClass=spHeaderIcon spLeft&iconUnread=sp_GroupIconUnread.png‘);
sp_GroupHeaderName(‘tagClass=spHeaderName’);
sp_GroupHeaderDescription(‘tagClass=spHeaderDescription’);
sp_GroupHeaderMessage(‘tagClass=spHeaderMessage’);

I’ve had another user create a new topic in a forum belonging to the group and there is no change in the icon.

YS Yellow Swordfish
Yellow Swordfish
Member

Does the new post status icon along the group row report the new post?