<?php if (bp_is_current_action('new-dedication')) { ?>
    <div id="sidebar" class="new-dedication">
<?php } else if (bp_is_current_action('dedication-profile')) { ?> 
    <div id="sidebar" class="dedication-profile">
<?php } else { ?>
    <div id="sidebar">
<?php } ?>

    <?php if (function_exists('bp_message_get_notices')) { ?>
        <?php bp_message_get_notices(); ?>
    <?php } ?>
    <?php if (bp_is_current_action('new-dedication')) { ?>
        <?php dynamic_sidebar('new-dedication'); ?>		
    <?php } ?>
    <?php if (bp_is_current_action('dedication-profile')) { ?>        
        <?php dynamic_sidebar('dedication-profile'); ?>		        
    <?php } else { ?>
        <?php dynamic_sidebar('buddypress'); ?>
    <?php } ?>

</div>	