| Community Builder Extended profile |
|
|
| Written by Andy | |||||
| Tuesday, 29 April 2008 | |||||
Page 2 of 3
What it does This modification allows you to make the CB profile look anyway you like by first loading all the users information into variables such as:
$user->registerDate And allowing you to place tabs wherever you want such as:
$userViewTabs["cb_tabmain"]; The profile layout itself is created and styled as if it was a standard HTML page.
1. First create backup copies of: · components/com_profiler/comprofiler.php · components/com_profiler/ comprofiler.html.php
2. Edit the comprofiler.php file and replace HTML_comprofiler::userProfile
With:
HTML_comprofiler::xtdUserProfile( $user, $option, $submitvalue, $my);
3. Edit the comprofiler.html.php file and add the following code before or after the function userProfile:
function xtdUserProfile($user, $option,$submitvalue) { global $database,$my,$ueConfig,$_REQUEST,$_POST,$_PLUGINS, $mainframe;
$_PLUGINS->loadPluginGroup('user');
$results = $_PLUGINS->trigger( 'onBeforeUserProfileRequest', array(&$user,1));
if ($_PLUGINS->is_errors()) {
echo
"<script type=\"text/javascript\">alert(\"".$_PLUGINS->getErrorMSG()."\"); window.history.go(-1); </script>\n";
exit();
}
$cbMyIsModerator = isModerator($my->id);
$cbUserIsModerator = isModerator($user->id);
$showProfile=1;
if ($user->banned != 0 || ($user->block == 1 && $user->confirmed && $user->approved)) {
echo "<font color=red>"._UE_USERPROFILEBANNED;
if($my->id != $user->id && $cbMyIsModerator != 1) {
$showProfile=0;
}
else {
if ($user->block == 1) {
echo ": "._LOGIN_BLOCKED;
}
if ($user->banned != 0) { echo "<br />".nl2br($user->bannedreason);
}
}
echo "<br /></font>";
}
if (!$user->confirmed) echo "<font color=red>"._UE_USER_NOT_CONFIRMED."</font><br />";
if (!$user->approved) echo "<font color=red>"._UE_USER_NOT_APPROVED."</font><br />";
if ((!$user->confirmed || !$user->approved) && $cbMyIsModerator!=1) {
$showProfile=0;
}
if ($showProfile==1) {
if ( method_exists($mainframe,"setPageTitle")) { $mainframe->setPageTitle( unHtmlspecialchars(getNameFormat($user->name,$user->username,$ueConfig['name_format'])));
}
if ( method_exists($mainframe,"appendPathWay")) {
$mainframe->appendPathWay( getNameFormat($user->name,$user->username,$ueConfig['name_format']));
}
$i=1;
outputCbTemplate(1);
echo initToolTip(1);
?>
<script type="text/javascript">
function cbConnSubmReq() {
cClick();
document.connOverForm.submit();
}
function confirmSubmit() {
if (confirm("<?php echo _UE_CONFIRMREMOVECONNECTION; ?>"))
return true ;
else
return false ;
}
</script>
<?php
$results = $_PLUGINS->trigger( 'onBeforeUserProfileDisplay', array(&$user,1,&
$cbUserIsModerator,&$cbMyIsModerator)); //$ui=1 //BBB: params?
if ($_PLUGINS->is_errors()) {
echo "<script type=\"text/javascript\">alert(\"".$_PLUGINS->getErrorMSG()."\");
window.history.go(-1); </script>\n";
exit();
}
if (is_array($results)) {
for ($i=0, $n=count($results); $i<$n; $i++) {
echo $results[$i];
}
}
$tabs = new cbTabs( 0, 1 );
$userViewTabs = $tabs->getViewTabs($user); // this loads, registers menu and
user status and renders the tabs
require_once ($mosConfig_absolute_path . 'components/com_comprofiler/xtd_views/
xtdUserProfile.php');
$tab = null;
if (isset($_GET['tab'])) $tab = urldecode($_GET['tab']);
elseif (isset($_POST['tab'])) $tab = $_POST['tab'];
if ($tab) echo "<script type=\"text/javascript\">showCBTab('"
.addslashes(htmlspecialchars($tab))."');</script>\n";
if($my->id!=$user->id) {
recordViewHit($my->id,$user->id,getenv('REMOTE_ADDR'));
}
$_PLUGINS->trigger( 'onAfterUserProfileDisplay', array($user,true));
}
}
|
|||||
| < Prev | Next > |
|---|


