Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
strangerstudios / update-wp-config.php
Last active March 21, 2018 14:31
Copy HTTP_X_FORWARDED_PROTO to HTTPS so WordPress can detect is_ssl()
//copy HTTP_X_FORWARDED_PROTO config to HTTPS var in $_SERVER
if((empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off') && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
$_SERVER['HTTPS'] = 'on';
@strangerstudios
strangerstudios / my_pmpro_wp_mail.php
Created January 3, 2017 18:34
Set reply-to header in emails to get around SMTP issues.
/*
Set reply-to header in emails to get around SMTP issues.
I forget why I needed this, but I believe WP Manril or an SMTP app was using the incorrect reply to.
*/
function my_pmpro_wp_mail($args)
{
if(!empty($args['headers']))
{
foreach($args['headers'] as $header)
@andrewlimaza
andrewlimaza / rh_fields_example.php
Created December 15, 2016 14:04
Register Helper field type example shows an example of every possible field in Register Helper
<?php
/**
* This example is to show you the 'niche' options each Paid Memberships Pro - Register Helper Add-on field can take and how to use it.
* For more information on the Register Helper Add-on please visit https://www.paidmembershipspro.com/add-ons/free-add-ons/pmpro-register-helper-add-checkout-and-profile-fields/
**/
function my_pmprorh_init()
{
//don't break if Register Helper is not loaded
@strangerstudios
strangerstudios / my_pmpro_dashboard_report.php
Last active April 14, 2022 03:37 — forked from andrewlimaza/my_custom_dashboards.php
Show Membership Reports on the WordPress Admin Dashboard
<?php
/*
Show Members Reports on the WordPress Admin Dashboard.
Update the my_pmpro_dashboard_report() function to remove or add core or custom reports.
*/
//Create a Dashboard Reports widget for Paid Memberships Pro
function add_my_report_dashboard() {
if( ! defined( 'PMPRO_DIR' ) || ! current_user_can( 'manage_options' ) )
{
@strangerstudios
strangerstudios / my_memberlite_before_footer_upgrade3.php
Last active March 21, 2018 14:33
Show three Membership Level options in bottom banner to site visitors and a login link for members. Requires the Advanced Levels Page Shortcode Add On.
@strangerstudios
strangerstudios / my_member_dashboard_downloads.php
Created November 6, 2016 12:47
A sample member dashboard for sites running PMPro and Download Monitor
[row][col medium="4"]
[pmpro_account section="profile"]
[pmpro_account sections="membership"]
[pmpro_account sections="invoices"]
[/col][col medium="8"]
<div class="pmpro_message pmpro_default">
<h2>My Downloads</h2>
<hr />
[row_row][col_col medium="6"]
<span class="text-2x">Gold Member Reports</span>
@strangerstudios
strangerstudios / my_member_dashboard_wpcourseware.php
Created November 6, 2016 12:43
A sample member dashboard for sites running PMPro and WP Courseware
[memberlite_banner background="#EFEFEF"]
[row][col medium="12"]
[row_row]
[col_col medium="8"]
<span class="text-3x">Course Overview</span>
[wpcourse course="1"]
[/col_col][col_col medium="4"]
<span class="text-3x">Course Progress</span>
[wpcourse_progress courses="1" user_progress="true" user_grade="true" /]
[/col_col][/row_row]
@strangerstudios
strangerstudios / my_member_dashboard_bbpress.php
Last active April 13, 2021 04:21
A sample member dashboard for sites running PMPro and bbPress
[memberlite_banner background="secondary"][row][col medium="4"]
[bbp-user-activity title="My Recent Topics" activity_type="topic" show_date="true"]
[/col][col medium="4"]
[bbp-user-activity title="My Recent Replies" activity_type="reply" show_excerpt="true" show_date="true"]
[/col][col medium="4"][otw_is sidebar=otw-sidebar-1]
[/col][/row]
[row][col medium="12"]
<hr />
<h2 class="text-center">[memberlite_btn href="/forums/forum/gold-forum/" text="View Gold Member Forum" style="action"]</h2>
[/col][/row]
@andrewlimaza
andrewlimaza / add_message_after_credit_card_fields_pmpro.php
Created October 6, 2016 14:01
add message after credit card fields PMPro
<?php
//paste the following into your PMPro Customizations plugin (http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/) or your active theme's functions.php
function pmproc_add_my_message(){
_e( 'my custom text that will change.', 'pmpro');
}
add_action( 'pmpro_checkout_before_submit_button', 'pmproc_add_my_message' );
@strangerstudios
strangerstudios / my_pmpro_bbp_template_before_user_profile.php
Last active April 13, 2021 04:22
Add the [pmpro_account] shortcode before other bbPress Profile content.
/*
Add the [pmpro_account] shortcode before other bbPress Profile content.
*/
function my_pmpro_bbp_template_before_user_profile() {
global $current_user;
$bbp_user_id = bbp_get_user_id( 0, true, false );
if($bbp_user_id == $current_user->ID && shortcode_exists( 'pmpro_account' ))
echo do_shortcode('[pmpro_account]');
}
add_action('bbp_template_before_user_profile', 'my_pmpro_bbp_template_before_user_profile', 15, 0);