This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: AffiliateWP Custom Referral URL | |
Plugin URI: http://affiliatewp.com | |
Description: Adds AffiliateWP Custom Referral URL | |
Version: 0.1 | |
License: GPL | |
Author: AffiliateWP | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var OAuth = require('oauth') | |
// `npm install oauth` to satisfy | |
// website: https://github.com/ciaranj/node-oauth | |
var KEY = "<INSERT KEY HERE>" | |
var SECRET = "<INSERT SECRET HERE>" | |
var oauth = new OAuth.OAuth( | |
'http://api.thenounproject.com', | |
'http://api.thenounproject.com', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$affiliate = affwp_get_affiliate( affwp_get_affiliate_id() ); | |
$user_info = get_userdata( $affiliate->user_id ); | |
$affiliate_user_name = $user_info->user_login; | |
?> | |
<div id="affwp-affiliate-dashboard-url-generator" class="affwp-tab-content"> | |
<h4><?php _e( 'Referral URL Generator', 'affiliate-wp' ); ?></h4> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('um_after_register_fields', 'add_a_hidden_field_to_register'); | |
function add_a_hidden_field_to_register( $args ){ | |
echo '<input type="hidden" name="field_id" id="field_id" value="HERE_GOES_THE_VALUE" />'; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Gravity Perks // GP Auto Login // Redirect to New Site on Auto Login | |
*/ | |
add_filter( 'gpal_auto_login_on_redirect_redirect_url', function( $url, $user_id ) { | |
require_once( GFUser::get_base_path() . '/data.php' ); | |
$entry_id = get_user_meta( $user_id, 'entry_id', true ); | |
$site_id = GFUserData::get_site_by_entry_id( $entry_id ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This code will sync the UM role based on WP role using gravity registration */ | |
add_action("gform_user_registered", "um_gravity_user_role_sync", 200, 4); | |
function um_gravity_user_role_sync($user_id, $config, $entry, $user_pass) { | |
$user = new WP_User( $user_id ); | |
$wp_role = $user->roles[0]; | |
// if WP role is subscriber, set UM role to member | |
if ( $wp_role == 'subscriber' ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('um_after_user_is_approved', 'wp_role_contributor_after_um', 99 ); | |
function wp_role_contributor_after_um( $user_id ) { | |
$wp_user_object = new WP_User( $user_id ); | |
$wp_user_object->set_role( 'contributor' ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* WP Courseware Hook | |
* @version 1.0.2 | |
*/ | |
add_filter( 'mycred_setup_hooks', 'mycred_register_courseware_hook' ); | |
function mycred_register_courseware_hook( $installed ) { | |
$installed['courseware'] = array( | |
'title' => 'WP Courseware', | |
'description' => 'Award or deduct %plural% for users completing WP Courseware courses, modules or units.', | |
'callback' => array( 'myCRED_Hook_CourseWare' ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function affwp_opi_add_tracking_shortcode() { | |
// this can be the page ID, page slug, or page title. Page title is shown below | |
if ( is_page( 'Your Success Page' ) ) { | |
echo do_shortcode( '[affiliate_conversion_script description="Your Description" amount="100"]' ); | |
} | |
// another "thanks" page using a page ID | |
if ( is_page( 50 ) ) { | |
echo do_shortcode( '[affiliate_conversion_script description="A different description" amount="200"]' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function affwp_custom_op_login_redirect( $return, $vars ) { | |
$user_id = $vars['user_id']; | |
if ( function_exists( 'affwp_is_affiliate' ) && affwp_is_affiliate( $user_id ) ) { | |
$return = false; | |
} | |
return $return; | |
} |