Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted June 26, 20222 yr 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.
June 26, 20222 yr Author 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}}
June 26, 20222 yr 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, 20222 yr by Nathan Explosion
June 26, 20222 yr Author 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.
June 26, 20222 yr 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, 20222 yr by Nathan Explosion
June 26, 20222 yr Author 8 minutes ago, Nathan Explosion said: Those groups, and those forums, and show on forum index and in posts? Only in posts
June 26, 20222 yr {{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}}