• I wrote a plugin this weekend (my first), not because I needed it, but because as I was working on some documentation it looked like it would be fairly easy to convert what I was doing via cron on the server into a plugin.

    If anyone would be willing to pick it over, I would sure appreciate it. I’d like to know if it meets best practices. I’ve read through the codex, but would appreciate any feedback before it goes out.

    It is called ‘Delete Spam Daily’. It deletes all comments marked ‘spam’ using wp_cron. There are a couple buttons to activate and deactivate. Fairly low tech, but it was exciting to work through it.

    And I’m aware the need for this is low; its a minor maintenance that I run on the server to keep my databases small, but I figured those without shell access or knowledge of cron may have an interest; and it was a good learning opportunity for me. ??

    Details here: https://brockangelo.com/wordpress/plugins/delete-spam-daily/

Viewing 7 replies - 1 through 7 (of 7 total)
  • In the “dsd_options” function, change:

    $valid_nonce = wp_verify_nonce($_REQUEST['_wpnonce'],'delete_spam_daily');
    	if ( $valid_nonce ) {
    		if(isset($_REQUEST['delete_spam_now_button'])) {
    			delete_spam_now();
    		}
    	}
    
    	$valid_nonce = wp_verify_nonce($_REQUEST['_wpnonce'],'delete_spam_daily');
    	if ( $valid_nonce ) {
    		if(isset($_REQUEST['delete_spam_daily_button'])) {
    			dsd_start_schedule();
    		}
    	}
    
    	$valid_nonce = wp_verify_nonce($_REQUEST['_wpnonce'],'delete_spam_daily');
    	if ( $valid_nonce ) {
    		if(isset($_REQUEST['stop_deleting_spam_button'])) {
    			dsd_stop_schedule();
    		}
    	}

    to:

    $valid_nonce = wp_verify_nonce($_REQUEST['_wpnonce'],'delete_spam_daily');
    	if ( $valid_nonce ) {
    		if(isset($_REQUEST['delete_spam_now_button'])) {
    			delete_spam_now();
    		}
    		if(isset($_REQUEST['delete_spam_daily_button'])) {
    			dsd_start_schedule();
    		}
    		if(isset($_REQUEST['stop_deleting_spam_button'])) {
    			dsd_stop_schedule();
    		}
    	}

    no point asking several times the same question (plus the function call).

    Thread Starter brockangelo

    (@brockangelo)

    Thank you riledhel!

    That is very helpful. Nonces are a new thing to me, so I didn’t want to mess with it. This makes much more sense.

    wow! i’m only a user who could not export one of his blogs because of the size of the spam cache. but with this plugin i’ve just done it. thanks! ??

    Thread Starter brockangelo

    (@brockangelo)

    thanks tsabeeka!

    Your plugin looks really good, but does it work with SpamTask as well? Need to know before I install it. ??

    Thread Starter brockangelo

    (@brockangelo)

    I haven’t tested it myself, but I don’t see why it wouldn’t. SpamTask appears to block spam from coming in. DSD simply deletes what is in the Spam Queue each day.

    Thanks. It works nicely. SpamTask and your plugin makes a pretty comfortable setting for me. ??

    A little feature request though, for your plugin: To add more settings. Like instead of “Delete all spam each day”, maybe add the option of deleting spam which is more than one day, week and month old. Some people like to keep track of the spam (yeah, I’d be one of them) and check the latest of it. ?? However I don’t want to see the spam that’s more than a week old.

    Again, thanks. I really like the plugin.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘First Plugin – review requested’ is closed to new replies.