Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • wildcomputations

    (@wildcomputations)

    Agreed, I too am experiencing this issue. In my case, I only have authors on my site, no editors, but I didn’t want them changing the global settings. Here are the changes I made to let authors upload GPS tracks.

    --- wp-gpx-maps.php_orig	2019-04-29 21:42:35.000000000 -0400
    +++ wp-gpx-maps.php	2019-04-29 21:43:24.000000000 -0400
    @@ -41,7 +41,12 @@
         // check to make sure we are on the correct plugin
         if ($file == $this_plugin) {
             // the anchor tag and href to the URL we want. For a "Settings" link, this needs to be the url of your settings page
    -        $settings_link = '<a href="' . get_bloginfo('wpurl') . '/wp-admin/options-general.php?page=WP-GPX-Maps">Settings</a>';
    +        if ( current_user_can('manage_options') ) {
    +            $menu_root = "options-general.php";
    +        } else if ( current_user_can('publish_posts') ) {
    +            $menu_root = "admin.php";
    +        }
    +        $settings_link = '<a href="' . get_bloginfo('wpurl') . '/wp-admin/' . $menu_root . '?page=WP-GPX-Maps">Settings</a>';
             // add the link to the list
             array_unshift($links, $settings_link);
         }
    --- wp-gpx-maps_admin_tracks.php_orig	2019-04-29 21:28:13.000000000 -0400
    +++ wp-gpx-maps_admin_tracks.php	2019-04-29 21:48:06.000000000 -0400
    @@ -3,12 +3,17 @@
     	if ( !(is_admin()) )
     		return;
    
    -	$is_admin = current_user_can( 'manage_options' );
    +	$is_admin = current_user_can( 'publish_posts' );
    
     	if ( $is_admin != 1 )
     		return;
    
     	$gpxRegEx = '/.gpx$/i';
    +        if ( current_user_can('manage_options') ){
    +            $menu_root = "options-general.php";
    +        } else if ( current_user_can('publish_posts') ){
    +            $menu_root = "admin.php";
    +        }
    
     	if ( isset($_POST['clearcache']) )
     	{
    @@ -29,7 +34,8 @@
     	?>
    
     		<div class="tablenav top">
    -			<form enctype="multipart/form-data" method="POST" style="float:left; margin:5px 20px 0 0" action="/wp-admin/options-general.php?page=WP-GPX-Maps">
    +<?php
    +            echo '<form enctype="multipart/form-data" method="POST" style="float:left; margin:5px 20px 0 0" action="' . get_bloginfo('wpurl') . '/wp-admin/' . $menu_root . '?page=WP-GPX-Maps">'; ?>
     				Choose a file to upload: <input name="uploadedfile[]" type="file" onchange="submitgpx(this);" multiple />
     				<?php
     					if ( isset($_FILES['uploadedfile']) )
    
    Thread Starter wildcomputations

    (@wildcomputations)

    P.S. I’ve temporarily modified scripts.js on my installation to always location.reload(true); and that makes Chrome behave correctly.

Viewing 2 replies - 1 through 2 (of 2 total)