Skip to content

Commit e81ae86

Browse files
authored
Merge pull request #13 from humanmade/11-load-activation-values
Add the Patchstack client ID and secret key
2 parents 8cf8fc5 + 86f56f4 commit e81ae86

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

inc/namespace.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,19 @@ function on_plugins_loaded() {
4141
}
4242
}
4343
}
44+
45+
// check whether we have the client id and secret key variables/secrets set
46+
$client_id = Altis\get_variable( 'PATCHSTACK_CLIENTID' );
47+
$secret_key = Altis\get_variable( 'PATCHSTACK_SECRETKEY' );
48+
if ( $client_id && $secret_key ) {
49+
// check if the plugin is already connected
50+
if ( get_option( 'patchstack_clientid', false ) === false || get_option( 'patchstack_secretkey', false ) == false ) {
51+
// set the client id and secret key
52+
update_option( 'patchstack_clientid', $client_id );
53+
update_option( 'patchstack_secretkey', $secret_key );
54+
// The plugin will self activate from here
55+
}
56+
}
4457
}
4558
}
4659

0 commit comments

Comments
 (0)