Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Nexus_Web_Media Posted June 26, 2022 Posted June 26, 2022 Hello everybody, I'm looking for solution to display text only in specific forums. I've checked forum but I can't find solution for my problem. I've found this but section " Check if the current forum is forum ID x" don't work for me.
Nathan Explosion Posted June 26, 2022 Posted June 26, 2022 Show your code, and show where you are putting it. And what are trying to achieve?
Nexus_Web_Media Posted June 26, 2022 Author Posted June 26, 2022 I'm puting my code in forums -> topics -> post template. I want to display text in every post for specific groups in specific forums. My code: {{if in_array( \IPS\Member::loggedIn()->member_group_id, array( 2, 3, 4, 8, 10, 16, 19 ) )}} {{elseif request.app == 'forums' && request.module == 'forums' && request.id == 3}} <center> sample text </center> {{endif}}
Nathan Explosion Posted June 26, 2022 Posted June 26, 2022 (edited) Which specific groups and in which specific forums? Knowing this will help with checking your code - the above currently means that: If they are in the listed groups then show nothing, otherwise if the forum is 3 then show something, otherwise nothing (go with \in_array, by the way) Edited June 26, 2022 by Nathan Explosion
Nexus_Web_Media Posted June 26, 2022 Author Posted June 26, 2022 6 minutes ago, Nathan Explosion said: Which specific groups and in which specific forums? Groups IDs: 2, 3, 4, 8, 10, 16, 19 Forum IDs: 3, 15, 23, 56, 73 Code above maybe runs in forum display but in post doesn't work.
Nathan Explosion Posted June 26, 2022 Posted June 26, 2022 (edited) 13 minutes ago, Nexus_Web_Media said: post doesn't work. Yep, because request.id will be the id of the topic. Is that the entirety of the requirement? Those groups, and those forums, and show in posts? Edited June 26, 2022 by Nathan Explosion
Nexus_Web_Media Posted June 26, 2022 Author Posted June 26, 2022 8 minutes ago, Nathan Explosion said: Those groups, and those forums, and show on forum index and in posts? Only in posts
Nathan Explosion Posted June 26, 2022 Posted June 26, 2022 {{if \IPS\Member::loggedIn()->inGroup(array(2, 3, 4,8, 10, 16, 19)) AND \in_array($item->container()->_id,array(3, 15, 23, 56, 73))}} STUFF {{endif}}
Recommended Posts