Help
General ArrowChat talk that doesn't fit any other forum.
User avatar
jackal
Customer
 
Posts: 102
Joined: 06 May 2019, 15:29

 

by jackal 19 Oct 2022, 06:47

Does anyone know an example of an "if" statement code?

Something like this that could work in Arrowchat?

<?php if: group_id = 5 >
Displays message A
<elseif: group_id = 1 >
Displays message B
?>
User avatar
Jason
Customer
 
Posts: 2329
Joined: 12 Dec 2009, 16:06

 

by Jason 19 Oct 2022, 09:19

There isn't any support for that. Where are you trying to put it? In an HTML or JavaScript file?
User avatar
jackal
Customer
 
Posts: 102
Joined: 06 May 2019, 15:29

 

by jackal 19 Oct 2022, 13:19

If possible add it somewhere in the file /public/mobile/index.php

I am trying to display a message to my "free members" only (who are in group permission #9)

Any help would be nice.
User avatar
Jason
Customer
 
Posts: 2329
Joined: 12 Dec 2009, 16:06

 

by Jason 20 Oct 2022, 08:02

If possible add it somewhere in the file /public/mobile/index.php

I am trying to display a message to my "free members" only (who are in group permission #9)

Any help would be nice.
That's a normal PHP file, so you can do anything. The user's groups are stored in $group_id (array).
User avatar
jackal
Customer
 
Posts: 102
Joined: 06 May 2019, 15:29

 

by jackal 20 Oct 2022, 10:12

That's a normal PHP file, so you can do anything. The user's groups are stored in $group_id (array).
I tried a lot of different codes but none work

<?php if ($group_id == 9) { ?>
Message to free members.
<?php } ?>

What am I doing wrong?
User avatar
jackal
Customer
 
Posts: 102
Joined: 06 May 2019, 15:29

 

by jackal 21 Oct 2022, 14:40

$group_id (array) ?? Alittle help?

<?php if $group_id == (9) { ?>
Message to free members.
<?php } ?>

el que no llora no mama.
User avatar
Jason
Customer
 
Posts: 2329
Joined: 12 Dec 2009, 16:06

 

by Jason 22 Oct 2022, 10:48

if (in_array(9, $group_id))

That is what you're looking for. If you need to do other things with it, just search for info on PHP arrays.
User avatar
jackal
Customer
 
Posts: 102
Joined: 06 May 2019, 15:29

 

by jackal 24 Oct 2022, 09:28

if (in_array(9, $group_id))

That is what you're looking for. If you need to do other things with it, just search for info on PHP arrays.
That's exactly what I was looking for, thank you, sir !!!