Skip to content

Instantly share code, notes, and snippets.

<?php
class StophaMultipleAuthentication
{
// declare your active directory domain here
CONST domain = 'your domain';
/**
* Class Construct
*
@NateJacobs
NateJacobs / gist:1257325
Created October 2, 2011 10:31
Check for city email during registration
<?php
/**
* Check for City Email
*
* If a user tries to register with a city email address an error is returned.
*
* @author Nate Jacobs
* @link http://gist.github.com/1257325
*/
add_action( 'registration_errors', 'check_user_email',10, 3 );
@NateJacobs
NateJacobs / gist:1258547
Created October 3, 2011 06:18
Get each users's most recent post as determined by post date. Disable the user's access if his/her last post is more than a certainnumber of days older than the current date. Must be used in conjunction with the User Access Expiration Plugin. http://wordp
<?php
/**
* Last Post by Author
*
* Must be used in conjunction with the User Access Expiration Plugin
* http://wordpress.org/extend/plugins/user-access-expiration/
*
* Get each users's most recent post as determined by post date.
* Disable the user's access if his/her last post is more than a certain
@NateJacobs
NateJacobs / gist:1263835
Created October 5, 2011 07:08
Using get_posts to return an object of posts. Question asked here http://wordpress.org/support/topic/how-to-call-query_posts-from-functionsphp
<?php
/* This part goes in your functions.php */
/**
* Get Some Posts
*
* Use get_posts to get an array of posts matching a set of criteria.
* The category_name is passed to the function.
* get_posts uses the same parameters as WP_query. See the Codex for the full details..
* http://codex.wordpress.org/Template_Tags/get_posts
@NateJacobs
NateJacobs / gist:1286583
Created October 14, 2011 08:40
WordPress Function: Every time a user updates his/her profile an email is sent to the site administrator.
<?php
/**
* Updated User Profile Notification
*
* Every time a user updates his/her profile an email is sent
* to the site administrator.
*
* @author Nate Jacobs
* @link https://gist.github.com/1286583
*/
@NateJacobs
NateJacobs / send-post-by-email.php
Created October 23, 2011 00:54
WordPress Plugin: Pick the specific users to send an email to notifying them about a new post.
<?php
/*
Plugin Name: Specific User Notification
Plugin URI: https://gist.github.com/1306710
Description: Pick the specific users to send an email to notifying them about a new post.
Version: 0.2
Author: Nate Jacobs
Author URI: http://natejacobs.org
License: GPLv2 or later
@NateJacobs
NateJacobs / gist:1321741
Created October 28, 2011 06:17
WordPress Function: List all authors of a blog grouped by first name with a single letter as a header character.
<?php
/**
* List Users Alphabetically
*
* Create a list of all authors of a WordPress blog.
* Names are grouped by first name with a single letter
* as a header character.
*
* Call the function with <?php ngtj_list_users_alphabetically(); ?>
* where you want the list to appear.
@NateJacobs
NateJacobs / cb-flickr-widget.php
Created September 20, 2012 15:44
Cactus Brick Flickr Widget
<?php
/*
Plugin Name: Cactus Brick Flickr Widget
Plugin URI: http://cactusbrick.org
Description: Grab photos from Flickr
Version: 1.0
Author: Nate Jacobs
Author URI: http://natejacobs.org
License: GPLv2 or later
*/
@NateJacobs
NateJacobs / registration-redirect.php
Last active December 11, 2015 04:28
Hide all register links and redirect to custom register link. For use with TNG User Meta version 1.X. https://github.com/HeatherFeuer/tng_user_meta
<?php
/**
* Hide Default Registration
*
* This is for use with the TNG User Meta plugin: https://github.com/HeatherFeuer/tng_user_meta
* Function 1 will redirect the user to the custom registration page when they visit /wp-login.php?action=register
* Function 2 will hide all the links to the default register page. Even if the user does get there they will be redirected.
*
* @author Nate Jacobs
@NateJacobs
NateJacobs / gist:e75a693c388da7472ee9
Created August 2, 2014 19:54
Dump out the SQL requests made on each page for the post.
add_filter( 'posts_request', function($input){
var_dump($input);
return $input;
});