Skip to content

Instantly share code, notes, and snippets.

@iandunn
iandunn / activate-camptix-core-module
Created May 30, 2014 21:46
Activate CampTix core module
<?php
// In an mu-plugin...
function activate_default_camptix_module( $modules ) {
global $camptix;
$modules[] = $camptix->get_default_addon_path( 'require-login.php' );
return $modules;
}
@iandunn
iandunn / IDDescribeVar
Created April 22, 2014 04:33
This was in a repo, but moving to a Gist and deleting the repo because it's no longer useful.
<?php
/*
* Outputs the type, length and contents of a variable in a readable format, which can be useful for debugging.
* Output can be sent to echo(), die() / wp_die(), returned, a WordPress transient or a WordPress admin notice
* (via the IDAdminNotice class, not included). There are extra output methods for use in a WordPress environment,
* but it will also work on it's own.
*/
/*
@iandunn
iandunn / programmatic_login.php
Last active March 7, 2023 18:18
Programmatically log in a WordPress user
/**
* Programmatically logs a user in
*
* @param string $username
* @return bool True if the login was successful; false if it wasn't
*/
function programmatic_login( $username ) {
if ( is_user_logged_in() ) {
wp_logout();