Example #1
0
function add_note_sidebar($lead, $form)
{
    global $current_user;
    $user_data = get_userdata($current_user->ID);
    $project_name = $lead['151'];
    $email_to = $_POST['gentry_email_notes_to_sidebar'];
    $email_note_info = '';
    //emailing notes if configured
    if (!empty($email_to)) {
        GFCommon::log_debug('GFEntryDetail::lead_detail_page(): Preparing to email entry notes.');
        $email_to = $_POST['gentry_email_notes_to_sidebar'];
        $email_from = $current_user->user_email;
        $email_subject = stripslashes('Response Required Maker Application: ' . $lead['id'] . ' ' . $project_name);
        $entry_url = get_bloginfo('wpurl') . '/wp-admin/admin.php?page=mf_entries&view=mfentry&id=' . $form['id'] . '&lid=' . rgar($lead, 'id');
        $body = stripslashes($_POST['new_note_sidebar']) . '<br /><br />Please reply in entry:<a href="' . $entry_url . '">' . $entry_url . '</a>';
        $headers = "From: \"{$email_from}\" <{$email_from}> \r\n";
        //Enable HTML Email Formatting in the body
        add_filter('wp_mail_content_type', 'wpse27856_set_content_type');
        $result = wp_mail($email_to, $email_subject, $body, $headers);
        //Remove HTML Email Formatting
        remove_filter('wp_mail_content_type', 'wpse27856_set_content_type');
        $email_note_info = '<br /><br />:SENT TO:[' . implode(",", $email_to) . ']';
    }
    mf_add_note($lead['id'], nl2br(stripslashes($_POST['new_note_sidebar'] . $email_note_info)));
}
Example #2
0
function makerDeleteEntry()
{
    $entryID = isset($_POST['delete_entry_id']) ? $_POST['delete_entry_id'] : 0;
    if ($entryID != 0) {
        //get entry data and form data
        $lead = GFAPI::get_entry(esc_attr($entryID));
        $form = GFAPI::get_form($lead['form_id']);
        $trashed = GFAPI::update_entry_property($entryID, 'status', 'trash');
        new GravityView_Cache();
        if (!$trashed) {
            echo new WP_Error('trash_entry_failed', __('Moving the entry to the trash failed.', 'gravityview'));
        }
        //Make a note of the delete
        mf_add_note($entryID, "The Exhibit has been deleted by the maker.");
        //Handle notifications for acceptance
        $notifications_to_send = GFCommon::get_notifications_to_send('maker_delete_exhibit', $form, $lead);
        foreach ($notifications_to_send as $notification) {
            if ($notification['isActive']) {
                GFCommon::send_notification($notification, $form, $lead);
            }
        }
        echo $lead['151'] . ', Exhibit ID ' . $entryID . ' has been deleted';
    } else {
        echo 'Error in deleting this entry.';
    }
    exit;
}