On it's own, when this plugin is installed it merely allows use of the myli_wp class which is an extended class of the myLI PHP class which uses wordpress data to store its settings. You can use the functions, methods, actions and filters provided by this plugin to add additional functionality.
- Upload the plugin files to the
/wp-content/plugins/plugin-name
directory, or install the plugin through the WordPress plugins screen directly. - Activate the plugin through the 'Plugins' screen in WordPress
- When installed on a site, settings for MyLI Will become available in the admin panel. These will request your instance URL, Client ID and Client Secret
add_action('myli_wp_init',function(){ /* Not Logged In */ if(!is_user_logged_in()){ myli_wp()->login(); }else{ echo myli_wp()->get_user_profile()->FullName; } });
myli_wp_admin_settings
: Filter for adding new admin settings, provide additional html, example below
Updates are handled by our own custom github updater, check the plugs page for notification of available updates. The Plugin can be reinstalled using the "Download" button or "Updated" when the update button is showing.
Some basic functions that can be used
admin-ajax.php?action=my_li_ajax_login&redirect=URL
: Send the user to login and return to the given page
admin-ajax.php?action=my_li_ajax_logout&redirect=URL
: Send the user to logout and return to the given page
If you are writing plugins which extend the functionality and wish to save settings you can use a filter to add additional settings. for example below will add a new section and setting called new_setting which can be retrived using
myli_wp()->get_option('my_setting')
the following should be called during admin_init and after myli_wp_loaded action.
`add_filter('myli_admin_settings',function($admin_settings){
$admin_settings = $admin_settings . '
<h2>New Settings</h2>
<table class="form-table">
<tbody>
<tr>
<th scope="row"><label>' . _('New Setting') . '</label></th>
<td>
<input type="text" name="new_setting" id="new_setting" value="' . myli_wp()->get_option('new_setting') . '">
<p class="description"' . _('Whats the value of new setting') . '</p>
</td>
</tr>
</tbody>
</table>
';
return $admin_settings;
});`