Affiliates: introduce class to get the affiliate code#10749
Conversation
|
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: January 10, 2019. Generated by 🚫 dangerJS |
8ef5c46 to
8a695a9
Compare
8a695a9 to
305265b
Compare
ebinnion
left a comment
There was a problem hiding this comment.
This LGTM. I left a couple of minor comments, but otherwise 👍
I tested that the affiliate code was present in the Jetpack react admin page as well as in the connect URL.
We should also ensure that JITM links get the affiliate code added to them as well.
class.jetpack.php
Outdated
There was a problem hiding this comment.
I'd suggest adding some () around the assignment here. Maybe something like:
if ( '' !== ( $aff = Jetpack_Affiliate::init()->get_affiliate_code() ) )There was a problem hiding this comment.
It might be more exact if we did something like the following, since I think this test is checking that aff is missing.
$this->assertNotContains( 'aff=', Jetpack::init()->build_connect_url() );…n and allow to filter it. Add affiliate code to connect url and send it to Jetpack UI (it will be introduced in upgrade links in a follow up PR).
305265b to
2248895
Compare
|
Comments addressed. And yes, I'll add the affiliate link to JITMs in a follow up PR. |
jeherve
left a comment
There was a problem hiding this comment.
It tests well for me. 👍 Merging.
* Add first version of the Changelog and testing list for 6.9 * Changelog: add #10710 * changelog: add #10538 * changelog: add #10741 * changelog: add #10749 * changelog: add #10664 * changelog: add #10224 * changelog: add #10788 * Changelog: add #10560 * Chanegelog: add #10812 * changelog: add #10556 * Changelog: add #10668 * Changelog: add #10846 * Changelog: add #10947 * Changelog: add #10962 * Changelog: add #10956 * Changelog: add #10940 * Changelog: add #10934 * Changelog: add #10912 * changelog: add #10866 * changelog: add #10924 * Changelog: add #10936 * Changelog: add #10833 * changelog: add #10867 * Changelog: add #10960 * Changelog: add #10888 * changelog: add #10840 * changelog: add #10972 * Changelog: add #10979 * changelog: add #10909 * Changelog: add #10958 * Changelog: add #10981 * Changelog: add #10564 * Changelog: add #10809 * Changelog: add #10982 * Changelog: add #10706 * Changelog: add #10978 * Changelog: add #10132 * Changelog: add #11022 * Changelog: add #11024 * Changelog: add #10875 * Changelog: add #11030 * Changelog: add #11053 * Changelog: add #10880 * Changelog: add #9359 * Changelog: add #11037 * Update block list * Changelog: add #11060 * Changelog: add #10755 * changelog: add #11000 * Changelog: add #10786 * Changelog: add #10945 * Changelog: add #10597
This PR seeks to introduce affiliate codes in Jetpack creating a class that allows to get an affiliate code from a database option
jetpack_affiliate_code, and filtering it. There are two ways to set this code in the website:wp option add jetpack_affiliate_code abc123add_filter( 'jetpack_affiliate_code', function() { return 'abc123'; } );Additionally, this PR will also:
affInitial_Stateobject as the propertyaffit will be added to upgrade links in a follow up PR, since we need to refactor how upgrade links are written (right now they're inline) to be able to add the affiliate code or another param in the future in a consistent way using a function that given some params, returns the upgrade link.
Testing instructions
a. manually
wp option add jetpack_affiliate_code abc123(oryarn docker:wp option add jetpack_affiliate_code abc123)affparameter with the right valueInitial_Setup.affproperty has the right valueb. running unit tests. There's a new test suite named
affiliatephpunit --testsuite=affiliateoryarn docker:phpunit --testsuite=affiliateProposed changelog entry
Not necessary to mention this change since it will be known for those that have to know about it.