Skip to content

Instantly share code, notes, and snippets.

View butlerblog's full-sized avatar

Chad Butler butlerblog

View GitHub Profile
@butlerblog
butlerblog / wp_login_redirect.php
Last active September 23, 2015 13:33
Create WP login link with redirect back to original page.
<?php
global $wp;
$current_url = home_url( add_query_arg( array(), $wp->request ) );
?>
<a href="<?php echo wp_login_url( $current_url ); ?>">Log In</a>
@butlerblog
butlerblog / suppress_pwd_emails.php
Last active July 2, 2018 04:40
suppress WP from sending password and email change emails
<?php
/*
* Documentation
* https://codex.wordpress.org/Plugin_API/Filter_Reference/send_password_change_email
* https://codex.wordpress.org/Plugin_API/Filter_Reference/send_email_change_email
*/
// Add below this line to functions.php
@butlerblog
butlerblog / wpmem_forgot_link.php
Last active October 28, 2016 15:02
Filters for changing the forgot password and register page links in the WP-Members login forms
@butlerblog
butlerblog / add_wrappers.php
Last active January 4, 2017 20:22
Use wpmem_securify to apply additional wrapper tags (useful with certain builder plugins)
<?php
/**
* Example of wpmem_securify filter to add div wrappers
* to filtered content if user is not logged in.
*
* http://rocketgeek.com/plugins/wp-members/docs/filter-hooks/wpmem_securify/
* https://developer.wordpress.org/reference/hooks/the_content/
*/
add_filter( 'wpmem_securify', 'my_securify_filter' );
<?php
/**
* This gist is set up to diplay the correct way to customize forms in WP-Members.
*
* It is in reference to this script file:
* https://github.com/danahutchins/wp-members-bootstrap-forms/blob/master/wp-members-pluggable.php
*
* The author of that script indicates in this post:
* http://www.inforest.com/updating-wp-members-wordpress-plugin-for-twitter-bootstrap/
* that "Rather than going to the trouble of writing hooks, I decided to simply
@butlerblog
butlerblog / wpmem_post_register_data.php
Last active January 24, 2017 13:46
Documentation Examples for _data hooks
<?php // ignore this line.
add_action( 'wpmem_post_register_data', 'my_reg_hook' );
function my_reg_hook( $fields ) {
// Example to display the contents of the array.
// Uncomment to use.
// echo "<pre>"; print_r( $fields ); echo "</pre>";
// exit();
@butlerblog
butlerblog / wpmem_exp_ipn_defaults.php
Last active June 9, 2016 17:18
Sets WP-Members PayPal Module log file to verbose output.
<?php
@butlerblog
butlerblog / wpmem_default_text_strings.php
Last active May 1, 2017 13:56
List of default values for the wpmem_default_text_strings filter.
<?php
add_filter( 'wpmem_default_text_strings', function($text) {
$text = array(
'login_heading' => 'Log In to Your Account',
'register_heading' => 'Register New Account',
);
return $text;
});
@butlerblog
butlerblog / wpmem_user_upload_dir.php
Last active June 3, 2016 21:22
List of default values for the wpmem_user_upload_dir filter
<?php // Ignore this line.
add_filter( 'wpmem_user_upload_dir', 'my_user_upload_dir' );
function my_user_upload_dir( $args ) {
// Change default directory if user ID is "10"
if ( 10 == $args['user_id'] ) {
$args['wpmem_dir'] = 'special_dir/',
$args['user_dir'] = 'special_sub'
@butlerblog
butlerblog / wpmem_add_custom_email.php
Last active November 24, 2021 18:39
WP-Members #API functions
<?php
add_action( 'wpmem_after_admin_init', 'my_add_custom_wpmembers_email' );
function my_add_custom_wpmembers_email() {
// Required arguments for wpmem_add_custom_email()
$tag = 'my_unique_msg_tag';
$heading = 'Heading to display input in Emails tab';
$subject_input = 'my_unique_subj_tag';
$message_input = 'my_unique_body_tag';