Skip to content

Instantly share code, notes, and snippets.

@rocketgeek
rocketgeek / snippet.php
Created July 15, 2024 20:02
Membership renew direct to checkout
<?php // do not include this line.
add_filter( 'wpmem_wc_renew_url', function( $url, $product_id, $key ) {
global $woocommerce;
$url = $woocommerce->cart->get_checkout_url();
return $url;
}, 10, 3 );
@rocketgeek
rocketgeek / api.php
Created July 4, 2024 19:23
Patched version of api correcting wpmem_woo_is_purchasable()
<?php
/**
* WP-Members API Functions
*
* This file is part of the WP-Members plugin by Chad Butler
* You can find out more about this plugin at https://rocketgeek.com
* Copyright (c) 2006-2023 Chad Butler
* WP-Members(tm) is a trademark of butlerblog.com
*
* @package WP-Members
@rocketgeek
rocketgeek / segment.php
Created May 17, 2024 19:57
Add a mailchimp user to a segment
<?php
// @link https://mailchimp.com/developer/marketing/api/list-segments/
$segment_id = '123'; // The segment ID
$user_email = '';
wpmem_mc_query_api_lists(
'post',
array( 'segments', $segment_id, 'members' ),
array( 'email_address' => $user_email )
@rocketgeek
rocketgeek / class-wp-members-user-export.php
Last active January 17, 2024 22:45
Add separator and enclosure to filterable args for 3.5.0
<?php
/**
* The WP_Members Export Class.
*
* @package WP-Members
* @subpackage WP_Members Export Object Class
* @since 3.3.0
*/
// Exit if accessed directly.
@rocketgeek
rocketgeek / class-wp-members-user-profile.php
Created October 27, 2023 16:48
code improvement to be incldued in class-wp-members-user-profile.php version 3.5.0
<?php
/**
* The WP_Members User Profile Class.
*
* @package WP-Members
* @subpackage WP_Members Admin User Profile Object Class
* @since 3.1.8
*/
// Exit if accessed directly.
@rocketgeek
rocketgeek / class-wp-members-pwd-reset.php
Last active April 28, 2023 20:50
Possible password reset update to check get_password_reset_key() for WP_Error object
<?php
/**
* An object class for WP-Members Password Reset.
*
* @since 3.3.5
* @since 3.3.8 Rebuild processing to utilize WP native functions and user_activation_key.
*/
class WP_Members_Pwd_Reset {
/**
@rocketgeek
rocketgeek / class-wp-members-woocommerce-integration.php
Last active April 6, 2023 14:01
Patch for WP_Members_WooCommerce_Integration object class when no existing settings are passed to the constructor
<?php
class WP_Members_WooCommerce_Integration {
public $add_my_account_fields;
public $add_checkout_fields;
public $add_update_fields;
public $product_restrict;
public function __construct( $wpmem ) {
@rocketgeek
rocketgeek / show_my_posts_shortcode.php
Last active February 17, 2023 14:08
Display a list of membership posts a user has access to
<?php // do not include this line.
/**
* Adds a custom shortcode to display membership restricted
* posts that a user has access to.
*
* shortcode: [show_my_posts]
*/
add_shortcode( 'show_my_posts', 'my_show_my_posts' );
function my_show_my_posts( $atts, $content, $tag ) {
@rocketgeek
rocketgeek / class-wp-members-pwd-reset.php
Created February 11, 2023 14:42
pending workaround for core integration with security when password generator is used
<?php
/**
* An object class for WP-Members Password Reset.
*
* @since 3.3.5
* @since 3.3.8 Rebuild processing to utilize WP native functions and user_activation_key.
*/
class WP_Members_Pwd_Reset {
/**
@rocketgeek
rocketgeek / class-wp-members-user-search.php
Created January 11, 2023 18:49
Temporary fix for user search collation issues
<?php
/**
* The WP_Members Admin User Search Class.
*
* An object class to improve the backend user search. Allows
* searching by selected meta keys as defined in the plugin
* settings. Hooks into pre_user_query.
*
* Modified from Better User Search:
* https://wordpress.org/plugins/better-user-search/