Skip to content

Instantly share code, notes, and snippets.

@itthinx
itthinx / list-group-users.php
Last active Aug 29, 2015
[list_group_users]
View list-group-users.php
<?php
add_shortcode( 'list_group_users', 'list_group_users' );
function list_group_users( $atts, $content = '' ) {
$output = '';
if ( isset( $atts['group'] ) ) {
if ( $group = Groups_Group::read_by_name( trim( $atts['group'] ) ) ) {
$group = new Groups_Group( $group->group_id );
$groups_users = $group->users;
usort( $groups_users, 'sort_list_group_users' );
if ( !empty( $groups_users ) ) {
@itthinx
itthinx / gist:fd36ab89359332d4a142
Last active Aug 29, 2015
Affiliate coupons rendered as text
View gist:fd36ab89359332d4a142
<style type="text/css">
div.field.affiliate-attribute.coupons {
display:inline;
}
div.field.affiliate-attribute.coupons label {
display:none;
}
div.field.affiliate-attribute.coupons input {
width:60%;
border:none;
@itthinx
itthinx / craig-auth0.php
Last active Aug 29, 2015
Craig's Auth0 integration with Groups
View craig-auth0.php
<?php
_log ('firing craig_Login_Hook()');
// require_once(ABSPATH . 'wp-includes/pluggable.php' );
global $currentauth0_user;
$user_id = get_current_user_id();
if ($user_id > 0) {
get_currentauth0userinfo();
/* grab the Auth0 groups for the current user */
@itthinx
itthinx / uksort.php
Created Mar 11, 2015
PHP Bug Warning: uksort(): Array was modified by the user comparison function
View uksort.php
<?php
/**
* The following will produce this result:
*
* Warning: uksort(): Array was modified by the user comparison function in /Users/kento/Sites/uksort.php on line 12
* set = array ( 'apple' => 'green', 'color' => 'yellow', 'wine' => 'white', 'yoghurt' => 'frozen', )
*
* See also https://bugs.php.net/bug.php?id=50688
**/
View yves-groups-formidable-paypal.php
/**
* Yves' implementation to add a capability to a group when a purchase has been completed.
*
* http://www.itthinx.com/plugins/groups-paypal/comment-page-1/#comment-647332
*/
add_action('frm_payment_paypal_ipn', 'ls4s_sprint_purchase_completed');
function ls4s_sprint_purchase_completed($args)
{
global $frmdb, $wpdb;
@itthinx
itthinx / woocommerce-product-search-storefront.php
Created Nov 15, 2017
Using WooCommerce Product Search and replacing the default Search Form in Storefront and its child themes
View woocommerce-product-search-storefront.php
<?php
function storefront_product_search() {
if ( function_exists('storefront_is_woocommerce_activated' ) ) {
if ( storefront_is_woocommerce_activated() ) { ?>
<div class="site-search">
<?php
if ( function_exists( 'woocommerce_product_search' ) ) {
echo woocommerce_product_search();
} else {
the_widget( 'WC_Widget_Product_Search', 'title=' );
@itthinx
itthinx / riche.php
Last active May 25, 2018
Affiliate Registration issue
View riche.php
<?php
// from https://www.itthinx.com/topic/affiliate-registration-issue-2/
// the snippet for the form action which currently works looks like this:
function referring_affiliate_form_action ( $atts ) {
$output_form_action = '';
if ( !is_admin() ) {
if ( !class_exists( "Affiliates_Service" ) ) {
View wp-mail-override.php
// An example wp_mail() override that you can place in your site's wp-config.php.
// Read the corresponding post https://www.itthinx.com/2021/09/06/wordpress-mail-debugging/
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) {
$output = sprintf(
"\n\n" .
@itthinx
itthinx / functions.php
Last active Nov 2, 2021
An example of using the decent_comments_comment_output filter to customize output
View functions.php
<?php
//
// An example filter implementation provided in response to this question on the Decent Comments plugin for WordPress
//
// https://wordpress.org/plugins/decent-comments/
//
// https://www.itthinx.com/plugins/decent-comments/comment-page-3/#comment-1127674
//
function my_decent_comments_comment_output( $output, $comment_ID, $options ) {
$comment = get_comment( $comment_ID );