Created
December 31, 2018 06:37
-
-
Save webaware/3cfe46a4da612ce1f57526e1ec8cabb2 to your computer and use it in GitHub Desktop.
code excerpt for restoring the FAQ section to responses in EDD Software Licensing API calls
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//... | |
add_filter('edd_sl_license_readme_response', array($this, 'eddMaybeRestoreFAQ'), 10, 3); | |
/** | |
* maybe restore the FAQ section to the update info package | |
* @param array $response | |
* @param \EDD_SL_Download $download | |
* @param array $readme | |
* @return array | |
*/ | |
public function eddMaybeRestoreFAQ($response, $download, $readme) { | |
$sections = unserialize($response['sections']); | |
if (empty($sections['faq']) && (!empty($readme['sections']['faq']))) { | |
$sections['faq'] = $readme['sections']['faq']; | |
$response['sections'] = serialize($sections); | |
} | |
return $response; | |
} | |
//... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment