Skip to content

Instantly share code, notes, and snippets.

@andrewroberts
andrewroberts / createPDF.gs
Last active March 3, 2025 05:59
Google Apps Script that merges the values from a Google Spreadsheet into a Google Doc template (does a mail merge) to create a GDoc or PDF. More details can be found at www.andrewroberts.net/2014/10/google-apps-script-create-pdf/. Go to https://tinyurl.com/yd8v2do2 if you would like me to set it up for you.
//
// Create a PDF by merging values from a Google spreadsheet into a Google Doc
// ==========================================================================
//
// Demo GSheet & script - http://bit.ly/createPDF
// Demo GDoc template - 1QnWfeGrZ-86zY_Z7gPwbLoEx-m9YreFb7fc9XPWkwDw
//
// Config
// ======
@renventura
renventura / block-admin-login-memberpress-login-form.php
Last active February 28, 2017 22:24
Prevent Administrative Admin Login from the MemberPress Login Form
<?php //* mind this opening php tag
/**
* Snippet provided by MemberPress support and modified by Ren Ventura
**/
//* Kick admins out from MemberPress login form
add_filter( 'mepr-validate-login', 'kick_out_admins' );
function kick_out_admins( $errors ) {
@fikrirasyid
fikrirasyid / removing-all-actions-from-hook
Created August 28, 2014 15:38
Removing All Actions From Hook
/**
* Unhook all action with some exception on wp_head and wp_footer
*/
function fr_unhook_wp_head_footer(){
global $wp_filter; // Where all the hooks and their actions are stored
// Actions that should not be removed from the wp_head hook
$wp_head_whitelist = array( 'wp_enqueue_scripts', 'wp_print_styles', 'wp_print_head_scripts' );
// Unhook actions from wp_head
@Zodiac1978
Zodiac1978 / .htaccess
Last active June 23, 2024 17:39
Safer WordPress with these .htaccess additions
# Don't show errors which contain full path diclosure (FPD)
# Use that line only if PHP is installed as a module and not per CGI
# try using a php.ini in that case.
# Change mod_php5.c to mod_php7.c if you are running PHP7
<IfModule mod_php5.c>
php_flag display_errors Off
</IfModule>
# Don't list directories
<IfModule mod_autoindex.c>
@wpmark
wpmark / editors-widget-menus.php
Created May 3, 2014 13:49
Allow WordPress Editors Access to Widgets and Menus
<?php
/***************************************************************
* Function pxlcore_give_edit_theme_options()
* Adds widgets and menus to editors.
***************************************************************/
function pxlcore_give_edit_theme_options( $caps ) {
/* check if the user has the edit_pages capability */
if( ! empty( $caps[ 'edit_pages' ] ) ) {
@nickdavis
nickdavis / column-opening-div-class-examples.html
Created April 23, 2014 14:40
HTML Columns Opening Div Class examples for LeanThemes.co
<!-- For the first column you must include 'first' -->
<div class="pricing-column one-half first">
<div class="pricing-column one-third first">
<div class="pricing-column one-fourth first">
<!-- For later columns do not include 'first' -->
<div class="pricing-column one-half">
<div class="pricing-column one-third">
<div class="pricing-column one-fourth">
<?php
/**
* Portfolio Archive
*
*/
/**
* Display as Columns
*
*/
@WebEndevSnippets
WebEndevSnippets / functions.php
Created March 3, 2014 19:50
Gravity Forms: Auto login to site after GF User Registration Form Submittal
add_action( 'gform_user_registered','we_autologin_gfregistration', 10, 4 );
/**
* Auto login to site after GF User Registration Form Submittal
*
*/
function we_autologin_gfregistration( $user_id, $config, $entry, $password ) {
wp_set_auth_cookie( $user_id, false, '' );
}
@supercleanse
supercleanse / mp_custom_account_nav.php
Created January 28, 2014 03:30
Add custom tabs to the MemberPress Account Page
<?php
add_action('mepr_account_nav', 'custom_account_nav', 10, 1);
function custom_account_nav($user) {
$mepr_options = MeprOptions::fetch();
$whaa_url = $mepr_options->account_page_url('action=whaa');
?>
<span class="mepr-nav-item custom-whaa">
<a href="<?php echo $whaa_url; ?>" id="mepr-account-whaa"><?php _e('Whaa', 'memberpress'); ?></a>
</span>
@supercleanse
supercleanse / auto_enroll.php
Last active October 11, 2022 04:14
Automatically create a lifetime transaction for a specific product each time a user registers.
<?php
if(is_plugin_active('memberpress/memberpress.php')) {
add_action( 'user_register', 'mp_auto_enroll' );
//add_action( 'gform_user_registered', 'mp_auto_enroll', 10, 4 );
function mp_auto_enroll($user_id, $user_config=array(), $entry='', $user_pass='') {
$txn = new MeprTransaction();
$txn->user_id = $user_id;