Support Forum
Hello SP community
I looking for a way to disable mycred plugin ( but also other plugins if is it possible ) on specific forums & groups.
Ex: i've mycred hook plugin that gives points for opened topics, likes and dislikes. But i've also an off-topic forum full of "spam" and i should avoid that my users can gain any kind of points in that section..
Is there a way to disable mycred on that forums, or just some of its functions ( such as points on opened topic etc ) ?
You can certainly optionally display any component on any of the main forum views but it does mean making edits to the templates of course - which would then require a custom theme to avoid losing those edits on future updates. So that would be the first thing to do. If only one template is involved then a child theme would be the best way to go. There are instructions for both in our codex 'themes' section.
Then it is a matter of locating the display function in the appropriate template and wrapping some conditional statements around it - like 'if' statements - to determine if the component should be displayed or not. As I do not know how well your coding in php is then it is hard to target the right level of explanation - but it is a simple matter.
If you go to the forum admin > toolbox > data inspector then you can turn on displays of the underlying data object for each view and each segment of the view. This data is available to the template through global standard objects.
Now - of course - the above applies to any plugin code that has a display component which itself triggers some sort of activity (like post rating or post thanks for example). The MyCred extension is a different matter as that is triggered by the post save action. The only way to to prevent that is to remove the hooks (standard WordPress hook behaviour) under conditional circumstances which should be able to be achieved in the spFunctions.php template. The appropriate hooks are, if I recall correctly, actually defined in the WP myCred plugin - I would need to download it again to ascertain the actual hook names being used.
YELLOW
SWORDFISH
|
thanks for fast reply 🙂
i don't need to disable thanks/like display since they can continue to use it but they shouldn't assign Points.
So i think i need just a "filter" that avoid mycred points addition/subtraction on specific forums.
The MyCred plugin is quite simple ... and i din't understand where options are stored .
I've also found sp_mycred_process_points and sp_mycred_get_settings , functions inside it but they seems not used ( deprecated maybe? )
So..A simple ( ugly ) workaround would be to "deregister" hook_simplepress_extensions totally when i'm on specific forums. Could you help me to find the best way to do it?
I think you can do myCred (and I have not tried as it would need some time to set things up) by removing the myCred filter that is added by:
add_filter( 'mycred_setup_hooks', 'SimplePress_myCRED_Hook' );
Look at the WP remove_filter() function for this.
Assuming then you want this on the forum view (to stop a new topic action) and the topic view (to stop a new post to a topic) then the two globals involved there are:
$spThisForum and $spThisTopic
both of which have a 'forum_id' property.
So you need to test (a) if that global is defined and (b) if it is the correct forum. There is also a global array (NOT object) called
$spVars
which has an element named 'pageview' which will tell you whether the current page is the group, forum or topic view. Using a combination of these will stop notices and warnings being generated of course.
YELLOW
SWORDFISH
|
1 Guest(s)