Skip to content

Instantly share code, notes, and snippets.

/**
* Immediately bans IPs that attempt to log in with specific forbidden usernames.
*
* This function hooks into the 'authenticate' filter to run before iThemes Security,
* checks against a custom list of usernames, and uses the iThemes Security API
* to execute the lockout.
*
* @param WP_User|WP_Error|null $user User object or error.
* @param string $username The username being attempted.
* @return WP_User|WP_Error|null
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<script>
function onLoad() {
google.script.run.withSuccessHandler(showProgress).getProgressPercentage();
google.script.run.withSuccessHandler(showTotal).getRunningTotal();
google.script.run.withSuccessHandler(showProjEnd).getProjectedYearEnd();
}
function doGet() {
return HtmlService.createHtmlOutputFromFile('Index');
}
function logDips(dips) {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const lastRow = sheet.getLastRow();
const currentDate = new Date();
// Insert new row with the date and dips
<?php
function hide_some_donor_dashboard_stuff() {
wp_add_inline_style(
/**
* Below, use give-sequoia-template-css to style the multi-step donation form
* or use to style the donor dashboard
*/
'give-styles',
'
@Benunc
Benunc / donor_count.php
Created July 1, 2020 14:12
VERY experimental shortcode for outputting the donor counts for a form. Outputs " A HUGE thanks to our ____ donors this year" if donors are found.
<?php
function my_donor_count_shortcode( $atts ) {
// Defaults
$atts = shortcode_atts( array(
'form_id' => false,
), $atts, 'donor_count' );
$number = give_get_form_donor_count( $atts['form_id'] );
@Benunc
Benunc / donor_count.php
Created July 1, 2020 14:11
VERY experimental shortcode for outputting the donor counts for a form. Outputs " A HUGE thanks to our ____ donors this year
<?php
function my_donor_count_shortcode( $atts ) {
// Defaults
$atts = shortcode_atts( array(
'form_id' => false,
), $atts, 'donor_count' );
$number = give_get_form_donor_count( $atts['form_id'] );
<?php
function my_give_german_text_switcher( $translations, $text, $domain ) {
if ( $domain == 'give' && $text == '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> raised' ) {
$translations = __( '<span class="income">%1$s</span> von <span class="goal-text">%2$s</span> erreicht', 'give' );
}
return $translations;
}
add_filter( 'gettext', 'my_give_german_text_switcher', 10, 3 );
@Benunc
Benunc / bctt_dequeue_styles_five_oh.php
Last active July 6, 2018 20:51
Removes the css completely for version 5.0 and up of Better Click To Tweet.
<?php
/*
* ALERT: THIS FUNCTION ONLY WORKS ON VERSION 5.0+ OF BETTER CLICK TO TWEET
*
* This function sets an option in your WordPress Options table (default wp_options), so adding this function
* and refreshing the page even one time will disable the Better Click To Tweet Stylesheet until the option is removed.
*
* Note that uninstalling the core Better Click To Tweet plugin from the dashboard will remove the option automatically.
*
* To remove the option (and thus re-register and enqueue the defaultCSS) without deleting the core plugin,
[bctt tweet="Here's an emoji rocket: \xF0\x9F\x9A\x80"]
find the emoji you are looking for here: http://apps.timwhitlock.info/emoji/tables/unicode
<?php
/*
* This snippet prevents Better Click To Tweet from enqueuing any styles at all.
* This is handy for folks who want styles to all live in their theme.
*
* This snippet is recommended to be used in a must-use plugin.
*
*/
function bctt_so_quiet_in_here () {