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) »
  • Link from "My Account" page to the CiviCRM "View Contact" page
Pages: [1]

Author Topic: Link from "My Account" page to the CiviCRM "View Contact" page  (Read 1774 times)

joemaine

  • I post occasionally
  • **
  • Posts: 114
  • Karma: 3
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.14
  • MySQL version: 5.1
  • PHP version: 5.2
Link from "My Account" page to the CiviCRM "View Contact" page
July 01, 2009, 08:50:35 am
Having the link from the CiviCRM "View Contact" page is great.

Is there a code snippet that can be placed on the "My Account" page (user-profile.tpl.php) that would allow only an admin to link to the CiviCRM contact?
--
Joe

emilyf

  • Ask me questions
  • ****
  • Posts: 696
  • Karma: 54
  • CiviCRM version: 2.x - 4.x
  • CMS version: Drupal 5, 6, 7
Re: Link from "My Account" page to the CiviCRM "View Contact" page
July 01, 2009, 09:00:09 am
something like this should work:

Code: [Select]
<?php
global $user;

if (
in_array('admin', $user->roles) ){

print 
the civi link here

}
?>


where 'admin' is the name of the role you are trying to isolate...assuming you are talking about a role that is for administrators and not just the admin user 1.

joemaine

  • I post occasionally
  • **
  • Posts: 114
  • Karma: 3
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.14
  • MySQL version: 5.1
  • PHP version: 5.2
Re: Link from "My Account" page to the CiviCRM "View Contact" page
July 01, 2009, 09:42:00 am
Hi Emily,

That didn't seem to work.

Prior to 2.2.3 the following used to work...
<?php if (in_array('administrator user',$GLOBALS['user']->roles)): ?>
   <p id="content-profile-view"><a href="/user/<?= $account->uid ?>/edit/Personal%20Profile">Edit <?= $account->name ?>'s Drupal Personal Profile.</a><br /><a href="http://<?= $_SERVER['HTTP_HOST'] ?>/civicrm/contact/view?reset=1&cid=<?= $userID ?>">View <?= $account->name ?>'s CiviCRM Profile.</a>

am I missing something else?
--
Joe

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Link from "My Account" page to the CiviCRM "View Contact" page
July 01, 2009, 12:50:17 pm
Joe - not sure if this fits your use case(s) - but in case you haven't tried this, removing 'access CiviCRM' permission for the user causes the "View Contact Record" link to go away.
Protect your investment in CiviCRM by  becoming a Member!

joemaine

  • I post occasionally
  • **
  • Posts: 114
  • Karma: 3
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.14
  • MySQL version: 5.1
  • PHP version: 5.2
Re: Link from "My Account" page to the CiviCRM "View Contact" page
July 01, 2009, 01:34:42 pm
Hi Dave,

I have the functionality only turned on for Admin - and in this role, being able to see the "View Contact Record" is excellent. What I'm trying to do is have a return link from the Drupal listing to the CiviCRM record.

...and I just did get it to work - if I can put the code into anything that makes sense, I'll post it back here.
--
Joe

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Link from "My Account" page to the CiviCRM "View Contact" page

This forum was archived on 2017-11-26.