Created
June 17, 2021 11:18
-
-
Save thaboklass/f3b01c416d6c9ffbdadc4bfa1feb2f8c to your computer and use it in GitHub Desktop.
This file contains 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 | |
/** | |
* Register section, fields and page | |
* | |
* Registers a new settings section and settings fields on the | |
* 'RobberBaron.TV' page of the WordPress dashboard. | |
* | |
* @param none | |
* @return none | |
*/ | |
public function robber_baron_tv_initialize_options() { | |
// Introduce an new section that will be rendered on the new | |
// settings page. This section will be populated with settings | |
// that will give the 'RobberBaron.TV' plugin its firebase | |
// configuration options. | |
add_settings_section( | |
'robber_baron_tv_settings_section', // The ID to use for this section | |
'RobberBaron Connection', // The title of this section that is rendered to the screen | |
array($this, 'robber_baron_tv_settings_section_display'), // The function that is used to render the options for this section | |
'robber-baron-tv-configuration' // The ID of the page on which the section is rendered | |
); | |
// Defines the settings field 'Your RobbberBaron.TV email' | |
// which is a the RobberBaron email address of the website owner | |
add_settings_field( | |
'robber_baron_tv_email_address', // The ID of the setting field | |
'Your RobbberBaron.TV email:', // The text to be displayed | |
array($this, 'robber_baron_tv_email_address_display'), // The function used to render the setting field | |
'robber-baron-tv-configuration', // The ID of the page on which the setting field is rendered | |
'robber_baron_tv_settings_section' // The section to which the setting field belongs | |
); | |
// Register the 'robber_baron_tv_email_address' | |
// with the 'Ethereum Settings' section | |
register_setting( | |
'robber_baron_tv_settings', // The section holding the settings fields | |
'robber_baron_tv_email_address' // The name of the settings field to register | |
); | |
// Simply displays the system environment including the connection status | |
add_settings_field( | |
'robber_baron_tv_connected', | |
'Your RobberBaron.TV connection:', | |
array($this, 'robber_baron_tv_system_environment'), | |
'robber-baron-tv-configuration', | |
'robber_baron_tv_settings_section' | |
); | |
// Register the 'robber_baron_tv_connected' | |
// with the 'Functionality Options' section | |
register_setting( | |
'robber_baron_tv_settings', | |
'robber_baron_tv_connected' | |
); | |
/// Send mail if there is any mail post data | |
$this->robber_baron_tv_send_error_email(); | |
} // end of function robber_baron_tv_initialize_options | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment