<?php
/*
Plugin Name: BP Dedication
Plugin URI: 
Description: 
Version: 1.0
Author: 
Author URI: 
*/
define( 'BP_DEDICATION_VER', 	'1.0' );
define( 'BP_DEDICATION_DB_VER', 	'1.0' );
define( 'BP_DEDICATION_PLUGIN_DIR', dirname( __FILE__ ) );

if ( !defined( 'BP_DEDICATION_SLUG' ) )
	define( 'BP_DEDICATION_SLUG', 'dedications' );

if ( !defined( 'DEDICATION_CATEGORY_SLUG' ) )
    define( 'DEDICATION_CATEGORY_SLUG', 'dedication' );


register_activation_hook( __FILE__, 'bp_dedication_activation' );

/* Only load the BuddyPress plugin functions if BuddyPress is loaded and initialized. */
function bp_dedication_init() {
	
	require( dirname( __FILE__ ) . '/functions.php' );
	
	if ( function_exists( 'bp_is_active' ) ) {
            require( dirname( __FILE__ ) . '/dedication.php' );
	}

	/*require( dirname( __FILE__ ) . '/by-email/by-email.php' );*/

	/*if ( is_admin() )
		require( dirname( __FILE__ ) . '/admin/admin-panel.php' );*/
}
add_action( 'bp_include', 'bp_dedication_init' );

function bp_dedication_locale_init () {
    $plugin_dir = basename(dirname(__FILE__));
    $locale = get_locale();
    $mofile = plugins_url("languages/bp-dedication-$locale.mo",__FILE__);

    if ( file_exists( $mofile ) )
            load_textdomain( 'bp-dedication', $mofile );
}
add_action ('plugins_loaded', 'bp_dedication_locale_init');

function bp_dedication_activation() {
	if ( !$iaoptions = get_option( 'bp_dedication' ) )
		$iaoptions = array();

	/*if ( !$iaoptions['max_invites'] )
		$iaoptions['max_invites'] = 5;

	if ( !$iaoptions['allow_email_invitations'] )
		$iaoptions['allow_email_invitations'] = 'all';

	if ( !$iaoptions['message_is_customizable'] )
		$iaoptions['message_is_customizable'] = 'yes';

	if ( !$iaoptions['subject_is_customizable'] )
		$iaoptions['subject_is_customizable'] = 'no';

	if ( !$iaoptions['can_send_group_invites_email'] )
		$iaoptions['can_send_group_invites_email'] = 'yes';
	
	if ( !$iaoptions['bypass_registration_lock'] )
		$iaoptions['bypass_registration_lock'] = 'yes';*/

	$iaoptions['version'] = BP_INVITE_ANYONE_VER;

	update_option( 'bp_dedication', $iaoptions );
}

?>
