Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted March 24, 20222 yr HI, IS there a way to check member ID in the template? something like this {expression="\IPS\Member::load( $status->member_id )->link()" raw="true"} BUT with an if statement so it only happens if members are part of group 2 (for example) Template code for if member in group then Edited March 24, 20222 yr by SJ77
March 24, 20222 yr Author 11 minutes ago, TAMAN said: {{if \IPS\Member::loggedIn()->inGroup(2)}} dasdsdfsds {{endif}} If {$status->member_id} gave me a specific member id would it be possible to check the group of that respective member ID? something like this {{if \IPS\Member::{$status->member_id}->inGroup(2)}} dasdsdfsds {{endif}} (but obviously that doesn't work)
March 24, 20222 yr 22 minutes ago, SJ77 said: If {$status->member_id} gave me a specific member id would it be possible to check the group of that respective member ID? Nope. That member_id comes from the status table and it is the member who posted the status and it’s only the ID. You need to load that member, in your first example, to get the link(). I would do something like: {{$member = \IPS\Member::load( $status->member_id );}} {{if $member->inGroup( … )}} {$member->link()|raw} {{endif}} Not tested, of course. Using a phone now. Edited March 24, 20222 yr by Adriano Faria
March 24, 20222 yr Author 5 minutes ago, Adriano Faria said: Nope. That member_id comes from the status table and it is the member who posted the status and it’s only the ID. You need to load that member, in your first example, to get the link(). I would do something like: {{$member = \IPS\Member::load( $status->member_id );}} {{if $member->inGroup( … )}} {$member->link()|raw) {{endif}} Not tested, of course. Using a phone now. oh my goodness!!! THANK YOU.. you rock. Just what I needed