Jump to content

IS there a way to test a members ID in the template?


Recommended Posts

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 by SJ77
Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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 by Adriano Faria
Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...