x
 
Create New Page
 View Previous Changes    ( Last updated by Hop Studios )

Using Session Variables Via PHP

Question: How can I retrieve EE variables such as member_id to use in PHP code? For example to create an edit link for articles.

Answer: You can do the following:

<?php 
global $SESS
$member $SESS->userdata['member_id']
$group $SESS->userdata['group_id']

if ((
$member == {author_id}) || ($group == 1)) 
echo 'The edit link goes here.'

 


?> 

NOTE: The if statement is checking for the author_id matching the member_id or the group id of 1, which is the super admin.

Forum Link

Category:Templates Category:Members

Category:EE1

Categories: