Arrow Home arrow Forums
larger font smaller font default font Fixed screen resolution Auto adjust screen size

Joomlapolis Forums  


<< Start < Prev 1 2 3 4 5 6 7 8 9 Next > End >>
Re:ysva's CB Custom Profile's [Tips and Tricks]
Date: 2006/12/01 00:03 By: chucktrukk Status: User  
Karma: 11  
Junior Joomlapolitan

Posts: 31
graphgraph
radio,

This is my UserProfile code (it's not updated for 1.2):

function userProfile
Code:

      global $database$_REQUEST$ueConfig$my;     if (isset($_REQUEST['user'])) {         if (!allowAccess$ueConfig['allow_profileviewbyGID'],'RECURSE'userGID($my->id))) {             echo _UE_NOT_AUTHORIZED;             return;         }     } else {         if ($uid==0) {             echo _UE_REGISTERFORPROFILE;             return;         }     }     $users=array();     if (setUserDBrequest($uid)) {         $users $database->loadObjectList();     }     if (count($users)==0) {          echo _UE_NOSUCHPROFILE;          return;      }     $user $users[0];     HTML_comprofiler::xtdUserProfile$user$option$submitvalue$my);



Then I added a new function to comprofiler.html.php (underneath userProfile)
Code:

      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 != || ($user->block == && $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->setPageTitleunHtmlspecialchars(getNameFormat($user->name,$user->username,$ueConfig['name_format'])));             }             if ( method_exists($mainframe,"appendPathWay")) {                 $mainframe->appendPathWaygetNameFormat($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));         } }



Then I created a folder called components/com_comprofiler/xtd_views/xtdUserProfile.php:
Code:

  <?php defined'_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );         $avatar $user->avatar;         $avatarapproved    $user->avatarapproved;                      if ($avatar=='' || $avatar==null) {               //$avatar_img = "components/com_comprofiler/plugin/language/default_language/images/tnnophoto.jpg";               $avatar_img sefRelToAbs'components/com_comprofiler/plugin/language/default_language/images/nophoto.jpg' );             } elseif ($avatarapproved==0) {                 $avatar_img sefRelToAbs'components/com_comprofiler/plugin/language/default_language/images/tnpendphoto.jpg' );             } elseif (strpos($avatar,"gallery/")===false) {                 $avatar_img "images/comprofiler/tn".$avatar;             } else {                  $avatar_img sefRelToAbs'images/comprofiler/' .$avatar );             }         if($ueConfig['allow_onlinestatus']==1) {             $database->setQuery("SELECT COUNT(*) FROM #__session WHERE userid =".$user->id);             $isonline $database->loadResult();             $online_status '';             if ($isonline 0) {                 $online_status 'Online';             } else {                 $online_status 'Offline';             }         } //Date Functions         if ($user->lastupdatedate == '0000-00-00 00:00:00') {             $user->lastupdatedate 'Never';         } else {             $user->lastupdatedate cbFormatDate($user->lastupdatedate);         }         $user->registerDate cbFormatDate($user->registerDate);         $user->lastvisitDate cbFormatDate($user->lastvisitDate); ?> <table cellpadding="0" cellspacing="0" border="0" width="540">     <tr>         <td>             <div style="float:left; width:150px; height:209px; margin: 0 10px 5px 10px; text-align: center;"><img src="<?php echo $avatar_img; ?>" title="Your Avatar" alt="Your Avatar" /></div>             <div style="float:right; width:103px; margin: 0 10px 0 10px;">                     <a href="<?php echo sefRelToAbs( 'index.php?option=com_comprofiler& task=usersList' ); ?>" title="The Community">                                         </a>             </div>             <p><?php echo $user->username; ?>'s Profile</p>             <p><strong>Hits:</strong> <?php echo $user->hits; ?><br/>             <strong>Online Status:</strong> <?php echo $online_status; ?><br/>             <strong>Member Since:</strong> <?php echo $user->registerDate; ?><br/>             <strong>Last Online:</strong> <?php echo $user->lastvisitDate; ?><br/>             <strong>Last Updated:</strong> <?php echo $user->lastupdatedate; ?><br/>             <br/><?php echo $userViewTabs["cb_head"]; ?></p>         </td>     </tr>     <tr>         <td><br/>             <?php echo $userViewTabs["cb_tabmain"]; ?><br/>              <?php echo $userViewTabs["cb_underall"]; ?><br/>              <?php echo $userViewTabs["cb_middle"]; ?>         </td>     </tr> </table>



What this does is allow you to modify xtdUserProfile to look however you want more easily (at least for me).

There may be some errors in there.

Chuck

Of course I make no warranties, etc al.
Click here to see the profile of this user The topic has been locked.

Re:ysva's CB Custom Profile's [Tips and Tricks]
Date: 2006/12/01 02:52 By: radio Status: CB Doc subscriber  
Karma: 5  
Expert Joomlapolitan

Posts: 181
graphgraph
Thanks but im not sure how to actually go about using this code, I dont know php at all and bearly know html and css, could you explain in a bit more detail what each part does and how to use it?
Interested in improving Joomla as a social networking platform? If yes join joomlaplazza.com
Click here to see the profile of this user The topic has been locked.

Re:ysva's CB Custom Profile's [Tips and Tricks]
Date: 2006/12/01 03:27 By: radio Status: CB Doc subscriber  
Karma: 5  
Expert Joomlapolitan

Posts: 181
graphgraph
okey iv added the code to my test server files,its knocked my current layout all outta whack, I can see from vewing the source html that there is alot of changes, is it just a case of using the css to make the profile look how i want with all the knew classes ect? or is there more to it ? Like i said you'l need to explain how i use this modification and will it let me build a profile page with two columbs similar to this: http://www.mingleville.com/xL15Ax?


cheers mate
Interested in improving Joomla as a social networking platform? If yes join joomlaplazza.com
Click here to see the profile of this user The topic has been locked.

Re:ysva's CB Custom Profile's [Tips and Tricks]
Date: 2006/12/01 17:07 By: chucktrukk Status: User  
Karma: 11  
Junior Joomlapolitan

Posts: 31
graphgraph
radio,

I dont want to hijack ysva's thread. So I moved the topic here: http://www.joomlapolis.com/component/option,com_joomlaboard/Itemid,38/func,view/catid,29/id,25991/
Click here to see the profile of this user The topic has been locked.

Re:ysva's CB Custom Profile's [Tips and Tricks]
Date: 2006/12/02 09:10 By: ysva Status: User  
Karma: 19  
Gold Joomlapolitan

Posts: 222
graphgraph
chucktrukk wrote:
radio,

I dont want to hijack ysva's thread. So I moved the topic here: http://www.joomlapolis.com/component/option,com_joomlaboard/Itemid,38/func,view/catid,29/id,25991/


I don't mind any hijack at all, we're all working on the goal which we share:

open up CB customizability.
Click here to see the profile of this user The topic has been locked.

Re:ysva's CB Custom Profile's [Tips and Tricks]
Date: 2006/12/13 16:46 By: pointri Status: User  
Karma: 26  
Gold Joomlapolitan

Posts: 211
graphgraph
Here's a quick trick to dynamically change the name of a profile tab, depending on a particular field.

In this example, _UE_SVC_TAB is a constant defined in a plugin of your choosing in the Plugin Manager.

In the plugin's language file, throw in this function.

Code:

 function _nameTab(&$group) {     if ($group == "foos") {         DEFINE('_UE_SVC_TAB','Foo Club');     } else {         DEFINE('_UE_SVC_TAB','Bar Club');     } }



In most plugins, there's a subroutine that calls for a language file. After the lines which include the language file, call the _nameTab function. Here's how it looks in a plugin I'm working on.

Code:

 function _getLanguageFile($user->cb_group)  {         global $mosConfig_absolute_path$mosConfig_lang;         if (file_exists($mosConfig_absolute_path."/components/com_comprofiler/plugin/user/plug_servicestab/language/".$mosConfig_lang.".php") ) {             include_once($mosConfig_absolute_path."/components/com_comprofiler/plugin/user/plug_servicestab/language/".$mosConfig_lang.".php");         } else {             include_once($mosConfig_absolute_path."/components/com_comprofiler/plugin/user/plug_servicestab/language/english.php");         }     _nameTab($user->cb_group);         return true;     }



Where $user is the array that holds user information in a plugin, and $user->cb_group is a member of the array that corresponds to a CB custom field: in this case, cb_group.

You can extend this to the Nth degree when customizing profile tabs based on the value of CB fields while keeping your language files intact and independent of the main flow of the plugin.
Joomlapolitan zealot and a somewhat stealthy, rather passive CB3PD developer.

http://www.constructionlounge.com Construction Lounge: Online resource and networking portal for the construction and remodeling industries.
Click here to see the profile of this user The topic has been locked.

<< Start < Prev 1 2 3 4 5 6 7 8 9 Next > End >>

Documentation

Documentation Subscription Service
(updated for CB 1.2 RC4)

What?

Why?

Where?

Just click here for answers!

Click here for a yearly subscription: subscribe now

Download Latest Release

The latest stable Community Builder Release is version 1.1 for Joomla 1.0 and Mambo.
You need to be a registered member of Joomlapolis to download.

The latest release candidate of Community Builder is version 1.2 RC4, native for Joomla 1.0, 1.5 and Mambo.
It is available as "thank you" to all CB documentation subscribers and now also to all registered joomlapolitans.

CB Login