Tips & Tricks

Mambo CMS Tips & Tricks: Part 2

Number of forum posts

mambo

You would like to show how many Simpleboard form posts, a user has made in thier Community Builder profile.

Here is the code to do it.

Step 1) Open comprofiler.html.php

Step 2) Find this section of code

<tr>
<td class=sectiontableentry<?php echo $i; ?> width=35% style="font-weight:bold;"><?php echo _UE_HITS; ?></td>
<td class=sectiontableentry<?php echo $i; ?>>
<?php echo $user->hits; ?></td>
</tr>

Step 3) Pase the following code above the code in step 2

<?php
$query = "SELECT count(userid) FROM mos_sb_messages WHERE userid='".$user->id."'";
$database->setQuery($query);
$total = $database->loadResult();
?>
<tr>
<td class="sectiontableentry<?php echo $i; ?>"
 width="35%" style="font-weight:bold;">
<?php echo "Forum Posts"; ?></td>
<td class="sectiontableentry<?php echo $i; ?>">
<?php echo $total; ?></td>
</tr>
<?php $i= ($i==1) ? 2 : 1; ?>

Step 3) Save, and your all done.

SB Forum Karma In Profile

To Show a users sb forum karma in their profile, follow the steps below.

Step 1) Open up the file comprofiler.html.php which is located in “/components/com_comprofiler”. locate the following section of code:

<tr>
<td class=sectiontableentry<?php echo $i; ?> 
width=35% style="font-weight:bold;">
<?php echo _UE_HITS; ?></td>
<td class=sectiontableentry<?php echo $i; ?> >
<?php echo $user->hits; ?></td>
</tr>

Step 2) Paste the following before the code in step 1. Save and thats it!

<?php 
$query = "SELECT karma FROM #__sb_users WHERE userid='".$user->id."'";
$database->setQuery($query);
$karma = $database->loadResult();
if($karma ==""){
$karma = "No Karma";}
?>
<tr>
<td class="sectiontableentry<?php echo $i; ?>"
 width="35%" style="font-weight:bold;">
<?php echo "Forum Karma"; ?></td>
<td class="sectiontableentry<?php echo $i; ?>">
<?php echo $karma; ?></td>
</tr>
<?php $i= ($i==1) ? 2 : 1; ?>

Forum Rank In Profile

Here is a quick easy trick for community builder to show a users Simpleboard forum rank in their profile.

Step 1) Open up the file comprofiler.html.php which is located in “/components/com_comprofiler”. locate the following section of code

<tr>
<td class=sectiontableentry<?php echo $i; ?> width=35% style="font-weight:bold;">
<?phpecho_UE_HITS; ?>
</td>
<td class=sectiontableentry<?php echo $i; ?> ><?php echo $user->hits; ?></td>
</tr>

Step 2) Paste the following before the code in step 1. Save and thats it!

<?php
include_once ( 'administrator/components/com_simpleboard/simpleboard_config.php' );
if($sbConfig['showranking']) {
$database->setQuery("SELECT posts FROM #__sb_users where userid='$user->id'");
$numPosts=$database->loadResult();
$numPosts=(int)$numPosts;
$rText="";
$rImg="";
if ($numPosts>=0 && $numPosts<(int)$sbConfig['rank1']){$rText=$sbConfig['rank1txt']; $rImg=$sbs.'/ranks/rank1.gif';}
if ($numPosts>=(int)$sbConfig['rank1'] && $numPosts<(int)$sbConfig['rank2']){$rText=$sbConfig['rank2txt']; $rImg=$sbs.'/ranks/rank2.gif';}
if ($numPosts>=(int)$sbConfig['rank2'] && $numPosts<(int)$sbConfig['rank3']){$rText=$sbConfig['rank3txt']; $rImg=$sbs.'/ranks/rank3.gif';}
if ($numPosts>=(int)$sbConfig['rank3'] && $numPosts<(int)$sbConfig['rank4']){$rText=$sbConfig['rank4txt']; $rImg=$sbs.'/ranks/rank4.gif';}
if ($numPosts>=(int)$sbConfig['rank4'] && $numPosts<(int)$sbConfig['rank5']){$rText=$sbConfig['rank5txt']; $rImg=$sbs.'/ranks/rank5.gif';}
if ($numPosts>=(int)$sbConfig['rank5']){$rText=$sbConfig['rank6txt']; $rImg=$sbs.'/ranks/rank6.gif';}
if ($uIsMod){$rText=_RANK_MODERATOR; $rImg=$sbs.'/ranks/rankmod.gif';}
if ($uIsAdm){$rText=_RANK_ADMINISTRATOR; $rImg=$sbs.'/ranks/rankadmin.gif';}
if($sbConfig['rankimages']){$msg_userrankimg = '<img src="'.$rImg.'" alt="" />';}
$msg_userrank = $rText;
?>
<tr>
<td class="sectiontableentry<?php echo $i; ?> width="35%" style="font-weight:bold;">
<?php echo "Forum Rank"; ?></td>
<td class="sectiontableentry<?php echo $i; ?>">
<?php echo $msg_userrank; ?></td>
</tr>
<?php $i= ($i==1) ? 2 : 1; }?>

Leave a Reply

Your email address will not be published. Required fields are marked *