Simple SQL table creation

<?php

global $test_db_version;
$test_db_version = "1.0";

function test_create_db_table() {
global $wpdb;
global $test_db_version;

$table_name = $wpdb->prefix . "test_table";
if($wpdb->get_var("show tables like '$table_name'") != $table_name) {

$sql = "CREATE TABLE " . $table_name . " (
id mediumint(9) NOT NULL AUTO_INCREMENT,
time varchar(11) NOT NULL,
title text NOT NULL,
body text NOT NULL,
UNIQUE KEY id (id)
);";

require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);

add_option("test_db_version", $test_db_version);
}
}

function test_add_row(){
global $wpdb;
$table_name = $wpdb->prefix . "test_table";

$test_title = "The Title";
$test_body = "The Body Text";

$rows_affected = $wpdb->insert( $table_name, array( 'time' => date("m-d-Y"), 'title' => $test_title, 'body' => $test_body ) );
}

add_action('init','test_create_db_table');
/* Uncomment this action to initiate a new row
Just replcace wp_login with the hook of your choice
add_action('wp_login','test_add_row');
*/
?>

Conditional Reference

bp_is_my_profile()
bp_is_home() - same as bp_is_my_profile()

bp_is_blog_page() - catch all for a WP blog page in BP

bp_is_directory()

bp_is_serialized($data) - checks to see if $data is serialized

bp_is_front_page()
bp_is_activity_front_page()

bp_is_page($page) - checks if $bp->current_component matches $page

bp_is_active( $component ) - checks if a BP $component is active

bp_is_profile_component()
bp_is_activity_component()
bp_is_blogs_component()
bp_is_messages_component()
bp_is_friends_component()
bp_is_groups_component()
bp_is_settings_component()

bp_is_member()

bp_is_user_activity()
bp_is_user_friends_activity()

bp_is_activity_permalink()

bp_is_user_profile()
bp_is_profile_edit()
bp_is_change_avatar()

bp_is_user_groups()
bp_is_group()
bp_is_group_home()
bp_is_group_create()
bp_is_group_admin_page()
bp_is_group_forum()
bp_is_group_activity()
bp_is_group_forum_topic()
bp_is_group_forum_topic_edit()
bp_is_group_members()
bp_is_group_invites()
bp_is_group_membership_request()
bp_is_group_leave()
bp_is_group_single()

bp_is_user_blogs()
bp_is_user_recent_posts()
bp_is_user_recent_commments()
bp_is_create_blog()

bp_is_user_friends()

bp_is_friend_requests()

bp_is_user_messages()
bp_is_messages_inbox()
bp_is_messages_sentbox()
bp_is_notices()
bp_is_messages_compose_screen()

bp_is_single_item()

bp_is_activation_page()
bp_is_register_page()

Crossdomain XML

<!-- Snippet 1 -->

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE cross-domain-policy SYSTEM 'http://www.adobe.com/xml/dtds/cross-domain-policy.dtd'>
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*"/>
</cross-domain-policy>

<!-- Snippet 2 -->
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE cross-domain-policy SYSTEM 'http://www.adobe.com/xml/dtds/cross-domain-policy.dtd'>
<cross-domain-policy>
<allow-access-from domain="*.mydomain.com" />
</cross-domain-policy>

Body Class

<body class="<?php if($_SERVER['REQUEST_URI'] == '/') echo 'home'; else
$replace=array('/','.','?','&','='); echo str_replace($replace,'_',trim($_SERVER['REQUEST_URI'],'/'))?>">

<!-- Example:

This URL: http://hyperspatial.com/pages/funpages/my-fun-page/

<body class="pages_funpages_my-fun-page">

-->

Is user online

<?php
function omega_is_displayed_user_online(){
$member_id = bp_displayed_user_id();
if (bp_has_members('user_id=0&type=online')) :
while (bp_members()) : bp_the_member();
if($member_id == bp_get_member_user_id()) return true;
endwhile;
endif;
}

function omega_is_user_online($user_id){
if (bp_has_members('user_id=0&type=online')) :
while (bp_members()) : bp_the_member();
if($user_id == bp_get_member_user_id()) return true;
endwhile;
endif;
}
?>

Welcome User Msg in Admin Nav Bar

function add_welcome() {
global $current_user;
get_currentuserinfo();
$author = $current_user->display_name;
if ( is_user_logged_in() ) {
echo "<li class="welcome">" . bp_author_avatar() . "Welcome <strong>" . $author . "</strong></li>";
} else {
echo "<li class="welcome">Welcome <strong>Guest</strong></li>";
}
}

add_action( 'bp_adminbar_menus', 'add_welcome', 15 );

Favorite link for individual posts

<?php

//For the functions.php file

function my_bp_activity_is_favorite($activity_id) {
global $bp, $activities_template;
return apply_filters( 'bp_get_activity_is_favorite', in_array( $activity_id, (array)$activities_template->my_favs ) );
}

function my_bp_activity_favorite_link($activity_id) {
global $activities_template;
echo apply_filters( 'bp_get_activity_favorite_link', wp_nonce_url( site_url( BP_ACTIVITY_SLUG . '/favorite/' . $activity_id . '/' ), 'mark_favorite' ) );
}

function my_bp_activity_unfavorite_link($activity_id) {
global $activities_template;
echo apply_filters( 'bp_get_activity_unfavorite_link', wp_nonce_url( site_url( BP_ACTIVITY_SLUG . '/unfavorite/' . $activity_id . '/' ), 'unmark_favorite' ) );
}
?>

<?

//For single.php - put within the WP loop

global $bp;
$activity_id = bp_activity_get_activity_id( array(
'user_id' => $post->author_id,
'type' => 'new_blog_post',
'component' => 'blogs',
'item_id' => 1,
'secondary_item_id' => $post->ID
) );
?>

<?php if ( is_user_logged_in() ) : ?>
<?php bp_has_activities();
if ( !my_bp_activity_is_favorite($activity_id) ) : ?>
<a href="<?php my_bp_activity_favorite_link($activity_id) ?>" class="fav" title="<?php _e( 'Mark as Favorite', 'buddypress' ) ?>"><?php _e( 'Favorite', 'buddypress' ) ?></a>
<?php else : ?>
<a href="<?php my_bp_activity_unfavorite_link($activity_id) ?>" class="unfav" title="<?php _e( 'Remove Favorite', 'buddypress' ) ?>"><?php _e( 'Un-favorite', 'buddypress' ) ?></a><br>
<a href="<?php echo bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/favorites/' ?>" style="font-size: 12px;">View Your Favorites</a>
<?php endif; ?>
<?php endif;?>

AutoPlay swf only on first visit

// This part is for the header

<?php
// Cookie for home page swf
if (empty($_COOKIE['viewed'])) setcookie('viewed', 'true', time() + (60*60*24*90));
?>

// This part is for the .swf object

<object type="application/x-shockwave-flash" data="http://thinkiatrywebinar.com/swf/thinkiatryflashmovie.swf" width="697" height="271">
<?php if( $_COOKIE['viewed'] == 'true'){echo '<param name="PLAY" value="false" />';}?>
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<param name="swfversion" value="6.0.65.0" />
<param name="expressinstall" value="scripts/expressInstall.swf" />
<param name="movie" value=""http://thinkiatrywebinar.com/swf/thinkiatryflashmovie.swf" />
</object>