CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • A hopefully simple Smarty question...how to have CiviCRM check if logged in?
Pages: [1]

Author Topic: A hopefully simple Smarty question...how to have CiviCRM check if logged in?  (Read 993 times)

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
A hopefully simple Smarty question...how to have CiviCRM check if logged in?
May 29, 2009, 07:31:19 pm
If someone is not logged in to Drupal, I wish to display certain text on a CiviCRM .tpl file.

How would I accomplish this?

I have searched about 20 minutes in Drupal, Smarty and CiviCRM documentation, CiviCRM forum with no applicable results.


Thanks!
« Last Edit: May 29, 2009, 07:41:32 pm by Stoob »
Try CiviTeacher: the online video tutorial CiviCRM learning library.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: A hopefully simple Smarty question...how to have CiviCRM check if logged in?
May 29, 2009, 08:29:52 pm

try this:

Code: [Select]
{if $session->get('userID') == 0}
ANON USER
{else}
LOGGED IN USER WITH USERID: {$session->get('userID')}
{/if}
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: A hopefully simple Smarty question...how to have CiviCRM check if logged in?
May 30, 2009, 11:17:54 am
Thanks, works great!
Try CiviTeacher: the online video tutorial CiviCRM learning library.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • A hopefully simple Smarty question...how to have CiviCRM check if logged in?

This forum was archived on 2017-11-26.