Skip to content

Instantly share code, notes, and snippets.

@ramiabraham
Forked from pippinsplugins/gist:d973776836ab984aea06
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramiabraham/aa81b6026a65a94d7640 to your computer and use it in GitHub Desktop.
Save ramiabraham/aa81b6026a65a94d7640 to your computer and use it in GitHub Desktop.
Set affiliate role on registration
<?php
/*
* Plugin name: Affiliate role on registration
*/
function pw_affwp_set_role_on_registration( $affiliate_id = 0 ) {
$user_id = affwp_get_affiliate_user_id( $affiliate_id );
$user = new WP_User( $user_id );
$user->add_role( 'affiliate' );
}
add_action( 'affwp_insert_affiliate', 'pw_affwp_set_role_on_registration' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment