<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.7.3" -->
<rss version="2.0">
	<channel>
		<title>AllMySocials</title>
		<description></description>
		<link>http://www.allmysocials.com/</link>
		<lastBuildDate>Sun, 05 Sep 2010 08:48:26 +0100</lastBuildDate>
        <generator>FeedCreator 1.7.3</generator>
		<item>
			<title>Tuesday, 31 August 2010 10:13  -  Substitutions - Tabs to Fields</title>
			<link>http://www.allmysocials.com//index.php?option=com_content&amp;view=article&amp;id=43:substitutions-tabs-to-fields&amp;catid=2:community-builder&amp;directory=15</link>
			<description><![CDATA[Sometimes you don't want to use a tab, but would love for it to be an actual field instead. This is very possible without breaking the structure of the tab and the usage of the tab while having the benefit of it being a field. Using a Delimiter field you'll need to add the following substitution.<br /><br />[cb:usertab tab="##" user="#displayed" /]<br /><br />You'll need to replace ## with the ID (found in Tab Management) of the actual tab you wish to display. Now save your Delimiter field as appropriately, but this isn't enough! If you leave the tab you're trying to render visible as well they'll conflict! So you'll now need to navigate to Tab Management and edit the tab. Then move its position to a "Not displayed on profile 1 location" (doesn't matter which). You now have a working tab as a field!]]></description>
			<pubDate>Tue, 31 Aug 2010 15:13:54 +0100</pubDate>
		</item>
		<item>
			<title>Thursday, 01 April 2010 07:51  -  API - Create/Edit User</title>
			<link>http://www.allmysocials.com//index.php?option=com_content&amp;view=article&amp;id=38:api-createedit-user&amp;catid=5:general&amp;directory=15</link>
			<description><![CDATA[Community Builder provides some basic API for properly and easily creating or editing existing users while maintaining a complete structure within Joomla and Community Builder it self. Users created and edited in this manner will be completely functional and even be susceptible to basic fields validation!<br /><br />To create a user you must first <a href="component/content/article/1-joomla/9-include-cb-api?directory=15">import the CB API</a> if you are creating a user outside of a Community Builder plugin followed by including the Plugin & Class. Now that you've loaded the API you can include the following function for easy creation of users.<br /><br />
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<thead> 
<tr>
<td colspan="2" style="background: #dddddd; color: #054b6e; padding: 2px 0px; text-align: center; font: bold italic 12px Verdana, Geneva, Arial, Helvetica, sans-serif;">Create User</td>
</tr>
</thead> 
<tbody>
<tr class="li1">
<td style="width: 1px; background: none repeat scroll 0% 0% #f0f0f0; vertical-align: top; color: #676f73; border-right: 1px dotted #dddddd; font-size: 12px; text-align: right;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br /></pre>
</td>
<td style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #000000; font-weight: bold;">function</span> registerUser<span style="color: #009900;">(</span> <span style="color: #000088;">$fname</span><span style="color: #339933;">,</span> <span style="color: #000088;">$lname</span><span style="color: #339933;">,</span> <span style="color: #000088;">$email</span><span style="color: #339933;">,</span> <span style="color: #000088;">$username</span><span style="color: #339933;">,</span> <span style="color: #000088;">$password</span> <span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">	<a href="http://www.php.net/global"><span style="color: #990000;">global</span></a> <span style="color: #000088;">$_CB_framework</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_CB_database</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span>			<span style="color: #339933;">=</span>	<span style="color: #000000; font-weight: bold;">new</span> moscomprofilerUser<span style="color: #009900;">(</span> <span style="color: #000088;">$_CB_database</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">usertype</span>		<span style="color: #339933;">=</span>	<span style="color: #000088;">$_CB_framework</span><span style="color: #339933;">-></span><span style="color: #004000;">getCfg</span><span style="color: #009900;">(</span> <span style="color: #0000ff;">'new_usertype'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">gid</span>		<span style="color: #339933;">=</span>	<span style="color: #000088;">$_CB_framework</span><span style="color: #339933;">-></span><span style="color: #004000;">acl</span><span style="color: #339933;">-></span><span style="color: #004000;">get_group_id</span><span style="color: #009900;">(</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">usertype</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'ARO'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">confirmed</span>		<span style="color: #339933;">=</span>	<span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">approved</span>		<span style="color: #339933;">=</span>	<span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">block</span>		<span style="color: #339933;">=</span>	<span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">sendEmail</span>		<span style="color: #339933;">=</span>	<span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">registerDate</span>	<span style="color: #339933;">=</span>	<a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">(</span> <span style="color: #0000ff;">'Y-m-d H:i:s'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_CB_framework</span><span style="color: #339933;">-></span><span style="color: #004000;">now</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">name</span>		<span style="color: #339933;">=</span>	<span style="color: #000088;">$fname</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$lname</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">firstname</span>		<span style="color: #339933;">=</span>	<span style="color: #000088;">$fname</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">lastname</span>		<span style="color: #339933;">=</span>	<span style="color: #000088;">$lname</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">username</span>		<span style="color: #339933;">=</span>	<span style="color: #000088;">$username</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">email</span>		<span style="color: #339933;">=</span>	<span style="color: #000088;">$email</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">password</span>		<span style="color: #339933;">=</span>	cbHashPassword<span style="color: #009900;">(</span> <span style="color: #000088;">$password</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span> <span style="color: #339933;">!</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">store</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span> <span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">		<a href="http://www.php.net/trigger_error"><span style="color: #990000;">trigger_error</span></a><span style="color: #009900;">(</span> <a href="http://www.php.net/sprintf"><span style="color: #990000;">sprintf</span></a><span style="color: #009900;">(</span> <span style="color: #0000ff;">'registerUser SQL Error: %s'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">getError</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span> <span style="color: #009900;">)</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">E_USER_ERROR</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #009900;">}</span></span><br /><span style="vertical-align: top;"><span style="color: #009900;">}</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p> </p>
Editing a user takes an additional step, you'll first need to first <a href="component/content/article/2-community-builder/14-api-establishing-user?directory=15">Establish $user object</a> once the object has been established you'll need to use the following modified function with $user object passed to it.<br /><br />
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<thead> 
<tr>
<td colspan="2" style="background: #dddddd; color: #054b6e; padding: 2px 0px; text-align: center; font: bold italic 12px Verdana, Geneva, Arial, Helvetica, sans-serif;">Edit User</td>
</tr>
</thead> 
<tbody>
<tr class="li1">
<td style="width: 1px; background: none repeat scroll 0% 0% #f0f0f0; vertical-align: top; color: #676f73; border-right: 1px dotted #dddddd; font-size: 12px; text-align: right;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br /></pre>
</td>
<td style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #000000; font-weight: bold;">function</span> registerUser<span style="color: #009900;">(</span> <span style="color: #000088;">$user</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fname</span><span style="color: #339933;">,</span> <span style="color: #000088;">$lname</span><span style="color: #339933;">,</span> <span style="color: #000088;">$email</span><span style="color: #339933;">,</span> <span style="color: #000088;">$username</span><span style="color: #339933;">,</span> <span style="color: #000088;">$password</span> <span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">	<a href="http://www.php.net/global"><span style="color: #990000;">global</span></a> <span style="color: #000088;">$_CB_framework</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_CB_database</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span>			<span style="color: #339933;">=</span>	<span style="color: #000000; font-weight: bold;">new</span> moscomprofilerUser<span style="color: #009900;">(</span> <span style="color: #000088;">$_CB_database</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-></span><span style="color: #004000;">id</span> <span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">		<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">load</span><span style="color: #009900;">(</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-></span><span style="color: #004000;">id</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #009900;">}</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">usertype</span>		<span style="color: #339933;">=</span>	<span style="color: #000088;">$_CB_framework</span><span style="color: #339933;">-></span><span style="color: #004000;">getCfg</span><span style="color: #009900;">(</span> <span style="color: #0000ff;">'new_usertype'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">gid</span>		<span style="color: #339933;">=</span>	<span style="color: #000088;">$_CB_framework</span><span style="color: #339933;">-></span><span style="color: #004000;">acl</span><span style="color: #339933;">-></span><span style="color: #004000;">get_group_id</span><span style="color: #009900;">(</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">usertype</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'ARO'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">confirmed</span>		<span style="color: #339933;">=</span>	<span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">approved</span>		<span style="color: #339933;">=</span>	<span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">block</span>		<span style="color: #339933;">=</span>	<span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">sendEmail</span>		<span style="color: #339933;">=</span>	<span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">registerDate</span>	<span style="color: #339933;">=</span>	<a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">(</span> <span style="color: #0000ff;">'Y-m-d H:i:s'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_CB_framework</span><span style="color: #339933;">-></span><span style="color: #004000;">now</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">name</span>		<span style="color: #339933;">=</span>	<span style="color: #000088;">$fname</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$lname</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">firstname</span>		<span style="color: #339933;">=</span>	<span style="color: #000088;">$fname</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">lastname</span>		<span style="color: #339933;">=</span>	<span style="color: #000088;">$lname</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">username</span>		<span style="color: #339933;">=</span>	<span style="color: #000088;">$username</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">email</span>		<span style="color: #339933;">=</span>	<span style="color: #000088;">$email</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">password</span>		<span style="color: #339933;">=</span>	cbHashPassword<span style="color: #009900;">(</span> <span style="color: #000088;">$password</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span> <span style="color: #339933;">!</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">store</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span> <span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">		<a href="http://www.php.net/trigger_error"><span style="color: #990000;">trigger_error</span></a><span style="color: #009900;">(</span> <a href="http://www.php.net/sprintf"><span style="color: #990000;">sprintf</span></a><span style="color: #009900;">(</span> <span style="color: #0000ff;">'registerUser SQL Error: %s'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">getError</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span> <span style="color: #009900;">)</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">E_USER_ERROR</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #009900;">}</span></span><br /><span style="vertical-align: top;"><span style="color: #009900;">}</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br />The newly created function will now register a new user or edit an existing user; there are many applications for such API such as external site integrations. In addition to the default Joomla and CB fields you can also add additional fields using the following method.<br /><br />
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<tbody>
<tr class="li1">
<td style="width: 1px; background: none repeat scroll 0% 0% #f0f0f0; vertical-align: top; color: #676f73; border-right: 1px dotted #dddddd; font-size: 12px; text-align: right;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">1<br /></pre>
</td>
<td style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #000088;">$row</span><span style="color: #339933;">-></span><span style="color: #004000;">cb_myfield</span>	<span style="color: #339933;">=</span>	<span style="color: #0000ff;">'Test Value'</span><span style="color: #339933;">;</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p> </p>
<br />]]></description>
			<pubDate>Thu, 01 Apr 2010 12:51:55 +0100</pubDate>
		</item>
		<item>
			<title>Tuesday, 28 July 2009 09:03  -  API - Getting Fields</title>
			<link>http://www.allmysocials.com//index.php?option=com_content&amp;view=article&amp;id=15:api-getting-fields&amp;catid=2:community-builder&amp;directory=15</link>
			<description><![CDATA[Getting a field is relatively simple, but oddly complicated at times. The code to get a field will need to be tweaked to fit your site, so be sure you're ready to do a lot of refreshes until you get the proper format. To help we'll explain what each format and display mode does.<br /><br />First you must establish $user if using external code from CB (see API - Establishing $user) if you're not and are using a CB Plugin then use the following to establish $cbUser.<br /><br />
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: #f8f8f8 none repeat scroll 0% 0%; border-collapse: collapse; width: 100%;">
<tbody>
<tr class="li1">
<td style="border-right: 1px dotted #dddddd; background: #f0f0f0 none repeat scroll 0% 0%; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: right;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1
2
3
4
5
</pre>
</td>
<td style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #000088;">$cbUser</span>			<span style="color: #339933;">=&amp;</span>	CBuser<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">(</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span> <span style="color: #339933;">!</span> <span style="color: #000088;">$cbUser</span> <span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="color: #000088;">$cbUser</span>		<span style="color: #339933;">=&amp;</span>	CBuser<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">(</span> <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br />Ok now that $cbUser has been established it's time to examine the getField function for $cbUser class.<br /><br />
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: #f8f8f8 none repeat scroll 0% 0%; border-collapse: collapse; width: 100%;">
<tbody>
<tr class="li1">
<td style="border-right: 1px dotted #dddddd; background: #f0f0f0 none repeat scroll 0% 0%; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: right;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1
</pre>
</td>
<td style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #000000; font-weight: bold;">function</span> getField<span style="color: #009900;">(</span> <span style="color: #000088;">$fieldName</span><span style="color: #339933;">,</span> <span style="color: #000088;">$defaultValue</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'html'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$formatting</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'none'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$reason</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'profile'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$list_compare_types</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br />Most of the getField function won't be of interest to you, but it will be explained if you plan to use getField in a more advanced way. As you can see it's possible to change the output, format, and reason. All 3 of which are highly important to its usage. $list_compare_types will likely never be of significant use for you as it simply signifies its search mode. Please review the following functions descriptive text for help with its parameters.<br /><br />
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: #f8f8f8 none repeat scroll 0% 0%; border-collapse: collapse; width: 100%;">
<tbody>
<tr class="li1">
<td style="border-right: 1px dotted #dddddd; background: #f0f0f0 none repeat scroll 0% 0%; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: right;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1
2
3
4
5
6
7
8
9
10
11
12
</pre>
</td>
<td style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #009933; font-style: italic;">/**</span></span>
<span style="vertical-align:top"><span style="color: #009933; font-style: italic;">* Formatter:</span></span>
<span style="vertical-align:top"><span style="color: #009933; font-style: italic;">* Returns a field in specified format</span></span>
<span style="vertical-align:top"><span style="color: #009933; font-style: italic;">*</span></span>
<span style="vertical-align:top"><span style="color: #009933; font-style: italic;">* @param  string    $fieldName               Name of field to render</span></span>
<span style="vertical-align:top"><span style="color: #009933; font-style: italic;">* @param  mixed     $defaultValue            Value if field is not in reach of viewer user or innexistant</span></span>
<span style="vertical-align:top"><span style="color: #009933; font-style: italic;">* @param  string    $output                  'html', 'xml', 'json', 'php', 'csvheader', 'csv', 'rss', 'fieldslist', 'htmledit'</span></span>
<span style="vertical-align:top"><span style="color: #009933; font-style: italic;">* @param  string    $formatting              'tr', 'td', 'div', 'span', 'none',   'table'??</span></span>
<span style="vertical-align:top"><span style="color: #009933; font-style: italic;">* @param  string    $reason                  'profile' for user profile view, 'edit' for user profile edit, 'register' for registration, 'search' for searches, 'list' for lists</span></span>
<span style="vertical-align:top"><span style="color: #009933; font-style: italic;">* @param  int       $list_compare_types      IF reason == 'search' : 0 : simple 'is' search, 1 : advanced search with modes, 2 : simple 'any' search</span></span>
<span style="vertical-align:top"><span style="color: #009933; font-style: italic;">* @return mixed                </span></span>
<span style="vertical-align:top"><span style="color: #009933; font-style: italic;">*/</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br />Contrary to what name of field implies you may also use a fields ID instead of its name. This is purely personal preference, but 1 must be provided for a valid existing field or nothing will be returned.<br /><br />Output of a field is highly important as this determines what format the API is going to return the fields value in. HTML by default will return the full html and rendering of a field, but if you change this to CSV you will get the RAW value of a field. If you get the Avatar field and have it set as HTML it will display the actual image, but if you set it s CSV it will only get the name of the image and not return it in an image tag.<br /><br />Formatting a field is generally left untouched, but with formatting you can add div, span, etc.. around a field to help it display better for your code design.<br /><br />The reason of a field determines WHERE the field is located. A good example is the Avatar. As you can see on your profile it's full sized and has no link, but looks completely different on the userlist. You can change the output to fit what location you want to mimic. If you leave it at default of profile then it will display as if it was being shown on profile, but a simple change to list will display it as if it was being shown on a userlist.<br /><br />
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: #f8f8f8 none repeat scroll 0% 0%; border-collapse: collapse; width: 100%;">
<thead> 
<tr>
<td colspan="2" style="background: #dddddd; color: #054b6e; padding: 2px 0px; text-align:center; font: bold italic 12px Verdana, Geneva, Arial, Helvetica, sans-serif;">Example</td>
</tr>
</thead> 
<tbody>
<tr class="li1">
<td style="border-right: 1px dotted #dddddd; background: #f0f0f0 none repeat scroll 0% 0%; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: right;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1
</pre>
</td>
<td style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #000088;">$avatar</span>	<span style="color: #339933;">=</span>	<span style="color: #000088;">$cbUser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getField</span><span style="color: #009900;">(</span> <span style="color: #0000ff;">'avatar'</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'html'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'none'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'list'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>]]></description>
			<pubDate>Tue, 28 Jul 2009 14:03:05 +0100</pubDate>
		</item>
		<item>
			<title>Tuesday, 28 July 2009 08:52  -  API - Establishing $user</title>
			<link>http://www.allmysocials.com//index.php?option=com_content&amp;view=article&amp;id=14:api-establishing-user&amp;catid=2:community-builder&amp;directory=15</link>
			<description><![CDATA[Sometimes $user has yet to be establish in your code; especially if you're using an external code from CB such as a module, but $user is needed for many CB API usages. So you'll need to establish the $user of the logged in user. To do this add the following to your code, which will generate $user as used in CB Plugins.<br /><br />
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: #f8f8f8 none repeat scroll 0% 0%; border-collapse: collapse; width: 100%;">
<tbody>
<tr class="li1">
<td style="border-right: 1px dotted #dddddd; background: #f0f0f0 none repeat scroll 0% 0%; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: right;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1
2
3
4
5
6
7
8
9
10
11
12
</pre>
</td>
<td style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #000088;">$myId</span>			<span style="color: #339933;">=</span>	<span style="color: #000088;">$_CB_framework</span><span style="color: #339933;">-></span><span style="color: #004000;">myId</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"><span style="color: #000088;">$cbUser</span>			<span style="color: #339933;">=&</span>	CBuser<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">(</span> <span style="color: #000088;">$myId</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span> <span style="color: #339933;">!</span> <span style="color: #000088;">$cbUser</span> <span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="color: #000088;">$cbUser</span>		<span style="color: #339933;">=&</span>	CBuser<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">(</span> <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="color: #000088;">$user</span>			<span style="color: #339933;">=</span>	<span style="color: #000088;">$cbUser</span><span style="color: #339933;">-></span><span style="color: #004000;">getUserData</span><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"> </span>
<span style="vertical-align:top"><span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span> <span style="color: #339933;">!</span> <span style="color: #000088;">$user</span> <span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span>
<span style="vertical-align:top">	<span style="color: #b1b100;">return</span><span style="color: #339933;">;</span></span>
<span style="vertical-align:top"><span style="color: #009900;">}</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br />Don't forget to add $_CB_framework global if it is yet to be established or it won't function and you'll receive an error. You can remove the $user check if you do not wish your code to stop, but keep note that all $user data will be null so be sure to compensate for this in your code!<br />]]></description>
			<pubDate>Tue, 28 Jul 2009 13:52:55 +0100</pubDate>
		</item>
		<item>
			<title>Friday, 17 July 2009 13:33  -  API - E-Mail</title>
			<link>http://www.allmysocials.com//index.php?option=com_content&amp;view=article&amp;id=12:api-e-mail&amp;catid=2:community-builder&amp;directory=15</link>
			<description><![CDATA[Community Builder has functions to easily allow e-mailing. These  functions support substitions allowing you to place field values within  your e-mails as well as even attaching files!<br /><br />The following  function is the proper usage of CBs E-Mail functions. This will allow  you to add e-mailing to any of your projects easily with a copy and  paste. All need be is to provide the necessary data for the e-mail to  send. <br /><br />
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border-collapse: collapse; width: 100%; border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8;">
<tbody>
<tr class="li1">
<td style="width: 1px; background: none repeat scroll 0% 0% #f0f0f0; vertical-align: top; color: #676f73; border-right: 1px dotted #dddddd; font-size: 12px; text-align: right;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br /></pre>
</td>
<td style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #000000; font-weight: bold;">function</span> sendMail<span style="color: #009900;">(</span> <span style="color: #000088;">$user_id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailTo</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailSubject</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailBody</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailHtml</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailFrom_email</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailFrom_name</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailCC</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailBCC</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailAttachments</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">	<a href="http://www.php.net/global"><span style="color: #990000;">global</span></a> <span style="color: #000088;">$_CB_framework</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$cbUser</span>				<span style="color: #339933;">=</span>	CBuser<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">(</span> <span style="color: #000088;">$user_id</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span> <span style="color: #339933;">!</span> <span style="color: #000088;">$cbUser</span> <span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">		<span style="color: #000088;">$cbUser</span>			<span style="color: #339933;">=</span>	CBuser<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">(</span> <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #009900;">}</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$mailTo</span>				<span style="color: #339933;">=</span>	<span style="color: #000088;">$cbUser</span><span style="color: #339933;">-></span><span style="color: #004000;">replaceUserVars</span><span style="color: #009900;">(</span> <span style="color: #000088;">$mailTo</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">false</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$mailCC</span>				<span style="color: #339933;">=</span>	<span style="color: #000088;">$cbUser</span><span style="color: #339933;">-></span><span style="color: #004000;">replaceUserVars</span><span style="color: #009900;">(</span> <span style="color: #000088;">$mailCC</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">false</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$mailBCC</span>			<span style="color: #339933;">=</span>	<span style="color: #000088;">$cbUser</span><span style="color: #339933;">-></span><span style="color: #004000;">replaceUserVars</span><span style="color: #009900;">(</span> <span style="color: #000088;">$mailBCC</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">false</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$mailSubject</span>			<span style="color: #339933;">=</span>	<span style="color: #000088;">$_CB_framework</span><span style="color: #339933;">-></span><span style="color: #004000;">getCfg</span><span style="color: #009900;">(</span> <span style="color: #0000ff;">'sitename'</span> <span style="color: #009900;">)</span> <span style="color: #339933;">.</span> <span style="color: #009900;">(</span> <span style="color: #000088;">$mailSubject</span> ? <span style="color: #0000ff;">' - '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$cbUser</span><span style="color: #339933;">-></span><span style="color: #004000;">replaceUserVars</span><span style="color: #009900;">(</span> CBTxt<span style="color: #339933;">::</span><span style="color: #004000;">T</span><span style="color: #009900;">(</span> <span style="color: #000088;">$mailSubject</span> <span style="color: #009900;">)</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">false</span> <span style="color: #009900;">)</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$mailBody</span>			<span style="color: #339933;">=</span>	<span style="color: #000088;">$cbUser</span><span style="color: #339933;">-></span><span style="color: #004000;">replaceUserVars</span><span style="color: #009900;">(</span> CBTxt<span style="color: #339933;">::</span><span style="color: #004000;">T</span><span style="color: #009900;">(</span> <span style="color: #000088;">$mailBody</span> <span style="color: #009900;">)</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">false</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #000088;">$mailAttachments</span>		<span style="color: #339933;">=</span>	<span style="color: #000088;">$cbUser</span><span style="color: #339933;">-></span><span style="color: #004000;">replaceUserVars</span><span style="color: #009900;">(</span> <span style="color: #000088;">$mailAttachments</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">false</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span> <span style="color: #000088;">$mailTo</span> <span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">		<span style="color: #000088;">$mailTo</span>			<span style="color: #339933;">=</span>	<a href="http://www.php.net/preg_split"><span style="color: #990000;">preg_split</span></a><span style="color: #009900;">(</span> <span style="color: #0000ff;">' *, *'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailTo</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #009900;">}</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">		<span style="color: #000088;">$mailTo</span>			<span style="color: #339933;">=</span>	<span style="color: #000000; font-weight: bold;">null</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #009900;">}</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span> <span style="color: #000088;">$mailCC</span> <span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">		<span style="color: #000088;">$mailCC</span>			<span style="color: #339933;">=</span>	<a href="http://www.php.net/preg_split"><span style="color: #990000;">preg_split</span></a><span style="color: #009900;">(</span> <span style="color: #0000ff;">' *, *'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailCC</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #009900;">}</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">		<span style="color: #000088;">$mailCC</span>			<span style="color: #339933;">=</span>	<span style="color: #000000; font-weight: bold;">null</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #009900;">}</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span> <span style="color: #000088;">$mailBCC</span> <span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">		<span style="color: #000088;">$mailBCC</span>		<span style="color: #339933;">=</span>	<a href="http://www.php.net/preg_split"><span style="color: #990000;">preg_split</span></a><span style="color: #009900;">(</span> <span style="color: #0000ff;">' *, *'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailBCC</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #009900;">}</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">		<span style="color: #000088;">$mailBCC</span>		<span style="color: #339933;">=</span>	<span style="color: #000000; font-weight: bold;">null</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #009900;">}</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span> <span style="color: #000088;">$mailAttachments</span> <span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">		<span style="color: #000088;">$mailAttachments</span>	<span style="color: #339933;">=</span>	<a href="http://www.php.net/preg_split"><span style="color: #990000;">preg_split</span></a><span style="color: #009900;">(</span> <span style="color: #0000ff;">' *, *'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailAttachments</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #009900;">}</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">		<span style="color: #000088;">$mailAttachments</span>	<span style="color: #339933;">=</span>	<span style="color: #000000; font-weight: bold;">null</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #009900;">}</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span> <span style="color: #000088;">$mailTo</span> <span style="color: #339933;">&&</span> <span style="color: #009900;">(</span> <span style="color: #000088;">$mailSubject</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$mailBody</span> <span style="color: #009900;">)</span> <span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span> comprofilerMail<span style="color: #009900;">(</span> <span style="color: #000088;">$mailFrom_email</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailFrom_name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailTo</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailSubject</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailBody</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailHtml</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailCC</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailBCC</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailAttachments</span> <span style="color: #009900;">)</span> <span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">			<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">		<span style="color: #009900;">}</span></span><br /><span style="vertical-align: top;">	<span style="color: #009900;">}</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;"><span style="color: #009900;">}</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p> </p>
Passing substitutions as outlined in the substitutions  tutorial through to, subject, body, cc, bcc will translate to the  appropriate value of the $user field value. This function can also be  used to send emails to non-registered users as long as a valid to  address is specified (subsitutions of course won't function for  non-existant users).]]></description>
			<pubDate>Fri, 17 Jul 2009 18:33:24 +0100</pubDate>
		</item>
		<item>
			<title>Tuesday, 23 June 2009 16:15  -  API - Triggers</title>
			<link>http://www.allmysocials.com//index.php?option=com_content&amp;view=article&amp;id=6:triggers&amp;catid=2:community-builder&amp;directory=15</link>
			<description><![CDATA[Community Builder has an assortment of triggers which can be used to alter CB data or even Joomla data without hacking the code. There are multiple use scenarios for these triggers. You can use them in modules, components, bots, plugins, or essentially anything you include the CB API in.<br /><br />To initiate a trigger you'll need to add the call for it. At the top of your php file add the following just below direct access check. You must ALWAYS include the Global for $_PLUGINS to avoid any errors.<br /><br />
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8; border-collapse: collapse; width: 100%;">
<thead> 
<tr>
<td colspan="2" style="background: #dddddd; color: #054b6e; padding: 2px 0px; text-align: center; font: bold italic 12px Verdana, Geneva, Arial, Helvetica, sans-serif;">Trigger Call Format</td>
</tr>
</thead> 
<tbody>
<tr class="li1">
<td style="border-right: 1px dotted #dddddd; background: none repeat scroll 0% 0% #f0f0f0; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: right;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">1<br />2<br /></pre>
</td>
<td style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><a href="http://www.php.net/global"><span style="color: #990000;">global</span></a> <span style="color: #000088;">$_PLUGINS</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;"><span style="color: #000088;">$_PLUGINS</span><span style="color: #339933;">-></span><span style="color: #004000;">registerFunction</span><span style="color: #009900;">(</span> <span style="color: #0000ff;">'TRIGGER'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'FUNCTION'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'CLASS'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br />The format above is mandatory with the exception of Class, This allows you to call Function when Trigger is executed. Class allows you to trigger Function in Class. Some triggers pass variables upon execution. You can specify these variables at the end of the Function with the format of Function( $var1, $var2 ). Optionally you can ignore this and specify the variables in your function it self such as:<br /><br />
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8; border-collapse: collapse; width: 100%;">
<tbody>
<tr class="li1">
<td style="border-right: 1px dotted #dddddd; background: none repeat scroll 0% 0% #f0f0f0; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: right;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">1<br /></pre>
</td>
<td style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #000000; font-weight: bold;">function</span> <span style="color: #000000; font-weight: bold;">Function</span><span style="color: #009900;">(</span> <span style="color: #000088;">$var1</span><span style="color: #339933;">,</span> <span style="color: #000088;">$var2</span> <span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br />Now that the formatting and preparation is understood you'll need to know the list of available triggers. Below is a rather large list of triggers found all throughout CB which are all available for your usage. Keep in mind some due contain variables; generally all have the starting variable of $user.<br /><br />//Community Builder<br />onBeforeEmailUserForm<br />onAfterEmailUserForm<br />onBeforeUserProfileEditDisplay<br />onAfterUserProfileEditDisplay<br />onBeforeUserProfileRequest<br />onBeforeUserProfileDisplay<br />onAfterUserProfileDisplay<br />onBeforeDisplayUsersList<br />onLostPassForm<br />onBeforeLoginFormDisplay<br />onBeforeRegisterFormDisplay<br />onBeforeEmailUser<br />onBeforeUserAvatarUpdate<br />onAfterUserAvatarUpdate<br />onStartUsersList<br />onAfterUsersListFieldsSql<br />onBeforeUsersListBuildQuery<br />onBeforeUsersListQuery<br />onStartNewPassword<br />onBeforeUsernameReminder<br />onAfterUsernameReminder<br />onBeforeNewPassword<br />onNewPassword<br />onBeforeRegisterForm<br />onStartSaveUserRegistration<br />onAfterUserRegistrationMailsSent<br />onBeforeLogin<br />onLoginAuthentication<br />onDuringLogin<br />onBeforeFirstLogin<br />onDoLoginNow<br />onAfterLogin<br />onBeforeLogout<br />onDoLogoutNow<br />onAfterLogout<br />onBeforeUserConfirm<br />onAfterUserConfirm<br />onBeforeUserApproval<br />onAfterUserApproval<br />onBeforeUserApproval<br />onBeforeBackendUsersListBuildQuery<br />onAfterBackendUsersList<br />onBeforeUserBlocking<br />onBeforeSyncUser<br />onAfterSyncUser<br />onAfterCheckCbDb<br />onAfterCheckCbFieldsDb<br />onBeforeFixDb<br />onAfterFixDb<br />onBeforeFixFieldsDb<br />onBeforeUserActive<br />onUserActive<br />onBeforeDeleteUser<br />onAfterDeleteUser<br />onAfterTabsFetch<br />onPrepareMenus<br />onAfterEditATab<br />onAfterFieldsFetch<br />onBeforeAddConnection<br />onAfterAddConnection<br />onBeforeRemoveConnection<br />onAfterRemoveConnection<br />onBeforeDenyConnection<br />onAfterDenyConnection<br />onBeforeAcceptConnection<br />onAfterAcceptConnection<br />onFieldIcons<br />onLogChange<br />onBeforeUserUpdate<br />onBeforeNewUser<br />onBeforeUpdateUser<br />onBeforeUserRegistration<br />onSaveUserError<br />onAfterUserUpdate<br />onAfterNewUser<br />onAfterUpdateUser<br />onAfterUserRegistration<br />onBeforegetFieldRow<br /><br />//Community Builder Captcha<br />onGetCaptchaHtmlElements<br /><br /><br />
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8; border-collapse: collapse; width: 100%;">
<thead> 
<tr>
<td colspan="2" style="background: #dddddd; color: #054b6e; padding: 2px 0px; text-align: center; font: bold italic 12px Verdana, Geneva, Arial, Helvetica, sans-serif;">Example</td>
</tr>
</thead> 
<tbody>
<tr class="li1">
<td style="border-right: 1px dotted #dddddd; background: none repeat scroll 0% 0% #f0f0f0; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: right;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br /></pre>
</td>
<td style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span> <span style="color: #339933;">!</span> <span style="color: #009900;">(</span> <a href="http://www.php.net/defined"><span style="color: #990000;">defined</span></a><span style="color: #009900;">(</span> <span style="color: #0000ff;">'_VALID_CB'</span> <span style="color: #009900;">)</span> <span style="color: #339933;">||</span> <a href="http://www.php.net/defined"><span style="color: #990000;">defined</span></a><span style="color: #009900;">(</span> <span style="color: #0000ff;">'_JEXEC'</span> <span style="color: #009900;">)</span> <span style="color: #339933;">||</span> <a href="http://www.php.net/defined"><span style="color: #990000;">defined</span></a><span style="color: #009900;">(</span> <span style="color: #0000ff;">'_VALID_MOS'</span> <span style="color: #009900;">)</span> <span style="color: #009900;">)</span> <span style="color: #009900;">)</span> <span style="color: #009900;">{</span> <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">(</span> <span style="color: #0000ff;">'Direct Access to this location is not allowed.'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="color: #009900;">}</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;"><a href="http://www.php.net/global"><span style="color: #990000;">global</span></a> <span style="color: #000088;">$_PLUGINS</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;"><span style="color: #000088;">$_PLUGINS</span><span style="color: #339933;">-></span><span style="color: #004000;">registerFunction</span><span style="color: #009900;">(</span> <span style="color: #0000ff;">'onAfterLogin'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'confirmLogin'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'getconfirmTab'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;"><span style="color: #000000; font-weight: bold;">class</span> getconfirmTab <span style="color: #000000; font-weight: bold;">extends</span> cbTabHandler <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">	<span style="color: #000000; font-weight: bold;">function</span> confirmLogin<span style="color: #009900;">(</span> <span style="color: #000088;">$user</span><span style="color: #339933;">,</span> <span style="color: #000088;">$loggedIn</span> <span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">		<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span> $loggedIn  <span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">			<a href="http://www.php.net/echo"><span style="color: #990000;">echo</span></a> <span style="color: #0000ff;">'Welcome!'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-></span><span style="color: #004000;">username</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">		<span style="color: #009900;">}</span></span><br /><span style="vertical-align: top;">	<span style="color: #009900;">}</span></span><br /><span style="vertical-align: top;"><span style="color: #009900;">}</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>]]></description>
			<pubDate>Tue, 23 Jun 2009 21:15:00 +0100</pubDate>
		</item>
		<item>
			<title>Tuesday, 23 June 2009 16:15  -  API - Joomla Replacements</title>
			<link>http://www.allmysocials.com//index.php?option=com_content&amp;view=article&amp;id=7:joomla-replacements&amp;catid=2:community-builder&amp;directory=15</link>
			<description><![CDATA[We all know Joomla provies things such as $my, $mainframe, mosRedirect, and many others. This is great, but it isn't cross-platformed! That means your Joomla 1.0 plugins, componenets, etc... will all fail on Joomla 1.5. CB can remedy this by allowing a cross-platformed API. Essentially CBs replacements do exactly what Joomlas does, but works on all platforms! The following list is EXACT replacements; omiting parts of the replacement will cause them to fail. Each replacement is specified by <span style="color: #ff0000;">Old</span> and <span style="color: #0000ff;">New</span> as follows.<br /><br /><span style="color: #ff0000;">defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );</span><br /><span style="color: #0000ff;">if ( ! ( defined( '_VALID_CB' ) || defined( '_JEXEC' ) || defined( '_VALID_MOS' ) ) ) { die( 'Direct Access to this location is not allowed.' ); }</span><br /><br /><span style="color: #ff0000;">global $mainframe</span><br /><span style="color: #0000ff;">global $_CB_framework</span><br /><br /><span style="color: #ff0000;">global $database</span><br /><span style="color: #0000ff;">global $_CB_database</span><br /><br /><span style="color: #ff0000;">$database-&gt;</span><br /><span style="color: #0000ff;">$_CB_database-&gt;</span><br /><br /><span style="color: #ff0000;">$mosConfig_XXX</span><br /><span style="color: #0000ff;">$_CB_framework-&gt;getCfg(  'xxx'  )</span><br /><br /><span style="color: #ff0000;">$mainframe-&gt;getCfg( 'live_site' )</span><br /><span style="color: #0000ff;">$_CB_framework-&gt;getCfg( 'live_site' )</span><br /><br /><span style="color: #ff0000;">$mosConfig_live_site</span><br /><span style="color: #0000ff;">$_CB_framework-&gt;getCfg( 'live_site' )</span><br /><br /><span style="color: #ff0000;">$mosConfig_absolute_path</span><br /><span style="color: #0000ff;">$_CB_framework-&gt;getCfg( 'live_site' )</span><br /><br /><span style="color: #ff0000;">$my-&gt;id</span><br /><span style="color: #0000ff;">$_CB_framework-&gt;myId()</span><br /><br /><span style="color: #ff0000;">$my-&gt;username</span><br /><span style="color: #0000ff;">$_CB_framework-&gt;myUsername()</span><br /><br /><span style="color: #ff0000;">$my-&gt;gid</span><br /><span style="color: #0000ff;">$_CB_framework-&gt;myCmsGid()</span><br /><br /><span style="color: #ff0000;">sefRelToAbs(</span><br /><span style="color: #0000ff;">cbSef(</span><br /><br /><span style="color: #ff0000;">mosRedirect(</span><br /><span style="color: #0000ff;">cbRedirect(</span><br /><br /><span style="color: #ff0000;">mosgetparam(</span><br /><span style="color: #0000ff;">cbGetParam(</span><br /><br /><span style="color: #ff0000;">mosArrayToInts</span><br /><span style="color: #0000ff;">cbArrayToInts</span><br /><br /><span style="color: #ff0000;">mosUser</span><br /><span style="color: #0000ff;">moscomprofilerUser</span><br /><br /><span style="color: #ff0000;">mosTabs</span><br /><span style="color: #0000ff;">cbTabs</span><br /><br /><span style="color: #ff0000;">mosFormatDate( $date )</span><br /><span style="color: #0000ff;">cbFormatDate( $date, $serverTimeOffset = 1, $showtime = true )</span><br /><br /><span style="color: #ff0000;">editorArea(  'editor' . $oName,  $oValue, $oName, 600, 350, $oCols, $oRows )</span><br /><span style="color: #0000ff;">$_CB_framework-&gt;displayCmsEditor( $oName,  $oValue, 600, 350, $oCols, $oRows )</span><br /><br /><span style="color: #ff0000;">mosHTML::makeOption( '_UE_YES', _CMN_YES )</span><br /><span style="color: #0000ff;">moscomprofilerHTML::makeOption( '_UE_YES', _UE_YES )</span><br /><br /><span style="color: #ff0000;">mosHTML::selectList( &amp;$arr, $tag_name, $tag_attribs, $key, $text, $selected, $required = 0 )</span><br /><span style="color: #0000ff;">moscomprofilerHTML::selectList( &amp;$arr, $tag_name, $tag_attribs, $key, $text, $selected, $required = 0, $htmlspecialcharText = true )</span><br /><br /><span style="color: #ff0000;">$_VERSION</span><br /><span style="color: #0000ff;">checkJVersion()</span><br /><br />The above is just a small sample of the many API functions available, but this is a quick overview of the basic replacement functions.]]></description>
			<pubDate>Tue, 23 Jun 2009 21:15:00 +0100</pubDate>
		</item>
		<item>
			<title>Tuesday, 23 June 2009 16:15  -  API - Input Lists</title>
			<link>http://www.allmysocials.com//index.php?option=com_content&amp;view=article&amp;id=8:input-lists&amp;catid=2:community-builder&amp;directory=15</link>
			<description><![CDATA[Community Builder has an assortment of API functions available for building a multitude of input lists. These are great for easy creation of lists and are considered a replacement for Joomlas list API.<br /><br /><strong>Select List</strong><br />moscomprofilerHTML::selectList( &$arr, $tag_name, $tag_attribs, $key, $text, $selected, $required = 0, $htmlspecialcharText = true )<br /><br />
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: #f8f8f8 none repeat scroll 0% 0%; border-collapse: collapse; width: 100%;">
<tbody>
<tr class="li1">
<td style="border-right: 1px dotted #dddddd; background: #f0f0f0 none repeat scroll 0% 0%; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: right;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1<br /></pre>
</td>
<td style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #b1b100;">return</span> moscomprofilerHTML<span style="color: #339933;">::</span><span style="color: #004000;">selectList</span><span style="color: #009900;">(</span> <span style="color: #000088;">$list</span><span style="color: #339933;">,</span> <span style="color: #000088;">$name</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'value'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'text'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br /><strong>Radio List</strong><br />moscomprofilerHTML::radioList( &$arr, $tag_name, $tag_attribs, $key, $text, $selected, $required = 0 )<br /><br />
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: #f8f8f8 none repeat scroll 0% 0%; border-collapse: collapse; width: 100%;">
<tbody>
<tr class="li1">
<td style="border-right: 1px dotted #dddddd; background: #f0f0f0 none repeat scroll 0% 0%; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: right;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1
</pre>
</td>
<td style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #b1b100;">return</span> moscomprofilerHTML<span style="color: #339933;">::</span><span style="color: #004000;">radioList</span><span style="color: #009900;">(</span> <span style="color: #000088;">$allValues</span><span style="color: #339933;">,</span> <span style="color: #000088;">$name</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'value'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'text'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br /><strong>Yes / No List</strong><br />moscomprofilerHTML::yesnoSelectList( $tag_name, $tag_attribs, $selected, $yes = _UE_YES, $no = _UE_NO ) <br /><br />
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: #f8f8f8 none repeat scroll 0% 0%; border-collapse: collapse; width: 100%;">
<tbody>
<tr class="li1">
<td style="border-right: 1px dotted #dddddd; background: #f0f0f0 none repeat scroll 0% 0%; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: right;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1
</pre>
</td>
<td style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #b1b100;">return</span> moscomprofilerHTML<span style="color: #339933;">::</span><span style="color: #004000;">yesnoSelectList</span><span style="color: #009900;">(</span> <span style="color: #000088;">$name</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Yup'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Nope'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br /><strong>Checkbox List</strong><br />moscomprofilerHTML::checkboxList( &$arr, $tag_name, $tag_attribs,  $key='value', $text='text',$selected=null, $required=0 )<br /><br />
<div class="rj_insertcode">
<div class="rj_insertcode_abap">
<table class="abap" style="border: 1px solid #054b6e; background: #f8f8f8 none repeat scroll 0% 0%; border-collapse: collapse; width: 100%;">
<tbody>
<tr class="li1">
<td style="border-right: 1px dotted #dddddd; background: #f0f0f0 none repeat scroll 0% 0%; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: right;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1<br /></pre>
</td>
<td style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #b1b100;">return</span> moscomprofilerHTML<span style="color: #66cc66;">::</span><span style="color: #202020;">checkboxList</span><span style="color: #66cc66;">(</span> $allValues, $name, <span style="color: #ff0000;">''</span>, <span style="color: #ff0000;">'value'</span>, <span style="color: #ff0000;">'text'</span>, $value, <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">)</span>;</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br /><strong>List / Radio / Multi-Checkbox Option</strong><br />moscomprofilerHTML::makeOption( $value, $text = '', $valueName = 'value', $textName = 'text' )<br /><br />
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: #f8f8f8 none repeat scroll 0% 0%; border-collapse: collapse; width: 100%;">
<tbody>
<tr class="li1">
<td style="border-right: 1px dotted #dddddd; background: #f0f0f0 none repeat scroll 0% 0%; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: right;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">1<br />2<br /></pre>
</td>
<td style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;">
<pre style="margin:0; background:none; vertical-align:top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align:top"><span style="color: #000088;">$list</span>		<span style="color: #339933;">=</span>	<a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align:top"><span style="color: #000088;">$list</span><span style="color: #009900;">[</span><span style="color: #009900;">]</span>		<span style="color: #339933;">=</span>	moscomprofilerHTML<span style="color: #339933;">::</span><span style="color: #004000;">makeOption</span><span style="color: #009900;">(</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'--- Select One ---'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>]]></description>
			<pubDate>Tue, 23 Jun 2009 21:15:00 +0100</pubDate>
		</item>
		<item>
			<title>Tuesday, 23 June 2009 16:15  -  Include CB API</title>
			<link>http://www.allmysocials.com//index.php?option=com_content&amp;view=article&amp;id=9:include-cb-api&amp;catid=1:joomla&amp;directory=15</link>
			<description><![CDATA[Ever wonder if you can design your Joomla components to work on any platform easily? You can actually, but keep note this requires Community Builder to be installed. You can include the CB API directly into your modules, components, or plugins. You will then have the power of CB API at your finger tips.<br /><br /><strong>Include CB Foundation</strong><br />
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8; border-collapse: collapse; width: 100%;">
<tbody>
<tr class="li1">
<td style="border-right: 1px dotted #dddddd; background: none repeat scroll 0% 0% #f0f0f0; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: right;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></pre>
</td>
<td style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;"><a href="http://www.php.net/global"><span style="color: #990000;">global</span></a> <span style="color: #000088;">$_CB_framework</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mainframe</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span> <a href="http://www.php.net/defined"><span style="color: #990000;">defined</span></a><span style="color: #009900;">(</span> <span style="color: #0000ff;">'JPATH_ADMINISTRATOR'</span> <span style="color: #009900;">)</span> <span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">	<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span> <span style="color: #339933;">!</span> <a href="http://www.php.net/file_exists"><span style="color: #990000;">file_exists</span></a><span style="color: #009900;">(</span> JPATH_ADMINISTRATOR <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/components/com_comprofiler/plugin.foundation.php'</span> <span style="color: #009900;">)</span> <span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">		<a href="http://www.php.net/echo"><span style="color: #990000;">echo</span></a> <span style="color: #0000ff;">'CB not installed!'</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">		<span style="color: #b1b100;">return</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #009900;">}</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #b1b100;">include_once</span><span style="color: #009900;">(</span> JPATH_ADMINISTRATOR <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/components/com_comprofiler/plugin.foundation.php'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;"><span style="color: #009900;">}</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">	<span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span> <span style="color: #339933;">!</span> <a href="http://www.php.net/file_exists"><span style="color: #990000;">file_exists</span></a><span style="color: #009900;">(</span> <span style="color: #000088;">$mainframe</span><span style="color: #339933;">-></span><span style="color: #004000;">getCfg</span><span style="color: #009900;">(</span> <span style="color: #0000ff;">'absolute_path'</span> <span style="color: #009900;">)</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/administrator/components/com_comprofiler/plugin.foundation.php'</span> <span style="color: #009900;">)</span> <span style="color: #009900;">)</span> <span style="color: #009900;">{</span></span><br /><span style="vertical-align: top;">		<a href="http://www.php.net/echo"><span style="color: #990000;">echo</span></a> <span style="color: #0000ff;">'CB not installed!'</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">		<span style="color: #b1b100;">return</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;">	<span style="color: #009900;">}</span></span><br /><span style="vertical-align: top;"> </span><br /><span style="vertical-align: top;">	<span style="color: #b1b100;">include_once</span><span style="color: #009900;">(</span> <span style="color: #000088;">$mainframe</span><span style="color: #339933;">-></span><span style="color: #004000;">getCfg</span><span style="color: #009900;">(</span> <span style="color: #0000ff;">'absolute_path'</span> <span style="color: #009900;">)</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/administrator/components/com_comprofiler/plugin.foundation.php'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span><br /><span style="vertical-align: top;"><span style="color: #009900;">}</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br /><br />Now the above will give you access to many of the functions provided by the foundation and in most cases this is all you'll need. However if you want to use class functions and plugin functions or even database functions you need to follow the include with a cb import.<br /><br /><strong>Include Database Functions</strong><br />
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8; border-collapse: collapse; width: 100%;">
<tbody>
<tr class="li1">
<td style="border-right: 1px dotted #dddddd; background: none repeat scroll 0% 0% #f0f0f0; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: right;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">1<br /></pre>
</td>
<td style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;">cbimport<span style="color: #009900;">(</span> <span style="color: #0000ff;">'cb.database'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br /><strong>Include Frontend Language Definitions</strong><br />
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8; border-collapse: collapse; width: 100%;">
<tbody>
<tr class="li1">
<td style="border-right: 1px dotted #dddddd; background: none repeat scroll 0% 0% #f0f0f0; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: right;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">1<br /></pre>
</td>
<td style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;">cbimport<span style="color: #009900;">(</span> <span style="color: #0000ff;">'language.front'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br /><strong>Include Snoopy Functions</strong><br />
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8; border-collapse: collapse; width: 100%;">
<tbody>
<tr class="li1">
<td style="border-right: 1px dotted #dddddd; background: none repeat scroll 0% 0% #f0f0f0; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: right;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">1<br /></pre>
</td>
<td style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;">cbimport<span style="color: #009900;">(</span> <span style="color: #0000ff;">'cb.snoopy'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br /><strong>Include Image Toolbox Functions</strong><br />
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8; border-collapse: collapse; width: 100%;">
<tbody>
<tr class="li1">
<td style="border-right: 1px dotted #dddddd; background: none repeat scroll 0% 0% #f0f0f0; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: right;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">1<br /></pre>
</td>
<td style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;">cbimport<span style="color: #009900;">(</span> <span style="color: #0000ff;">'cb.imgtoolbox'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br /><strong>Include Class & Plugin Functions</strong><br />
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8; border-collapse: collapse; width: 100%;">
<tbody>
<tr class="li1">
<td style="border-right: 1px dotted #dddddd; background: none repeat scroll 0% 0% #f0f0f0; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: right;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">1<br /></pre>
</td>
<td style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;">cbimport<span style="color: #009900;">(</span> <span style="color: #0000ff;">'cb.html'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br /><strong>Include Plugin Functions</strong><br />
<div class="rj_insertcode">
<div class="rj_insertcode_php">
<table class="php" style="border: 1px solid #054b6e; background: none repeat scroll 0% 0% #f8f8f8; border-collapse: collapse; width: 100%;">
<tbody>
<tr class="li1">
<td style="border-right: 1px dotted #dddddd; background: none repeat scroll 0% 0% #f0f0f0; width: 1px; vertical-align: top; color: #676f73; font-size: 12px; text-align: right;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">1<br /></pre>
</td>
<td style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;">
<pre style="margin: 0; background: none; vertical-align: top; padding: 0px 4px; font-size: 12px;"><span style="vertical-align: top;">cbimport<span style="color: #009900;">(</span> <span style="color: #0000ff;">'cb.plugins'</span> <span style="color: #009900;">)</span><span style="color: #339933;">;</span></span></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>]]></description>
			<pubDate>Tue, 23 Jun 2009 21:15:00 +0100</pubDate>
		</item>
		<item>
			<title>Tuesday, 23 June 2009 16:15  -  Substitutions</title>
			<link>http://www.allmysocials.com//index.php?option=com_content&amp;view=article&amp;id=10:substitutions&amp;catid=2:community-builder&amp;directory=15</link>
			<description><![CDATA[Community Builder supports substitutions in many locations such as delimiter fields, field titles, cb content module, and more. There are substitutions for simple to advanced and complex capabilities for displaying fields or even tabs. The following will diminstrate how to use CB Substitutions properly and to their fullest extend as well as examples of these usage scenarios. All tests are performed in the CB Content module.<br /><br /><strong>Simple Raw Field Value</strong><br />[FIELD_NAME]<br /><br />The user [username] lives in [cb_citystate] and his name is: [name].<br />The user BobTBurns lives in Springfield, OH and his name is: Bob.<br /><br /><strong>Raw Field Value</strong><br />[cb:userdata field="FIELD_NAME" /]<br /><br />The user [cb:userdata field="username" /] lives in [cb:userdata field="cb_citystate" /] and his name is: [cb:userdata field="name" /].<br />The user BobTBurns lives in Springfield, OH and his name is: Bob.<br /><br /><strong>Original Field Value</strong><br /> [cb:userfield field="FIELD_NAME" /]<br /><br />The user [cb:userfield field="username" /] lives in [cb:userfield field="cb_citystate" /] and his name is: [cb:userfield field="name" /].<br />The user <a href="#">BobTBurns</a> lives in <span style="text-decoration: underline;">Springfield, OH</span> and his name is: <a href="#">Bob</a>.<br /><br />In addition to being able to display fields with the new substitutions method you have a multitude of parameters that can be added to extend the substitution requirements. These additionally parameters are required to provide usage of the IF substitution.<br />user - userid, #me, #displayed, #displayedOrMe<br />usertype<br />user_id - myid, ##<br />username<br /><br /><strong>Parameters</strong><br />[cb:userdata field="FIELD_NAME" user="REPLACEMENT" /]<br /><br />The user [cb:userdata field="username" user="#me" /] lives in [cb:userdata field="cb_citystate" user="62" /] and his name is: [cb:userdata field="name" user="#me" /].<br />The user BobTBurns lives in Branson, MO and his name is: Bob.<br /><br />Parameters are also affected by operators which can change the way the the data is displayed or if it's even displayed at all.<br /><br /><strong>Operators</strong><br />and, or, = , !=, , =~, !~, , &&, >=, <=, ||<br /><br /><strong>Tab</strong><br />[cb:usertab tab="TAB_ID" user="REPLACEMENT" /]<br /><br />[cb:usertab tab="17" user="#displayedOrMe" /]<br />Displays CBs Menu tab.<br /><br /><strong>Ifs</strong><br />[cb:if PARAMETER="REPLACEMENT"]TEXT/CODE[/cb:if]<br /><br />[cb:if username="demo"]This is Demo being displayed.[/cb:if]<br />[cb:if user_id="myid"]This is Me being displayed.[/cb:if]<br />[cb:if user="#displayed" username="test"]This is Test being displayed.[/cb:if]<br />[cb:if user="#me" username="demo"]This is Demo watching.[/cb:if]<br />[cb:if user="#me" usertype="Super Administrator"]User of type: [cb:userdata field="usertype" /][/cb:if]<br />[cb:if user="#displayedOrMe" user_id="0"]I am A GUEST.[/cb:if]<br />[cb:if user="#me" username!="admin"]This is NOT Admin watching.[/cb:if]<br /><br />There are many more possibilities. It's just a matter of trial and error to see what works for you.<br />]]></description>
			<pubDate>Tue, 23 Jun 2009 21:15:00 +0100</pubDate>
		</item>
	</channel>
</rss>
