Referrer Affiliate User ID

I am making use of the “Affiliates is Referred” plugin recommended in /useful-plugins/. The reason I am using it is to create a landing page for the visitor to see customized information about the affiliate who referred them. One of the elements I want to show on the page is a profile picture of the affiliate. I have added images to the affiliate profile, but I am having issues getting the actual user id.

Using the short code [referrer_user display=”referrer_id”] produces the login name. Using the short code [referrer_id] produces their token for the URL.

Is there a short code for the actual ID as found in the wp_users table?
Better yet, is there someone already using a customized landing page for visitors showing their referring affiliate’s information?

3 Responses to Referrer Affiliate User ID

  1. kento October 25, 2014 at 10:04 am #


    I would recommend to get the user ID of the referring affiliate directly through the API, this makes it easier to work with:

    require_once( 'class-affiliates-service.php' );
    $affiliate_id = Affiliates_Service::get_referrer_id();
    if ( $affiliate_id ) {
        $user_id = affiliates_get_affiliate_user( $affiliate_id );
        // @todo do stuff ...

    With that, you first check if the visitor has been referred, obtaining the affiliate ID and then get the user ID for the affiliate.

    I hope that helps, let me know if you need further help please.

    • Sean October 28, 2014 at 5:54 pm #

      Hi Kento,

      Thank you. This worked for me. What I ended up doing was adding it to the class for the “Affiliates is Referred” plugin and adding a short code for it.

      For anyone else looking for the same solution, install the affiliates-is-referred plugin from the github repository. In the init function at the top, add this line:
      add_shortcode( ‘affiliates_is_referred_id’, array( __CLASS__, ‘is_referred_id_func’ ) );

      Then inside the class add this function:

      public static function is_referred_id_func(){
      require_once AFFILIATES_CORE_LIB . ‘/class-affiliates-service.php’;
      if ( $referrer_id = Affiliates_Service::get_referrer_id() ) {
      if ( $referrer_id ) {
      $user_id = affiliates_get_affiliate_user( $referrer_id );
      return $user_id;
      } else {
      return false;
      } else {
      return false;

      Thanks for your help!!

      • antonio October 29, 2014 at 2:46 pm #

        Thanks Sean,
        you also have available Affiliates-Popup file in github.

We use cookies to optimize your experience on our site and assume you're OK with that if you stay.
OK, hide this message.

Affiliates · Contact · Jobs · Terms & Conditions · Privacy Policy · Documentation · Downloads · Useful Plugins · My Account