Not sure why, but this won’t work…
$x = {logged_in_group_id};
but this will
$x = “{logged_in_group_id}”;
I figure, fine, ill just input it as a string and then to convert to a integer with this:
$x = intval(“{logged_in_group_id}”);
But this just returns nothing.
Not sure what’s up.
I tried the three variants:
$x = intval(”{logged_in_group_id}”);
$s = ”{logged_in_group_id}”; $x = (int)$s;
$x = ”{logged_in_group_id}”; settype($x, “integer”);
None of these work.
I have found, however, that they DO work if I replace {logged_in_group_id} with a normal integer… For instance – this works.
$x = intval(”1”);
I think this may be an expression engine thing?
Mixing PHP and EE tags can be complicated. Why not simply use the full session class?
I’m not too familiar with the session class. This doesn’t seem to be working.
<?php
$aRestrictedID = array();
$currentGroupID = $this->EE->session->userdata('group_id');
{exp:weblog:entries weblog="page"}
$aRestrictedID[]= 1;
{restrict_page}$aRestrictedID[]= {restrict_to_id};{/restrict_page}
{/exp:weblog:entries}
if ( in_array ( $currentGroupID , $aRestrictedID ) ) {
?>
test
<?php
}
?>Mixing PHP and EE tags can be complicated. Why not simply use the full session class?
THANK YOU!!!!!!
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.