Support » Plugin: SendPress Newsletters » [Plugin: SendPress] Searching and deleting subscribers

  • Resolved imarap

    (@imarap)


    Hi there,

    I would like to know if there is any way to search subscribers by name or email and delete them. Is it possible to filter results or show more than 15 contacts per page?

    I imported around 5000 contacts in a list, however only 700 were correctly uploaded for some reason. Is there a limit? Contacts will be overwritten if I upload them again or there will be duplicated? I though about deleting them all and import the list again, but that is almost 52 pages, it will take a while to delete page by page.

    Any ideas? Thank you!

    http://wordpress.org/extend/plugins/sendpress/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Josh Lyford

    (@joshl)

    Hi imarap,

    Search by email and name are coming but i am not sure exactly when and i display count as a bug to be added. In the short term i have added a remove all from lists at the bottom of the detail page.

    As for 5000 contacts it should work fine provided they are each on their own line. We are working on a new importer to make this an easier process. Contacts will not be duplicated in the system so a reimport will be fine.

    Best,
    Josh

    any news on the new imported josh?

    i have massive lists im unable to use at the moment

    please let me know

    cheers

    Plugin Author Josh Lyford

    (@joshl)

    Both of these are in the works. They should be in the next release.

    Greetings.

    I just managed to implement a email search feature, in a light and very user friendly manner, without altering the Sendpress Plugin.

    Maybe Josh can use it, if it is to his liking. It’s easy to change this code to also allow search by names.

    So here we go.

    This changes were made in a custom theme. You just need to edit your functions.php file and add a admin.js file (or use an existing one).

    your-theme-directory/functions.php

    //simple check to save cpu cycles
    if($_REQUEST['page']=='sp-subscribers' && ($_REQUEST['view']=='subscribers' || $_REQUEST['view']=='subscriber') ) {
    	add_action( 'admin_print_styles', 'my_theme_admin_print_styles' );
    	add_action( 'admin_print_scripts', 'my_theme_admin_print_scripts' );
    
    	function my_theme_admin_print_styles() {
    		//you can get css file and images at http://jqueryui.com/download/
    		wp_enqueue_style('jquery-ui-lightness', get_template_directory_uri().'/ui-lightness/jquery-ui-1.10.3.custom.min.css' );
    	}
    	function my_theme_admin_print_scripts() {
    		wp_enqueue_script('jquery-ui-autocomplete');
    		wp_enqueue_script('my-theme-admin-script', get_template_directory_uri().'/admin.js');
    	}
    }
    
    if($_REQUEST['action']=='generic_ajax') {
    	add_action('wp_ajax_generic_ajax', 'my_theme_generic_ajax');
    
    	function my_theme_generic_ajax() {
    		global $wpdb;	
    
    		if( $_GET['ajax_do'] == 'sp_subscriber_search' && strlen($_GET['term']) > 2) {
    			$sql = "SELECT t1.email AS label, t1.subscriberID AS value
    			FROM ".$wpdb->prefix."sendpress_subscribers AS t1
    			RIGHT JOIN ".$wpdb->prefix."sendpress_list_subscribers AS t2 ON (t1.subscriberID = t2.subscriberID AND t2.listID = ".(int)$_GET['listID'].")
    			WHERE t1.email LIKE '%".$wpdb->escape($_GET['term'])."%'
    			ORDER BY t1.email";
    			die(json_encode($wpdb->get_results($sql)));
    		}
    		die();
    	}
    }

    your-theme-directory/admin.js

    jQuery(document).ready(function($) { 
    
    	//if there is a hidden input for listID, it means we are on a valid search page
    	$listID = $('input[type="hidden"][name="listID"]').val();
    	if( $listID ) {
    		//add search input to subscribers pages
    		$html = '<form><input type="search" id="sp-search-by-email-input" name="s" value="" /><label> (search by email)</label></form>';
    		$('#taskbar h2').after($html);
    		$( "#sp-search-by-email-input" ).autocomplete({
          source: ajaxurl+'?action=generic_ajax&ajax_do=sp_subscriber_search',
          minLength: 3,
          select: function( event, ui ) {
    				window.location = '?page=sp-subscribers&view=subscriber&subscriberID='+ui.item.value+'&listID='+$listID;
          }
        });
    
    		//add delete button do edit subscriber page
    		if($('form#subscriber-edit').length > 0) {
    			$html = ' <a class="btn" href="?page=sp-subscribers&action=delete-subscriber&subscriberID='+$('input[name="subscriberID"]').val()+'&listID='+$('input[name="listID"]').val()+'">Delete from this List</a>';
    			$('form#subscriber-edit input[type="submit"]').after($html);
    		}
    	}
    }

    Hope you enjoy this and thank toy for this great plugin.

    Gonçalo Peres

    Plugin Author itdoug

    (@itdoug)

    Wow, really love the enthusiasm! We added search in the latest release. No idea if Josh used your code, but at the very least it inspired him. As a thank you I would be more than happy to offer you a big discount on pro if you wanted to upgrade. Drop me a line if you’re interested. Doug at sendpress dot com.

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: SendPress] Searching and deleting subscribers’ is closed to new replies.