Skip to content

Instantly share code, notes, and snippets.

@davist11
Last active December 16, 2015 22:09
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davist11/5504970 to your computer and use it in GitHub Desktop.
Save davist11/5504970 to your computer and use it in GitHub Desktop.
EE Entry previewing
<?php
public function sessions_end($session)
{
if ($session->userdata['can_access_cp'] === 'y') {
$new_global_vars['gv_can_preview'] = TRUE;
} else {
$new_global_vars['gv_can_preview'] = FALSE;
}
$this->EE->config->_global_vars = array_merge($new_global_vars, $this->EE->config->_global_vars);
}
{exp:channel:entries
channel="press_release"
limit="1"
require_entry="yes"
status="open{if gv_can_preview}|preview{/if}"
{gv_channel_disable_most}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment