diff --git a/sleeky-backend/assets/js/theme.js b/sleeky-backend/assets/js/theme.js index 50f5b72..739d67f 100644 --- a/sleeky-backend/assets/js/theme.js +++ b/sleeky-backend/assets/js/theme.js @@ -110,9 +110,6 @@ $( document ).ready(function() { // Add mobile nav hamburger $("#wrap").prepend(``); - // Add frontend link - $('#admin_menu').append(''); - // admin_menu $('#navOpen').on('click', function() { $('#admin_menu').slideToggle(); diff --git a/sleeky-backend/plugin.php b/sleeky-backend/plugin.php index 9868d6f..7f5dabe 100755 --- a/sleeky-backend/plugin.php +++ b/sleeky-backend/plugin.php @@ -139,9 +139,21 @@ function sleeky_settings_update() { } } -// Hide admin links for non-authenticated users -if (yourls_is_valid_user() != 1) { - echo <<ul#admin_menu li:not(.frontend_link) {display: none} -HEAD; +/* + * Remove admin links for non-authenticated users +*/ +yourls_add_filter('admin_links', 'sleeky_admin_links'); +function sleeky_admin_links($links) +{ + if (true !== yourls_is_valid_user()) { + $links = []; + } + + $links['frontend_link'] = [ + 'url' => yourls_site_url(false, '/'), + 'title' => yourls__( 'Frontend Interface' ), + 'anchor' => 'arrow_back ' . yourls__( 'Frontend Interface' ) + ]; + + return $links; }