Ejemplo n.º 1
0
function bootstrap_theme_dashboard_request_to_be_contributor($account)
{
    require_once dirname(__FILE__) . '/../../privatemsg/privatemsg.module';
    $to = variable_get('site_mail');
    //drupal_mail('bootstrap_theme', 'to_become_contributor', $to, LANGUAGE_NONE, array('subject' => 'Request to Become a Contributor', 'message' => url('dashboard/become-contributor', array('absolute' => TRUE))), $account->email);
    //drupal_set_message('Thanks for your request to become contributor.');
    global $user;
    $editor = bootstrap_theme_get_editor();
    //$to = variable_get('site_mail');
    //drupal_mail('bootstrap_theme', 'to_become_contributor', $to, LANGUAGE_NONE, array('subject' => 'Request to Become a Contributor', 'message' => url('dashboard/become-contributor/'.$user->uid, array('absolute' => TRUE))), $user->email);
    //drupal_set_message('Thanks for your request.');
    $account->field_is_pending_contributor[LANGUAGE_NONE][0]['value'] = 1;
    user_save($account);
    bootstrap_theme_send_message($user, $editor, 'Request to Become a Contributor', url('user/' . $user->uid, array('absolute' => true)));
    drupal_set_message('Thanks for your request to become contributor.');
    /*$recipient = $editor;
        $recipient->recipient = $editor->uid;
        $recipient->type = 'user';
    
        $new_message = new stdClass();
        $new_message->author = $user;
        $new_message->timestamp = time();
        $new_message->recipient = $editor->name;
        $new_message->recipients = array(
            'user_'.$editor->uid => $recipient
        );
    
        $new_message->subject = 'Request to Become a Contributor';
        $new_message->body = url('user/'.$user->uid, array('absolute' => true));
    
        _privatemsg_send($new_message);*/
    $form_state['no_redirect'] = TRUE;
    $form_state['rebuild'] = TRUE;
    $form_state['programmed'] = FALSE;
    echo drupal_json_encode(array('url' => url('user/' . $account->uid . '/edit')));
    exit;
}
Ejemplo n.º 2
0
function bootstrap_theme_approve_contributor($account)
{
    global $user;
    $role = user_role_load_by_name(USER_TYPE_CONTRIBUTOR);
    $account->roles[$role->rid] = USER_TYPE_CONTRIBUTOR;
    user_save($account);
    bootstrap_theme_send_message($user, $account, 'You are now contributor.', 'You are now contributor.');
    drupal_goto('user/' . $account->uid);
}