Skip to content

Instantly share code, notes, and snippets.

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
/**
* mm_register function.
* Register a new user.
* @access public
* @return User errors or user is logged in.
*/
function mm_register() {
if(!is_user_logged_in()) {
if(!empty($_POST)) {
/**
* mm_sign_in function.
* Sign the user in
* @access public
* @return User errors or true if successful signon
*/
function mm_sign_in() {
if(!is_user_logged_in()) {
if(!empty($_POST)) {
// verify nonce
<?php
/*
Plugin Name: Custom Login Error
Plugin URI: http://www.thoughtrefinery.com/
Description: Customize error messages on login form
Version: 0.1
Author: Nick Ciske | Thought Refinery
Author URI: http://www.thoughtrefinery.com/
*/
<?php
global $user_identity;
//$user_submissions = get_posts();
if ($user = wp_get_current_user()) {
$author = array('id' => $user->ID);
} else {
$commenter = wp_get_current_commenter();
$author = array(
'author' => $commenter['comment_author'],
function wp_welcome_panel() {
global $wp_version;
if ( ! current_user_can( 'edit_theme_options' ) )
return;
$classes = 'welcome-panel';
$option = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
// 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
@fritids
fritids / gist:6435705
Created September 4, 2013 11:19
how to keep checkbox checked after click preview button
<?php
if (isset($_POST['day']))
{
foreach ($_POST['day'] as $selectedDay)
$selected[$selectedDay] = "checked";
}
?>
<form action="" method="post">
<input type="checkbox" name="day[]" <?php echo $selected['monday'] ?> value="monday" />monday<br />
<?php
// Force update our username (user_login)
global $wpdb;
$tablename = $wpdb->prefix . "users";
// method 1
//$sql = $wpdb->prepare("UPDATE %s SET user_login=%s WHERE ID=%d", $tablename, $user_email, $user_id);
//$wpdb->query($sql);
<?php
// Force update our username (user_login)
global $wpdb;
$tablename = $wpdb->prefix . "users";
// method 1
//$sql = $wpdb->prepare("UPDATE %s SET user_login=%s WHERE ID=%d", $tablename, $user_email, $user_id);
//$wpdb->query($sql);
<?php
register_activation_hook( __FILE__, 'add_last_activity_for_all_users' );
function add_last_activity_for_all_users() {
global $wpdb;
$sql = $wpdb->prepare( "
SELECT
u.ID
FROM
$wpdb->users AS u