SJ77 Posted March 24, 2022 Posted March 24, 2022 (edited) 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, 2022 by SJ77
TAMAN Posted March 24, 2022 Posted March 24, 2022 {{if \IPS\Member::loggedIn()->inGroup(2)}} dasdsdfsds {{endif}} SJ77 1
SJ77 Posted March 24, 2022 Author Posted March 24, 2022 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)
Adriano Faria Posted March 24, 2022 Posted March 24, 2022 (edited) 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, 2022 by Adriano Faria SJ77 1
SJ77 Posted March 24, 2022 Author Posted March 24, 2022 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 Adriano Faria 1
Recommended Posts