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
Should we all get together and come up with some theme hook and filter locations before we get too deep into this?
Avatar
Lee H
Coastal New England (USA)
Member
Free Members
sp_UserOfflineSmall Offline
Jul 21, 2011 - 9:40 pm

I was tinkering around tonight with a theme idea and got to thinking (maybe too much).

I was relocating the "spPostAction" section and all it's contents when I noticed a few if(function_exists) that were testing for active plugins, and then creating buttons for them if the functions exist.

This is fine and all if the theme authors were aware of each and every plugin out there that would require a button in the action section. Wouldn't it be wise to come up with some sort of "standard" sections and provide standard hooks or filters that plugin authors could safely assume existed?

I'm not to keen on authoring a theme knowing I will have to review each and every new plugin to see if it requires a button.  And then update the theme accordingly. I'd much rather make standard named sections with standard hooks, filters or both and leave it up to the plugin authors to hook into them.

Here's a code example taken from the default theme wp-content/forum-themes/default/templates/spTopicView.php

                            sp_SectionStart('tagClass=spPostActionSection', 'action'); 
                                sp_GoToTop('tagClass=spRight spGoToTop&iconClass=spIcon', '', __sp('Go to Top', 'spDefault')); 
                                sp_PostIndexNumber('tagClass=spLabelBordered spLeft'); 
                                sp_PostIndexEditHistory('tagClass=spButton spLeft', __sp('', 'spDefault'), __sp('Edited by %USER% at %DATE%', 'spDefault'), __sp('View edit history', 'spDefault')); 
                                sp_PostIndexPermalink('tagClass=spButton spLeft', __sp('', 'spDefault'), __sp('Display post permalink', 'spDefault')); 
                                sp_PostIndexPrint('tagClass=spButton spLeft', __sp('', 'spDefault'), __sp('Print this post', 'spDefault')); 
                                if (function_exists('sp_PostIndexRatePost')) sp_PostIndexRatePost('tagClass=spLabelBordered spPostRating spRight'); 
                                if (function_exists('sp_PostIndexReportPost')) sp_PostIndexReportPost('tagClass=spButton spRight', __sp('Report', 'spDefault'), __sp('Report this post to admin', 'spDefault')); 
                                sp_PostIndexQuote('tagClass=spButton spRight', __sp('Quote', 'spDefault'), __sp('Quote this post and reply', 'spDefault')); 
                                sp_PostIndexEdit('tagClass=spButton spRight', __sp('Edit', 'spDefault'), __sp('Edit this post', 'spDefault')); 
                                if (function_exists('sp_PostIndexSendPm')) sp_PostIndexSendPm('tagClass=spButton spRight', __sp('PM', 'spDefault'), __sp('Send PM to this user', 'spDefault')); 
                            sp_SectionEnd('', 'action');
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jul 22, 2011 - 8:00 pm

there is no perfect solution here.. much like wp themes and plugins... 

and we opted to go with the same path as wp...  with many plugins for wp, you have to add the template tag call yourself in the theme if you want to use it...  it sort of becomes the users responsibility not the theme author...

we can create some standard named sections and have done so in our default theme, but again, not required to be used...  leaving plugins to expect a named section will be just as troublesome...  I can easily envision a theme design where I will want different 'buttons' in different locations... a single name section for plugins to hook into, wont be sufficient... 

the current method actually has the most flexibility and customizability, but you are right, will be difficult for themes to support all the plugins out of the box...  we toyed with our default theme and whether we should do the function exists checks and include buttons for the plugins we have created... or just leave them out and have users add them...  you can see which way we went...

but all that said, we are certainly willing to discuss this further as its one of the reasons we wanted to have the alpha...  any different solution will need to allow plugins or themes to place components wherever they want...

so, please keep discussing...

Avatar
Lee H
Coastal New England (USA)
Member
Free Members
sp_UserOfflineSmall Offline
Jul 22, 2011 - 8:36 pm

I can't argue with your logic. I have pulled a couple buttons out of the group as you mentioned and can see the problems. It is unfortunate however the user will have to place the button code themselves and then deal with the styling as well. But I suppose admins, like it or not need to learn a little code from time to time.

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