function rcl_remove_feed_author($author_id)
{
    global $user_ID, $wpdb;
    $feed_id = rcl_get_feed_author_current_user($author_id);
    return rcl_remove_feed($feed_id);
}
Example #2
0
function rcl_update_feed_current_user($author_id)
{
    global $user_ID;
    $ignored_id = rcl_is_ignored_feed_author($author_id);
    if ($ignored_id) {
        $args = array('feed_id' => $ignored_id, 'user_id' => $user_ID, 'object_id' => $author_id, 'feed_type' => 'author', 'feed_status' => 1);
        $result = rcl_update_feed_data($args);
        if ($result) {
            $data['success'] = __('Signed up for a subscription', 'wp-recall');
            $data['this'] = __('Unsubscribe', 'wp-recall');
        } else {
            $data['error'] = __('Error', 'wp-recall');
        }
    } else {
        $feed = rcl_get_feed_author_current_user($author_id);
        if ($feed) {
            $result = rcl_remove_feed_author($author_id);
            if ($result) {
                $data['success'] = __('Subscription has been dropped', 'wp-recall');
                $data['this'] = __('Subscribe', 'wp-recall');
            } else {
                $data['error'] = __('Error', 'wp-recall');
            }
        } else {
            $result = rcl_add_feed_author($author_id);
            if ($result) {
                $data['success'] = __('Signed up for a subscription', 'wp-recall');
                $data['this'] = __('Unsubscribe', 'wp-recall');
            } else {
                $data['error'] = __('Error', 'wp-recall');
            }
        }
    }
    $data['return'] = 'notice';
    return $data;
}