• Resolved Paz

    (@parambsingh)


    Hello Kento,

    I was wondering if you were able to nail this feature out yet. I see on your site that someone has already requested and you guys were working on this feature 2016.

    I did try to use the shortcode [affiliate_url] in email notification under:
    class-affiliates-notifications.php

    Hard luck. As a workaround, I also tried to edit the Thanks message when the user registers with the same affiliate code. Still did not work for me. Any suggestions would be great.

    Thanks, Paz

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Paz

    (@parambsingh)

    Just to give heads up on what I have tried so far:

    Location:
    \affiliates\lib\core

    File:
    class-affiliates-notifications.php

    case self::DEFAULT_REGISTRATION_ACTIVE_SUBJECT :
    $text = __( ‘site_title Your username and password’, ‘affiliates’ );
    break;
    case self::DEFAULT_REGISTRATION_ACTIVE_MESSAGE :
    $text = __(
    ‘Username: [username]<br/>
    Password: [password]<br/>
    [site_login_url]<br/>
    [affiliate_url]<br/> //Not working.
    <br/>
    Thanks for joining the Affiliate Program.<br/>’,
    ‘affiliates’
    );

    Question: How do [affiliate_url] shortcode would be picked up and generate a URL while sending the welcome email?

    Thread Starter Paz

    (@parambsingh)

    Just checking if you have any update for this request.

    Plugin Author Kento

    (@proaktion)

    Hi Paz,

    Please excuse the delay as we’re in the middle of launching the new 3.x versions. I’ve already investigated a bit more and would suggest a solution based on the existing filters we have, but I haven’t had a chance to test it yet.

    If you’d like to give it a go yourself meanwhile, I think you could use the affiliates_new_affiliate_registration_message filter. It takes the $message as the first and the $params containing user_id, user, … as the second parameter and should return the $message modified as needed.

    You could use the function affiliates_get_affiliate_url( $url, $affiliate_id ) to obtain the URL, note that the second parameter must be the affiliate’s ID, which is not the user ID, but you can use the function affiliates_get_user_affiliate to get the related affiliate ID(s).

    Does this already help you?

    Thread Starter Paz

    (@parambsingh)

    Hi Kento,

    Thanks for your response. I completely understand the delay.

    I think I have reached a solution but then I realized that I’m using Ninja Forms. What I was able to do is that as soon someone register, I showcase them up with Affiliate link right in front to them without having them worrying on checking on to their email and then log in to retrieve Affiliate Link.

    This is what I was successful with:
    File:
    class-affiliates-registration.php

    Location:
    \affiliates\lib\core
    My Code:
    $output .= apply_filters( ‘affiliates_thanks_sign_up_text’, ‘<p>’ . __( ‘Thanks for signing up!’, ‘affiliates’ ) . ‘</p>’ );
    if ( !$is_logged_in ) {
    $output .= apply_filters( ‘affiliates_check_confirmation_text’, ‘<p>’ . __( ‘Please check your email for the confirmation link.’, ‘affiliates’ ) . ‘</p>’ );
    $output .= apply_filters( ‘affiliates_get_user_affiliate’, ‘<p>’ . ‘<span class=”affiliate-link”>affiliates_get_affiliate_url( $url, $affiliate_id ) . ‘</span>’ .
    ‘<br/>’ . ‘</p>’ );

    This actually solved my purpose on getting users Affiliate link right when they sign up but I was using a dev environment, I later realized that this is not supported in Ninja Forms 🙁 as I’m using form success message versus this registration file due to my needs to put data in constant contact platform.

    I’m not very sure how I can apply filters to notifications. I tried to use the same code (class-affiliates-notifications.php) but emails are in text and they need some kind of Shortcode to read affiliate URL as requested in the original message. Any help would be great from here. To describe this more precisely, here is what should be ideal and would help me:

    File: (class-affiliates-notifications.php)
    case self::DEFAULT_REGISTRATION_ACTIVE_MESSAGE :

    $text = __(
    ‘Username: [username]<br/>
    Password: [password]<br/>
    [site_login_url]<br/>
    [affiliate_url]<br/> (CAN THIS BE CONNECTED TO READ FILTER OR WE CAN SOMEHOW MAKE IT WORK?)
    <br/>
    Thanks for joining the Affiliate Program.<br/>’,
    ‘affiliates’ );

    Thanks, Paz

    Thread Starter Paz

    (@parambsingh)

    Ok. Finally spent some time over this and nailed this out.

    Fellow developers here is the code I edited where I registered the shortcode [affilateurl] which was my need and actual support request.

    1) FIRST STEP
    File: (class-affiliates-notifications.php)
    case self::DEFAULT_REGISTRATION_ACTIVE_MESSAGE :

    $text = __(
    ‘Username: [username]<br/>
    Password: [password]<br/>
    [site_login_url]<br/>
    [affiliatesUrl]<br/> // ADD THIS SHORTCODE AND IN SECOND STEP REGISTER THIS.
    <br/>
    Thanks for joining the Affiliate Program.<br/>’,
    ‘affiliates’ );

    2) SECOND STEP

    File:
    class-affiliates-registration.php

    Location:
    \affiliates\lib\core

    //Code by Paz
    global $global_user_pass;
    // notify new user
    self::new_user_notification( $affiliate_user_id, $global_user_pass, affiliates_get_affiliate_url( $url, $affiliate_id ) );
    $global_user_pass = “”;
    return $output;
    }

    //Code by Paz
    global $global_user_pass;
    $global_user_pass = $user_pass;
    // notify new user
    //self::new_user_notification( $user_id, $user_pass );

    return $user_id;
    }

    public static function new_user_notification( $user_id, $plaintext_pass = ”, $affiliate_id = ” ) {
    $user = get_userdata( $user_id );
    $blogname = wp_specialchars_decode( get_option( ‘blogname’ ), ENT_QUOTES );
    if ( !empty( $plaintext_pass ) ) {
    if ( get_option( ‘aff_notify_affiliate_user’, ‘yes’ ) != ‘no’ ) {
    $message = sprintf( __( ‘Username: %s’, ‘affiliates’ ), $user->user_login) . “\r\n”;
    $message .= sprintf( __( ‘Password: %s’, ‘affiliates’ ), $plaintext_pass ) . “\r\n”;
    $message .= wp_login_url() . “\r\n”;
    $params = array(
    ‘user_id’ => $user_id,
    ‘user’ => $user,
    ‘username’ => $user->user_login,
    ‘password’ => $plaintext_pass,
    ‘site_login_url’ => wp_login_url(),
    ‘blogname’ => $blogname,
    ‘affiliatesUrl’ => ‘yoursite’.$affiliate_id //get this from here
    );
    @wp_mail(
    $user->user_email,
    apply_filters( ‘affiliates_new_affiliate_user_registration_subject’, sprintf( __( ‘[%s] Your username and password’, ‘affiliates’ ), $blogname ), $params ),
    apply_filters( ‘affiliates_new_affiliate_user_registration_message’, $message, $params ),
    apply_filters( ‘affiliates_new_affiliate_user_registration_headers’, ”, $params )
    );
    }
    }
    }

    So why this is not common Feature after all, and I do have some more major issue, user gets a wrong link to login…
    quality freeware

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Sending Affiliate URL on Welcome Email versus have them log in.’ is closed to new replies.