MOS UAP Fix
Hacky fix for UAP plugin (Indeed Ultimate Affiliate Pro)
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/minkaizen/mos-uap-fix/archive/refs/heads/main.zipReadme
MOS UAP Fix
Description
Fixes a broken feature from the plugin Ultimate Affiliate Pro (by Indeed). Namely:
- Creates sponsor-downline relationship on user registration
Requirements
Ultimate Affiliate Proneeds to be installed and activated.- PHP >= 7.4
ReWrite Referralsenabled (WP Dashboard>Ultimate Affiliate Pro>Extensions>ReWrite Referrals)
Note: If migrating from a new site, some required tables might not be available, causing a fatal error. In this case, simply deactivate and reactate the
Ultimate Affiliate Proplugin.
Quickstart
Simply install and activate the plugin. This plugin comes with sane defaults, but can be configured. See configuration
Configuration
Settings can be configured by going to WP Dashboard > Settings > UAP Fix
Available settings and their defaults:
Affiliate Link Parameter Name
Default value: id
The name of the query parameter inside the affiliate link. This can be any arbitrary name of your choosing, as long as it's url-safe (only letters, numbers and underscores).
For example, if this is set to id, then affiliate links need to include ?id= or (if it's not the first parameter) &id=. For example: https://www.yoursite.com/?id=someone or https://yoursite.com/?other_param=hello&id=someone
Note: Changing this value is essentially changing the affiliate link. Use with caution.
Affiliate Link Parameter Identifier
Default value: username
Available options: username, wpid, email
Which user field should be used inside the affiliate link after the ?id= in the affiliate link.
Note: Changing this value is essentially changing the affiliate link. Use with caution.
Cookie Expiration (days)
Default value: 360
Available values: Any positive integer. If set to 0, the cookie will expire as soon as the browser is closed or the user leaves the page.
The number of days after which the cookie should expire. This is the cookie that credits a sign up to an affiliate.
Note 1: Changing this value will not affect the current cookies stored on a user's device. It will only affect future cookies generated by the affiliate link.
Automatically make new user affiliate
Default value: false
Whether or not a new user should automatially be considered an "affiliate".
Note: This functionality required for the sponsor-downline relationships to work, but this particular functionality is already inside UAP and is currently not broken. If in doubt, disable this option UNLESS this particular setting is OFF or not working inside UAP.
How it works
Under the hood, this plugin does 3 things:
- On any site visit, check the URL for the affiliate parameter (e.g.
?id=martin). If present, generate a cookie that stores the sponsor's Wordpress ID - On user registration, check if a cookie is present. If it is, create the sponsor-downline relationship.
- (If setting is enabled) Automatically affiliate new users