State List

Alabama
Alaska
Arizona
Arkansas
California
Colorado
Connecticut
Delaware
Florida
Georgia
Hawaii
Idaho
Illinois
Indiana
Iowa
Kansas
Kentucky
Louisiana
Maine
Maryland
Massachusetts
Michigan
Minnesota
Mississippi
Missouri
Montana
Nebraska
Nevada
New Hampshire
New Jersey
New Mexico
New York
North Carolina
North Dakota
Ohio
Oklahoma
Oregon
Pennsylvania
Rhode Island
South Carolina
South Dakota
Tennessee
Texas
Utah
Vermont
Virginia
Washington
West Virginia
Wisconsin
Wyoming

Abbreviate State Switch

switch($the_state){
case 'Alabama';
echo 'AL';
break;
case 'Alaska';
echo 'AK';
break;
case 'Arizona';
echo 'AZ';
break;
case 'Arkansas';
echo 'AR';
break;
case 'California';
echo 'CA';
break;
case 'Colorado';
echo 'CO';
break;
case 'Connecticut';
echo 'CT';
break;
case 'Delaware';
echo 'DE';
break;
case 'Florida';
echo 'FL';
break;
case 'Georgia';
echo 'GA';
break;
case 'Hawaii';
echo 'HI';
break;
case 'Idaho';
echo 'ID';
break;
case 'Illinois';
echo 'IL';
break;
case 'Indiana';
echo 'IN';
break;
case 'Iowa';
echo 'IA';
break;
case 'Kansas';
echo 'KS';
break;
case 'Kentucky';
echo 'KY';
break;
case 'Louisiana';
echo 'LA';
break;
case 'Maine';
echo 'ME';
break;
case 'Maryland';
echo 'MD';
break;
case 'Massachusetts';
echo 'MA';
break;
case 'Michigan';
echo 'MI';
break;
case 'Minnesota';
echo 'MN';
break;
case 'Mississippi';
echo 'MS';
break;
case 'Missouri';
echo 'MO';
break;
case 'Montana';
echo 'MT';
break;
case 'Nebraska';
echo 'NE';
break;
case 'Nevada';
echo 'NV';
break;
case 'New Hampshire';
echo 'NH';
break;
case 'New Jersey';
echo 'NJ';
break;
case 'New Mexico';
echo 'NM';
break;
case 'New York';
echo 'NY';
break;
case 'North Carolina';
echo 'NC';
break;
case 'North Dakota';
echo 'ND';
break;
case 'Ohio';
echo 'OH';
break;
case 'Oklahoma';
echo 'OK';
break;
case 'Oregon';
echo 'OR';
break;
case 'Pennsylvania';
echo 'PA';
break;
case 'Rhode Island';
echo 'RI';
break;
case 'South Carolina';
echo 'SC';
break;
case 'South Dakota';
echo 'SD';
break;
case 'Tennessee';
echo 'TN';
break;
case 'Texas';
echo 'TX';
break;
case 'Utah';
echo 'UT';
break;
case 'Vermont';
echo 'VT';
break;
case 'Virginia';
echo 'VA';
break;
case 'Washington';
echo 'WA';
break;
case 'West Virginia';
echo 'WV';
break;
case 'Wisconsin';
echo 'WI';
break;
case 'Wyoming';
echo 'WY';
break;
default:
return;
}

Get File Extension

substr($fileName, strrpos($fileName, '.') + 1);

//This function will return the extension of a file.  I have used this to retrieve the extensions of uploaded filenames in a MySQL in order to display an icon appropriate for the file type.

function get_file_extension($fileName) {

$extension = substr($fileName, strrpos($fileName, '.') + 1);
return $extension;

}

//example...

require "path/to/database/connection/";

$sql = mysql_query("SELECT * FROM uploaded_files ") or die("SELECT Error: ".mysql_error());

while ($row = mysql_fetch_array($sql)) {

$fileExtension = get_file_extension($row['fileName'];

if ($fileExtension == 'pdf') {
echo '<img src="/path/to/pdf/icon">' ;
} elseif ($fileExtension == 'jpg') {
echo '<img src="/path/to/jpg/icon">' ;
}

}

Buddypress signup form hook

<?php
function bph_field_value() {
echo get_bph_field_value();
}
function get_bph_field_value() {
return apply_filters( 'get_bph_field_value', $_POST['bph_field'] );
}

function bph_check_validation(){
global $bp;
$bph_field_txt = $_POST['bph_field'];

if (empty($bph_field_txt) || $bph_field_txt == '') {
$bp->signup->errors['bph_field'] = __('This is a required field','buddypress');
}
return;
}

function bph_show_input_field(){?>
<div style="float:right;width:268px;margin-right:4px;" class="bph_field_container">
<label>Input Field Name</label>
<?php do_action( 'bp_bph_field_errors' ) ?>
<input type="text" name="bph_field" id="bph_field" value="<?php bph_field_value() ?>" /><br />

</div><?php
}

add_action('bp_signup_validate', 'bph_check_validation');
add_action('bp_before_registration_submit_buttons', 'bph_show_input_field');
?>

Function Reference

<?php
/*
Functions from bp-core-templatetags.php
This code is in <?php ?> tags only for syntax coloring, dont run this file
*/

bp_core_members_template( $type, $page_number, $per_page, $max, $user_id, $search_terms, $include, $populate_extras )
//Loop functions
has_members()
next_member()
rewind_members()
members()
the_member()
bp_rewind_members()
bp_has_members( $args = '' )
'type' => $type,
'page' => $page,
'per_page' => 20,
'max' => false,
'include' => false, // Pass a user_id or comma separated list of user_ids to only show these users
'user_id' => $user_id, // Pass a user_id to only show friends of this user
'search_terms' => $search_terms, // Pass search_terms to filter users by their profile data
'populate_extras' => true // Fetch usermeta? Friend count, last active etc.

bp_the_member()
bp_members()
//Misc
bp_members_pagination_count()
bp_members_pagination_links()
bp_member_user_id()
bp_get_member_user_id()
bp_member_user_nicename()
bp_get_member_user_nicename()
bp_member_user_login()
bp_get_member_user_login()
bp_member_user_email()
bp_get_member_user_email()
bp_member_is_loggedin_user()
bp_member_avatar( $args = '' )
bp_get_member_avatar( $args = '' )
'type' => 'thumb',
'width' => false,
'height' => false,
'class' => 'avatar',
'id' => false,
'alt' => __( 'Member avatar', 'buddypress' )

bp_member_permalink()
bp_member_link()
bp_get_member_link()
bp_member_name()
bp_get_member_name()
bp_member_last_active()
bp_get_member_last_active()
bp_member_latest_update( $args = '' )
bp_get_member_latest_update( $args = '' ) {
'length' => 15

bp_member_profile_data( $args = '' )
'field' => false, // Field name
bp_member_registered()
bp_get_member_registered()
bp_member_add_friend_button()
bp_add_friend_button( $members_template->member->id, $friend_status )
bp_member_total_friend_count()
bp_get_member_total_friend_count()
bp_member_random_profile_data()
bp_member_hidden_fields()
bp_directory_members_search_form()
bp_total_site_member_count()
bp_get_total_site_member_count()
//Check bp-core-templatetags.php for comments about nav tags
bp_get_loggedin_user_nav()
bp_get_displayed_user_nav()
bp_get_options_nav()
bp_get_options_title()
//Avatar Tags
bp_has_options_avatar()
bp_get_options_avatar()
bp_comment_author_avatar()
bp_post_author_avatar()
bp_loggedin_user_avatar( $args = '' )
bp_get_loggedin_user_avatar( $args = '' ) {
'type'=> 'thumb',
'width'=> false,
'height'=> false,
'html'=> true

bp_displayed_user_avatar( $args = '' )
bp_get_displayed_user_avatar( $args = '' )
'type'=> 'thumb',
'width'=> false,
'height'=> false,
'html'=> true

bp_avatar_admin_step()
bp_get_avatar_admin_step()
bp_avatar_to_crop()
bp_get_avatar_to_crop()
bp_avatar_to_crop_src()
bp_get_avatar_to_crop_src()
bp_avatar_cropper()
//Other
bp_site_name()
bp_core_get_wp_profile()
bp_get_profile_header()
bp_exists( $component_name )
bp_format_time( $time, $just_date = false )
bp_word_or_name( $youtext, $nametext, $capitalize = true, $echo = true )
bp_your_or_their( $capitalize = true, $echo = true )
bp_get_plugin_sidebar()
bp_page_title()
bp_get_page_title()
bp_styles()
bp_has_custom_signup_page()
bp_signup_page()
bp_get_signup_page()
bp_has_custom_activation_page()
bp_activation_page()
bp_get_activation_page()
bp_search_form_enabled()
bp_search_form_action()
bp_search_form_type_select()
bp_search_form()
bp_log_out_link()
bp_custom_profile_boxes()
bp_custom_profile_sidebar_boxes()
bp_create_excerpt( $text, $excerpt_length = 55, $filter_shortcodes = true )
bp_is_serialized( $data )
bp_total_member_count()
bp_get_total_member_count()
bp_signup_username_value()
bp_get_signup_username_value()
bp_signup_email_value()
bp_get_signup_email_value()
bp_signup_with_blog_value()
bp_get_signup_with_blog_value()
bp_signup_blog_url_value()
bp_get_signup_blog_url_value()
bp_signup_blog_title_value()
bp_get_signup_blog_title_value()
bp_signup_blog_privacy_value()
bp_get_signup_blog_privacy_value()
bp_signup_avatar_dir_value()
bp_get_signup_avatar_dir_value()
bp_current_signup_step()
bp_get_current_signup_step()
bp_signup_avatar( $args = '' )
bp_get_signup_avatar( $args = '' ) {
'size' => BP_AVATAR_FULL_WIDTH,
'class' => 'avatar',
'alt' => __( 'Your Avatar', 'buddypress' )
bp_signup_allowed()
bp_get_signup_allowed()
bp_blog_signup_allowed()
bp_get_blog_signup_allowed()
bp_account_was_activated()
bp_registration_needs_activation()
bp_mentioned_user_display_name( $user_id_or_username )
bp_get_mentioned_user_display_name( $user_id_or_username )
bp_get_option( $option_name )
bp_ajax_querystring( $object = false )
bp_last_activity( $user_id = false, $echo = true )
bp_user_has_access()
bp_user_firstname()
bp_get_user_firstname()
bp_loggedin_user_link()
bp_get_loggedin_user_link()
bp_loggedinuser_link()
bp_displayed_user_link()
bp_get_displayed_user_link()
bp_user_link()
bp_displayed_user_id()
bp_current_user_id()
bp_loggedin_user_id()
bp_displayed_user_domain()
bp_loggedin_user_domain()
bp_displayed_user_fullname()
bp_get_displayed_user_fullname()
bp_user_fullname() { echo bp_get_displayed_user_fullname()
bp_loggedin_user_fullname()
bp_get_loggedin_user_fullname()
bp_displayed_user_username()
bp_get_displayed_user_username()
bp_loggedin_user_username()
bp_get_loggedin_user_username()
bp_current_component()
bp_current_action()
bp_current_item()
bp_action_variables()
bp_root_domain()
bp_get_root_domain()
//Conditionals
bp_is_blog_page()
bp_is_my_profile()
bp_is_home()
bp_is_front_page()
bp_is_activity_front_page()
bp_is_directory()
bp_is_page($page)
bp_is_active( $component )
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()
bp_the_body_class()
bp_get_the_body_class( $wp_classes, $custom_classes = false )
?>

TinyMce no p tag

// TinyMCE init settings
$initArray = array (
'mode' => 'specific_textareas',
'editor_selector' => 'theEditor',
'width' => '100%',
'theme' => 'advanced',
'skin' => 'wp_theme',
'theme_advanced_buttons1' => $mce_buttons,
'theme_advanced_buttons2' => $mce_buttons_2,
'theme_advanced_buttons3' => $mce_buttons_3,
'theme_advanced_buttons4' => $mce_buttons_4,
'language' => $mce_locale,
'spellchecker_languages' => $mce_spellchecker_languages,
'theme_advanced_toolbar_location' => 'top',
'theme_advanced_toolbar_align' => 'left',
'theme_advanced_statusbar_location' => 'bottom',
'theme_advanced_resizing' => true,
'theme_advanced_resize_horizontal' => false,
'dialog_type' => 'modal',
'relative_urls' => false,
'remove_script_host' => false,
'convert_urls' => false,
'apply_source_formatting' => false,
'remove_linebreaks' => true,
'gecko_spellcheck' => true,
'entities' => '38,amp,60,lt,62,gt',
'accessibility_focus' => true,
'tabfocus_elements' => 'major-publishing-actions',
'media_strict' => false,
'paste_remove_styles' => true,
'paste_remove_spans' => true,
'paste_strip_class_attributes' => 'all',
'wpeditimage_disable_captions' => $no_captions,
'plugins' => $plugins,
'force_p_newlines' => false
);