To hide the plugin tab from other users, you can either use mikko's privacy plugin, or replace your entire plug_cbinvitefriends/invitefriends.php with the following code:
[code:1]<?php
/**
* Joomla Community Builder User Plugin: plug_cbinvitefriends
* @version $Id$
* @package plug_invitefriends
* @subpackage invitefriends.php
* @author Michael Spredemann
* @copyright (C) Michael Spredemann
* @license Limited
www.gnu.org/copyleft/gpl.html
GNU/GPL
* @final 1.0
*/
/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
/**
* Basic tab extender. Any plugin that needs to display a tab in the user profile
* needs to have such a class. Also, currently, even plugins that do not display tabs (e.g., auto-welcome plugin)
* need to have such a class if they are to access plugin parameters (see $this->params statement).
*/
class getinvitefriendsTab extends cbTabHandler {
/**
* Construnctor
*/
function getinvitefriendsTab() {
$this->cbTabHandler();
}
/**
* Generates the HTML to display the user profile tab
* @param object tab reflecting the tab database entry
* @param object mosUser reflecting the user being displayed
* @param int 1 for front-end, 2 for back-end
* @returns mixed : either string HTML for tab content, or false if ErrorMSG generated
*/
function getDisplayTab($tab,$user,$ui) {
$return = null;
$params = $this->params; // get parameters (plugin and related tab)
global $my, $database,$mainframe,$mosConfig_live_site, $mosConfig_absolute_path, $mosConfig_lang, $mosConfig_offset;
if (file_exists($mosConfig_absolute_path."/components/com_comprofiler/plugin/user/plug_cbinvitefriends/language/".$mosConfig_lang.".php"«»))
include($mosConfig_absolute_path."/components/com_comprofiler/plugin/user/plug_cbinvitefriends/language/".$mosConfig_lang.".php"«»);
else if(file_exists($mosConfig_absolute_path."/components/com_comprofiler/plugin/user/plug_cbinvitefriends/language/english.php"«»))
include($mosConfig_absolute_path."/components/com_comprofiler/plugin/user/plug_cbinvitefriends/language/english.php"«»);
else return "Error: No language file could be loaded. Is the Invite a Friend plugin properly installed?";
$is_invitefriends_plug_enabled = $params->get('ifPlugEnabled', "1"«»);
if ($is_invitefriends_plug_enabled != "0"«») {
if($tab->description != null) {
$return .= "\t\t<div class=\"tab_Description\">"
. (($my->id == $user->id) ? $tab->description : "You can see <strong>".$user->name."</strong>'s invites statistics here.<br />For security and privacy reasons, you are only able to view the number of accepted and pending invites."«») // html content is allowed in descriptions
. "</div>\n";
}
$return .= "\t\t<div>\n"
. "<p>"
. htmlspecialchars($invitefriends_tab_message) // make all other output html-safe
. "</p>"
. "</div>\n";
$database->setQuery("select `id` from #__menu where `link` like '%com_invite%' LIMIT 1"«»);
$cominviteid = $database->loadResult();
$database->setQuery("select `id` from #__menu where `link` like '%com_comprofiler%' LIMIT 1"«»);
$comprofilerid = $database->loadResult();
$curdate = date("Y-m-d", time() + $mosConfig_offset * 60 * 60);
$sql = "SELECT count(id) FROM #__invite_sent WHERE user_id = ".$user->id." AND date = '".$curdate."'";
$sql2 = "select value from #__invite_conf where name = 'max_daily'";
$database->setQuery($sql);
$daycnt = $database->loadResult();
$database->setQuery($sql2);
$lims = $database->loadResult();
$invites = $lims - $daycnt;
if ($invites > 0) {
if ($my->id == $user->id)
$return .= "<p>"._IF_YOUHAVE1." <span style=\"font-weight:bold;color:green;\">$invites</span> "._IF_YOUHAVE2." <a href=\"index.php?option=com_invite&Itemid=".$cominviteid."\">"._IF_YOUHAVE3."</a> "._IF_YOUHAVE4."</p>";
else
$return .= "<p>".$user->name." (".$user->username."«») has <span style=\"font-weight:bold;color:green;\">$invites</span> "._IF_YOUHAVE2;
} else {
if ($my->id == $user->id)
$return .= "<p>"._IF_YOUHAVE5."</p>";
else
$return .= "<p>".$user->name." (".$user->username."«») has no more invites remaining for today.";
}
$sqljoined = "select u.username, j.user_id from #__invite_joined as j LEFT JOIN #__invite_sent as s ON j.ref_str = s.ref_str LEFT JOIN #__users as u ON j.user_id = u.id WHERE s.user_id = $user->id AND s.joined = 1";
$database->setQuery($sqljoined);
$joined = $database->loadObjectList();
$sqlsent = "select email from #__invite_sent WHERE user_id = ".$user->id." AND joined = 0";
$database->setQuery($sqlsent);
$sents = $database->loadObjectList();
$return .= "<div style=\"font-size:14px;font-weight:bold;\">"._IF_ACCEPTED_TITLE."</div>";
if ($joined == null) {
if ($my->id == $user->id)
$return .= "<div>"._IF_NONE_JOINED."</div>";
else
$return .= "<div>User has not successfully invited anyone.</div>";
}
else {
if ($my->id == $user->id) {
$return .= "<div>";
foreach ($joined as $ujoin) {
$return .= "<a href=\"index.php?option=com_comprofiler&task=userProfile&user=".$ujoin->user_id."&Itemid=$comprofilerid\" title=\""._IF_VIEW." ".$ujoin->username."'s "._IF_PROFILE."\">$ujoin->username</a> | ";
}
$return .= "</div>";
}
else
$return .= "<div>User has <span style=\"font-weight:bold;color:green;\">".count($joined)."</span> invite(s) accepted.</div>";
}
$return .= "<div style=\"font-size:14px;font-weight:bold;padding-top:15px;\">"._IF_PENDING_TITLE."</div>";
if ($sents == null) {
$return .= "<div>"._IF_NONE."</div>";
}
else {
if ($my->id == $user->id) {
$return .= "<div>";
foreach ($sents as $usent) {
$return .= "<a href=\"mailto:".$usent->email."\" title=\""._IF_EMAIL." ".$usent->email."\">$usent->email | ";
}
$return .= "</div>";
}
else
$return .= "<div>User has <span style=\"font-weight:bold;color:green;\">".count($sents)."</span> invite(s) pending.</div>";
}
}
return $return;
} // end or getDisplayTab function
} // end of gethelloworldTab class
?>[/code:1]
I did not bother with the english language files, so if you wish to, you can edit the extra output text here or through your own language file