<?php 
} elseif (!empty($_POST)) {
    ?>

	<H2 class="registration-title"><?php 
    echo __('Registration Complete', 'bum');
    ?>
</H2>
	<p><?php 
    echo sprintf(__("Thank you for registering with %s. Please check your email as we've sent you your login url and credentials.", 'bum'), get_bloginfo('site'));
    ?>
</p>
	
	<?php 
    bum_show_view("bum-page-login");
    ?>
	
<?php 
} else {
    ?>
	
	<?php 
    $pages = get_registration_pages();
    ?>
	<?php 
    foreach ((array) $pages as $page) {
        ?>
		<a class="registration-link-candidate" href="<?php 
        echo bum_get_permalink_registration("user_type=" . $page['role']);
        ?>
 /**
  * Callback function to show fields in meta box
  * 
  * @param unknown_type $post
  * @param unknown_type $fields
  */
 function bum_display_metafields($post, $fields)
 {
     //reasons to fail
     if (!isset($fields['args'])) {
         return false;
     }
     //initializing variables
     $meta_id = $fields['args']['id'];
     $colspan = array('show_view');
     //checking for the table creation
     $table = true;
     if (isset($fields['args']['fields'][0]['options']['table']) && $fields['args']['fields'][0]['options']['table'] === false || in_array($fields['args']['fields'][0]['type'], $colspan)) {
         $table = false;
     }
     //checking for the editing abilities
     $edit = true;
     if (isset($fields['args']['fields'][0]['options']['edit']) && $fields['args']['fields'][0]['options']['edit'] === false) {
         $edit = false;
     }
     // Use nonce for verification
     echo '<input type="hidden" name="custom_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';
     if ($table) {
         echo '<table class="form-table autogenerated-metabox">';
     }
     foreach ($fields['args']['fields'] as $field) {
         // get current post meta data
         $meta = get_post_meta($post->ID, $field['id'], true);
         $unique = md5(time());
         if ($table) {
             echo '<tr>';
             if ($field['type'] != 'custom') {
                 echo '<th style="width:30%"><label for="', $field['id'], '">', $field['name'], '</label></th><td>';
             }
         }
         if ($edit === false && $meta) {
             echo $meta;
         } else {
             switch ($field['type']) {
                 case 'show_view':
                     bum_show_view($field['id']);
                     break;
                 case 'text':
                     echo '<input ', @$field['attr'], ' type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : $field['std'], '" size="30" style="width:97%" />', "\n", $field['desc'];
                     break;
                 case 'textarea':
                     echo '<textarea ', @$field['attr'], ' name="', $field['id'], '" id="', $field['id'], '" cols="60" rows="4" style="width:97%">', $meta ? $meta : $field['std'], '</textarea>', "\n", $field['desc'];
                     break;
                 case 'select':
                     echo '<select ', @$field['attr'], ' name="', $field['id'], '" id="', $field['id'], '">';
                     foreach ($field['options'] as $option) {
                         echo '<option', $meta == $option ? ' selected="selected"' : '', '>', $option, '</option>';
                     }
                     echo '</select>';
                     break;
                 case 'radio':
                     foreach ($field['options'] as $option) {
                         echo '<input ', @$field['attr'], ' type="radio" name="', $field['id'], '" value="', $option['value'], '"', $meta == $option['value'] ? ' checked="checked"' : '', ' />', $option['name'], '<br/>';
                     }
                     break;
                 case 'checkbox':
                     echo '<input type="hidden" name="', $field['id'], '" value="" /> ';
                     echo '<input ', @$field['attr'], ' type="checkbox" name="', $field['id'], '" id="', $field['id'], '"', $meta ? ' checked="checked"' : '', ' /> ', $field['desc'];
                     break;
                 case 'editor':
                     echo '<div style="border:1px solid #DFDFDF;border-collapse: separate;border-top-left-radius: 6px 6px;border-top-right-radius: 6px 6px;">', '<textarea ', @$field['attr'], ' rows="10" class="theEditor" cols="40" name="', $field['id'], '" id="' . $unique . '"></textarea>', '</div>', '<script type="text/javascript">edCanvas = document.getElementById(\'' . $unique . '\');</script>', "\n", $field['desc'];
                     break;
                 case 'custom':
                     echo $field['std'];
                     break;
                     //displays a drop list of user roles
                 //displays a drop list of user roles
                 case 'roles':
                     global $wp_roles;
                     $meta = $meta ? $meta : @$field['default'];
                     echo '<select ', @$field['attr'], ' name="', $field['id'], '" id="', $field['id'], '">';
                     foreach ($wp_roles->roles as $slug => $roles) {
                         echo '<option', $meta == $slug ? ' selected="selected"' : '', ' value="' . $slug . '">', $roles['name'], '</option>';
                     }
                     echo '<option', $meta == 'read' ? ' selected="selected"' : '', ' value="read">Public</option>';
                     echo '</select>';
                     break;
             }
         }
         if ($table) {
             if ($field['type'] != 'custom') {
                 echo '</td>';
             }
             echo '</tr>';
         }
     }
     if ($table) {
         echo '</table>';
     }
 }
/**
 * Function is responsible for displaying the login page.
 *
 * @param unknown_type $config
 * @return unknown
 */
function bum_pages_shortcode($config)
{
    //initializing
    $defaults = array('page' => 'Login');
    $config = shortcode_atts($defaults, $config);
    $page = strtolower($config['page']);
    return bum_show_view(apply_filters('bum-page-shortcode', $page, $config));
}