MemberPress: Add a Shortcode To Display the Number of Total Downloads for All Files

add_shortcode( ‘mepr-display-total-downloads’, function() { global $wpdb; $downloads_old = $wpdb->get_var( “SELECT SUM(download_count) FROM {$wpdb->prefix}mpdl_file_downloads” ); $downloads_new = $wpdb->get_var( “SELECT count(*) FROM {$wpdb->prefix}mpdl_file_stats” ); $downloads_old = isset( $downloads_old ) && $downloads_old != null ? $downloads_old : 0; $downloads_new = isset( $downloads_new )…Continue reading

MemberPress: Add Address Column to Subscriptions Table

add_filter( ‘mepr-admin-subscriptions-cols’, function( $cols ) { $cols[‘col_address’] = __( ‘Address’, ‘memberpress’ ); return $cols; }); add_action( ‘mepr-admin-subscriptions-cell’, function( $column_name, $rec, $table, $attributes ) { if( $column_name === ‘col_address’ ) { $user = new MeprUser( ( int ) $rec->user_id ); $address_one…Continue reading

Donation Form Email Check (Advanced)

add_filter(‘charitable_validate_donation_form_submission_email_check’, ‘charitable_test_for_email’, 10, 2 ); function charitable_test_for_email( $valid, $submitted ) { $email = $submitted->get_submitted_value( ’email’ ); if ( ! is_valid_email( $email ) ) { return false; } return $valid; } function is_valid_email($email) { // Use PHP’s built-in function to split…Continue reading