/**
  * profile_fields_screen()
  *
  * Adds extra field to profile screen
  */
 function register_profile_fields()
 {
     //HACK: to allow options
     global $bp;
     (array) ($bp->profile->field_types[] = 'option');
     if (BPSP_Roles::field_group_id_from_name(__('Courseware', 'bpsp'))) {
         return false;
     }
     $bpsp_group_id = xprofile_insert_field_group(array(name => __('Courseware', 'bpsp'), description => __('Students and Teachers fields. Do not delete as long as you use BuddyPress ScholarPress Courseware!', 'bpsp'), can_delete => false));
     if (!$bpsp_group_id) {
         wp_die(__('BuddyPress Courseware error when saving xProfile group.', 'bpsp'));
     }
     /* Create the radio buttons */
     xprofile_insert_field(array(field_group_id => $bpsp_group_id, name => __('Role', 'bpsp'), can_delete => false, description => __('Your role when using Courseware. Every request requires moderation. Please be patient until an administrator reviews it.', 'bpsp'), is_required => false, type => 'radio'));
     $bpsp_field_id = xprofile_get_field_id_from_name(__('Role', 'bpsp'));
     if (!$bpsp_field_id) {
         wp_die(__('BuddyPress Courseware error when saving xProfile field.', 'bpsp'));
     }
     /* Create the radio options */
     xprofile_insert_field(array(field_group_id => $bpsp_group_id, parent_id => $bpsp_field_id, name => __('Teacher', 'bpsp'), can_delete => false, is_required => false, type => 'option'));
     xprofile_insert_field(array(field_group_id => $bpsp_group_id, parent_id => $bpsp_field_id, name => __('Student', 'bpsp'), can_delete => false, is_required => false, type => 'option', is_default_option => true));
     xprofile_insert_field(array(field_group_id => $bpsp_group_id, parent_id => $bpsp_field_id, name => __('Apply for Teacher', 'bpsp'), can_delete => false, is_required => false, type => 'option'));
     if (!xprofile_get_field_id_from_name(__('Teacher', 'bpsp')) || !xprofile_get_field_id_from_name(__('Student', 'bpsp')) || !xprofile_get_field_id_from_name(__('Apply for Teacher', 'bpsp'))) {
         wp_die(__('BuddyPress Courseware error when saving xProfile field options.', 'bpsp'));
     }
     return true;
 }
 /**
  * Appends course information to group header
  */
 function course_group_header()
 {
     global $bp;
     if (!$this->has_course_caps($bp->loggedin_user->id) || !BPSP_Roles::can_teach($bp->loggedin_user->id)) {
         return;
     }
     $vars['name'] = '_no_course_group_header';
     $vars['echo'] = false;
     $this->current_uri = bp_get_group_permalink($bp->groups->current_group) . $bp->courseware->slug;
     $vars['init_course_link'] = $this->current_uri . '/course/edit';
     echo BPSP_Groups::load_template($vars);
 }
 /**
  * group_dashboard( $vars )
  *
  * Hooks into screen_handler
  * Displays group dashboard
  *
  * @param Array $vars a set of variables received for this screen template
  * @return Array $vars a set of variable passed to this screen template
  */
 function group_dashboard($vars)
 {
     global $bp;
     $group_data = $this->get_group_courseware($bp->groups->current_group->id);
     $vars['grades'] = array();
     foreach ($group_data['user_grades'] as $grade) {
         if (is_numeric($grade['value'])) {
             $vars['grades'][] = $grade['value'];
         }
     }
     $vars['founder'] = $bp->groups->current_group->creator_id;
     $vars['teachers'] = BPSP_Roles::get_teachers($bp->groups->current_group->id);
     $vars['is_teacher'] = BPSP_Roles::can_teach($bp->loggedin_user->id);
     $vars['group_course'] = reset($group_data['courses']);
     $vars['bpsp_curriculum'] = get_option('bpsp_curriculum');
     $vars = array_merge($vars, $group_data);
     $vars['items_limit'] = 5;
     $vars['name'] = 'home';
     return $vars;
 }
function bpsp_activation()
{
    if (!bpsp_check()) {
        exit(1);
    }
    BPSP_Roles::register_profile_fields();
}
 function bpsp_activation()
 {
     if (!bpsp_check()) {
         exit(1);
     }
     BPSP_Roles::register_profile_fields();
     bpsp_registration();
     flush_rewrite_rules();
 }
            </li>
            <?php 
if (!empty($assignment->forum_link)) {
    ?>
                <li id="assignment-forum-link">
                    <a href="<?php 
    echo $assignment->forum_link;
    ?>
" class="action">
                        <?php 
    _e('Visit Assignment Forum', 'bpsp');
    ?>
                    </a>
                </li>
            <?php 
} elseif (isset($assignment_e_forum_permalink) && BPSP_Roles::can_teach()) {
    ?>
                <li id="assignment-enable-forum">
                    <form method="post" action="<?php 
    echo $assignment_e_forum_permalink;
    ?>
" class="standard-form" >
                        <input type="submit" value="<?php 
    _e('Enable Assignment Forum', 'bpsp');
    ?>
" />
                        <?php 
    echo $assignment_e_forum_nonce;
    ?>
                    </form>
                </li>
function bpsp_activation()
{
    BPSP_Roles::register_profile_fields();
}