Jump to content

Featured Replies

Posted

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.

Show your code, and show where you are putting it.

And what are trying to achieve?

  • 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}}

 

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 by Nathan Explosion

  • 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.

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 by Nathan Explosion

  • Author
8 minutes ago, Nathan Explosion said:

Those groups, and those forums, and show on forum index and in posts?

Only in posts

{{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}}

 

  • Author

This is it. Thank you.

Recently Browsing 0

  • No registered users viewing this page.