Removing user profile link

Tagged:  

We have been using project pier for the last few months and have found it an excellent tool. Until now we were using it to manage projects internally only, but now we intend to provide our clients access to it as well. I however, do not want contact information of our employees visible to our clients. Currently Project Pier shows active users as well as users who had messaged. I am fine with that but i would like to remove the profile link on their names so that the clients are not able to view their contact information. I would very appreciate if someone knows which files to edit to do this.

Thanks

I understand that you do not want to disclose contact information of employees to clients. Would it be okay to keep the links but display very basic information about the employee when the user is a client?

The background is that these links are everywhere and it would be a hard task to find all the places where to fix this. It is much easier to change the page that is displaying the user details based on the type of user.

Suppose, you have 2 clients participating in 1 project. You could have a rule that any client can only see the basic information of other clients participating in a project.

The most basic information would be name and company.

RE:

Thanks for the quick response. Yes if we could limit the information to name and company only for employees/users under our company that would work just fine.

We usually have a client and our company only participating in a project.

I look forward to further details for you.

Thanks again.

Fix

Okay, here is something that works and was tested in my 0.8.6 installation.

File application/views/user/user_card.php
Change line 14 (empty line) to

<?php if ( logged_user()->isMemberOfOwnerCompany() || ($user->getCompanyId() == logged_user()->getCompanyId()) ) { ?>

just before

    <h2><?php echo lang('contact online') ?></h2>

Change line 55 to

<?php } // if memberofownercompany ?> 

The last lines should look like this:

<?php } // if ?>
<?php } // if memberofownercompany ?> 
  </div>
</div>
<?php } // if ?>

Now, all member of the owner company can see all contact details of all users and members of a client company can see all details of their fellow company members in projectpier.

Something seems to be missing or wrong. I changed line 14 (empty line) to

<?php if ( logged_user()->isMemberOfOwnerCompany() || ($user->getCompanyId() == logged_user()->getCompanyId()) ) { ?>

Not sure what you were referring to by this:

just before

    <h2><?php echo lang('contact online') ?></h2>

Then you had mentioned :
Change line 55 to

<?php } // if memberofownercompany ?>

In my file line 55 is :

<td><?php echo clean($im_value->getValue()) ?> <?php if ($im_value->getIsDefault()) { ?><span class="desc">(<?php echo lang('primary im service') ?>)</span><?php } ?></td>

I changed the last lines to :
The last lines should look like this:

<?php } // if ?>
<?php } // if memberofownercompany ?>
  </div>
</div>
<?php } // if ?>

After uploading this file that page started throwing errors.

My full file "user_card.php" file looks like before changing code:

<?php if (isset($user) && ($user instanceof User)) { ?>

<div class="card">

  <div class="cardIcon"><img src="<?php echo $user->getAvatarUrl() ?>" alt="<?php echo clean($user->getDisplayName()) ?> avatar" /></div>

  <div class="cardData">

 

    <h2><?php echo clean($user->getDisplayName()) ?></h2>

   

    <div class="cardBlock">

<?php if ($user->getTitle()) { ?>

      <div><span><?php echo lang('user title') ?>:</span> <?php echo clean($user->getTitle()) ?></div>

<?php } ?>

      <div><span><?php echo lang('company') ?>:</span> <a href="<?php echo $user->getCompany()->getCardUrl() ?>"><?php echo clean($user->getCompany()->getName()) ?></a></div>

    </div>

   

    <h2><?php echo lang('contact online') ?></h2>

   

    <div class="cardBlock">

      <div><span><?php echo lang('email address') ?>:</span> <a href="mailto:<?php echo clean($user->getEmail()) ?>"><?php echo clean($user->getEmail()) ?></a></div>

<?php if ($user->hasHomepage()) { ?>

      <div><span><?php echo lang('homepage') ?>:</span> <a href="<?php echo $user->getHomepage() ?>" target=_BLANK><?php echo $user->getHomepage() ?></a></div>

<?php } ?>

<?php if (is_array($im_values = $user->getImValues()) && count($im_values)) { ?>

      <table class="imAddresses">

<?php foreach ($im_values as $im_value) { ?>

<?php if ($im_type = $im_value->getImType()) { ?>

        <tr>

          <td><img src="<?php echo $im_type->getIconUrl() ?>" alt="<?php echo $im_type->getName() ?>" /></td>

          <td><?php echo clean($im_value->getValue()) ?> <?php if ($im_value->getIsDefault()) { ?><span class="desc">(<?php echo lang('primary im service') ?>)</span><?php } ?></td>

        </tr>

<?php } // if ?>

<?php } // foreach ?>

      </table>

<?php } // if ?>

    </div>

   

<?php if ($user->getOfficeNumber() || $user->getFaxNumber() || $user->getMobileNumber() || $user->getHomeNumber()) { ?>

    <h2><?php echo lang('contact offline') ?></h2>

   

    <div class="cardBlock">

<?php if ($user->getOfficeNumber()) { ?>

      <div><span><?php echo lang('office phone number') ?>:</span> <?php echo clean($user->getOfficeNumber()) ?></div>

<?php } // if ?>

<?php if ($user->getFaxNumber()) { ?>

      <div><span><?php echo lang('fax number') ?>:</span> <?php echo clean($user->getFaxNumber()) ?></div>

<?php } // if ?>

<?php if ($user->getMobileNumber()) { ?>

      <div><span><?php echo lang('mobile phone number') ?>:</span> <?php echo clean($user->getMobileNumber()) ?></div>

<?php } // if ?>

<?php if ($user->getHomeNumber()) { ?>

      <div><span><?php echo lang('home phone number') ?>:</span> <?php echo clean($user->getHomeNumber()) ?></div>

<?php } // if ?>

    </div>

<?php } // if ?>

 

  </div>

</div>

<?php } // if ?>

After changing it looked like this :

<?php if (isset($user) && ($user instanceof User)) { ?>

<div class="card">

  <div class="cardIcon"><img src="<?php echo $user->getAvatarUrl() ?>" alt="<?php echo clean($user->getDisplayName()) ?> avatar" /></div>

  <div class="cardData">

 

    <h2><?php echo clean($user->getDisplayName()) ?></h2>

   
<?php if ( logged_user()->isMemberOfOwnerCompany() || ($user->getCompanyId() == logged_user()->getCompanyId()) ) { ?>
    <div class="cardBlock">

<?php if ($user->getTitle()) { ?>

      <div><span><?php echo lang('user title') ?>:</span> <?php echo clean($user->getTitle()) ?></div>

<?php } ?>

      <div><span><?php echo lang('company') ?>:</span> <a href="<?php echo $user->getCompany()->getCardUrl() ?>"><?php echo clean($user->getCompany()->getName()) ?></a></div>

    </div>

   

    <h2><?php echo lang('contact online') ?></h2>

   

    <div class="cardBlock">

      <div><span><?php echo lang('email address') ?>:</span> <a href="mailto:<?php echo clean($user->getEmail()) ?>"><?php echo clean($user->getEmail()) ?></a></div>

<?php if ($user->hasHomepage()) { ?>

      <div><span><?php echo lang('homepage') ?>:</span> <a href="<?php echo $user->getHomepage() ?>" target=_BLANK><?php echo $user->getHomepage() ?></a></div>

<?php } ?>

<?php if (is_array($im_values = $user->getImValues()) && count($im_values)) { ?>

      <table class="imAddresses">

<?php foreach ($im_values as $im_value) { ?>

<?php if ($im_type = $im_value->getImType()) { ?>

        <tr>

          <td><img src="<?php echo $im_type->getIconUrl() ?>" alt="<?php echo $im_type->getName() ?>" /></td>

          <?php } // if memberofownercompany ?> 

        </tr>

<?php } // if ?>

<?php } // foreach ?>

      </table>

<?php } // if ?>

    </div>

   

<?php if ($user->getOfficeNumber() || $user->getFaxNumber() || $user->getMobileNumber() || $user->getHomeNumber()) { ?>

    <h2><?php echo lang('contact offline') ?></h2>

   

    <div class="cardBlock">

<?php if ($user->getOfficeNumber()) { ?>

      <div><span><?php echo lang('office phone number') ?>:</span> <?php echo clean($user->getOfficeNumber()) ?></div>

<?php } // if ?>

<?php if ($user->getFaxNumber()) { ?>

      <div><span><?php echo lang('fax number') ?>:</span> <?php echo clean($user->getFaxNumber()) ?></div>

<?php } // if ?>

<?php if ($user->getMobileNumber()) { ?>

      <div><span><?php echo lang('mobile phone number') ?>:</span> <?php echo clean($user->getMobileNumber()) ?></div>

<?php } // if ?>

<?php if ($user->getHomeNumber()) { ?>

      <div><span><?php echo lang('home phone number') ?>:</span> <?php echo clean($user->getHomeNumber()) ?></div>

<?php } // if ?>

    </div>

<?php } // if ?>
<?php } // if memberofownercompany ?>
  </div>
</div>
<?php } // if ?>

I see many empty lines in your code. Probably unzipped on Windows and then uploaded binary to a Unix server.

I have posted the complete code.

<?php if (isset($user) && ($user instanceof User)) { ?>
<div class="card">
  <div class="cardIcon"><img src="<?php echo $user->getAvatarUrl() ?>" alt="<?php echo clean($user->getDisplayName()) ?> avatar" /></div>
  <div class="cardData">
    <h2><?php echo clean($user->getDisplayName()) ?></h2>
    <div class="cardBlock">
<?php if ($user->getTitle()) { ?>
      <div><span><?php echo lang('user title') ?>:</span> <?php echo clean($user->getTitle()) ?></div>
<?php } ?>
      <div><span><?php echo lang('company') ?>:</span> <a href="<?php echo $user->getCompany()->getCardUrl() ?>"><?php echo clean($user->getCompany()->getName()) ?></a></div>
    </div>
<?php if ( logged_user()->isMemberOfOwnerCompany() || ($user->getCompanyId() == logged_user()->getCompanyId()) ) { ?>
    <h2><?php echo lang('contact online') ?></h2>
    <div class="cardBlock">
      <div><span><?php echo lang('email address') ?>:</span> <a href="mailto:<?php echo clean($user->getEmail()) ?>"><?php echo clean($user->getEmail()) ?></a></div>
<?php if ($user->hasHomepage()) { ?>
      <div><span><?php echo lang('homepage') ?>:</span> <a href="<?php echo $user->getHomepage() ?>" target=_BLANK><?php echo $user->getHomepage() ?></a></div>
<?php } ?>
<?php if (is_array($im_values = $user->getImValues()) && count($im_values)) { ?>
      <table class="imAddresses">
<?php foreach ($im_values as $im_value) { ?>
<?php if ($im_type = $im_value->getImType()) { ?>
        <tr>
          <td><img src="<?php echo $im_type->getIconUrl() ?>" alt="<?php echo $im_type->getName() ?>" /></td>
          <td><?php echo clean($im_value->getValue()) ?> <?php if ($im_value->getIsDefault()) { ?><span class="desc">(<?php echo lang('primary im service') ?>)</span><?php } ?></td>
        </tr>
<?php } // if ?>
<?php } // foreach ?>
      </table>
<?php } // if ?>
    </div>
<?php if ($user->getOfficeNumber() || $user->getFaxNumber() || $user->getMobileNumber() || $user->getHomeNumber()) { ?>
    <h2><?php echo lang('contact offline') ?></h2>
    <div class="cardBlock">
<?php if ($user->getOfficeNumber()) { ?>
      <div><span><?php echo lang('office phone number') ?>:</span> <?php echo clean($user->getOfficeNumber()) ?></div>
<?php } // if ?>
<?php if ($user->getFaxNumber()) { ?>
      <div><span><?php echo lang('fax number') ?>:</span> <?php echo clean($user->getFaxNumber()) ?></div>
<?php } // if ?>
<?php if ($user->getMobileNumber()) { ?>
      <div><span><?php echo lang('mobile phone number') ?>:</span> <?php echo clean($user->getMobileNumber()) ?></div>
<?php } // if ?>
<?php if ($user->getHomeNumber()) { ?>
      <div><span><?php echo lang('home phone number') ?>:</span> <?php echo clean($user->getHomeNumber()) ?></div>
<?php } // if ?>
    </div>
<?php } // if ?>
<?php } // if memberofownercompany ?>
  </div>
</div>
<?php } // if ?>
Re:

Thanks a lot of this updated file. That took care of the user page but there is a "Recent Activities" link for RSS feeds. It still contains the contact info. Is there a way to remove contact info from the feeds too?

I had one more question. I intend to add some links to the login page for any user. Which file do i need to edit?

Thanks again for your help on this.

Regarding the feeds, I only saw email addresses. It is possible to suppress the email and keep only the name. Let me have a look.

<author>someone@gmail.com (Some Name (admin))</author>

For extra links on login page, edit /application/views/access/login.php

Edit library/feed/renderer/Angie_Feed_Renderer_RSS2.class.php
Search for <author>
You would see code like this:

        $result .= '<author>' . clean($author->getEmail()) . ' (' . clean($author->getName()) . ")</author>\n";

Simplest solution is to remove the email permanently, like this

        $result .= '<author>' . clean($author->getName()) . "</author>\n";
Re:

I did as you had mentioned but it returns the following error:

This page contains the following errors:

error on line 2 at column 6: XML declaration allowed only at the start of the document
Below is a rendering of the page up to the first error.

Reads like a typing error. Usually imbalanced quotes.