• When an installation is installed in a sub-directory, eg /wordpress, but the blog address is configured as the root, the links in the admin interface are incorrect.

    Eg, A blog in installed at https://www.example.com/wordpress, but is configured with Blog address as https://www.example.com. Admin links should point to https://www.example.com/wordpress/wp-admin, but point to https://www.example.com/wp-admin instead, resulting in 404 errors.

    This seems to be because links are built on get_option('home'), but admin links should use get_option('siteurl'). This patch solves the issue on my installation, but may break other things.

    --- plugins/wpmp_switcher/pages/mobile_admin.php.orig	Wed Feb  3 21:48:00 2010
    +++ plugins/wpmp_switcher/pages/mobile_admin.php	Wed Feb  3 22:22:46 2010
    @@ -29,7 +29,7 @@
       wpmp_ms_mobile_admin();
    
       function wpmp_ms_mobile_admin() {
    -    $base = get_option('home');
    +    $base = get_option('siteurl');
    
         if (($user = wp_get_current_user())==null || $user->ID==0) {
           header("Location: $base/wp-login.php?redirect_to=" . urlencode($base) . "%2Fwp-admin%2F");
    @@ -75,7 +75,7 @@
       }
    
       function wpmp_msma_overview($menu) {
    -    $base = get_option('home');
    +    $base = get_option('siteurl');
         $post_count = wp_count_posts('post');
         $page_count = wp_count_posts('page');
         print "<p>";
    @@ -104,12 +104,12 @@
           $not_first = true;
         }
         print "</ul></p>";
    -    print "<p>" . sprintf(__("...or <a%s>return to the site</a>", 'wpmp'), " href='$base/'") . "</p>";
    +    print "<p>" . sprintf(__("...or <a%s>return to the site</a>", 'wpmp'), " href='" . get_option('home') . "/'") . "</p>";
         print "<p>" . __("A subset of the full WordPress administration is available through this mobile interface.", 'wpmp') . "</p>";
       }
    
       function wpmp_msma_junior($menu) {
    -    $base = get_option('home');
    +    $base = get_option('siteurl');
         print "<h3>" . __("Sorry! Permission denied...", 'wpmp') . "</h3>";
         print "<p>" . __("Only 'administrator' users can use the mobile admin panel.", 'wpmp') . "</p>";
         print "<p><a href='" . get_option('siteurl') . "$base/wp-login.php?action=logout'>" . __("Login as a different user", 'wpmp') . "</a> " . __("or", 'wpmp') . " <a href='$base/'>" . __("return to the site", 'wpmp') . "</a></p>";
    @@ -173,7 +173,7 @@
       }
    
       function wpmp_msma_post_list() {
    -    $base = get_option('home');
    +    $base = get_option('siteurl');
         wp('orderby=modified');
         if(have_posts()) {
           global $post;
    @@ -263,7 +263,7 @@
       }
    
       function wpmp_msma_edit_comment(&$comment, $full = false) {
    -    $base = get_option('home');
    +    $base = get_option('siteurl');
         $id = $comment->comment_ID;
         $content = strip_tags($comment->comment_content);
         $title = strip_tags($comment->comment_author);
    @@ -307,7 +307,7 @@
    
       function wpmp_msma_options_list() {
       	global $wpdb;
    -    $base = get_option('home');
    +    $base = get_option('siteurl');
     		$count = $wpdb->get_results("SELECT count(*) as cnt FROM $wpdb->options " . wpmp_msma_options_filter());
     		$count = ($count[0]->cnt);
         $size = 10;
    @@ -428,7 +428,7 @@
    
       function wpmp_msma_check_referer() {
    -    $base = get_option('home');
    +    $base = get_option('siteurl');
         $admin = "$base/wp-admin";
         $referer = $_SERVER['HTTP_REFERER'];
         if (substr($referer, 0, strlen($admin)) != $admin) {
    
    --- plugins/wpmp_switcher/pages/mobile.php.orig	Wed Feb  3 22:25:57 2010
    +++ plugins/wpmp_switcher/pages/mobile.php	Wed Feb  3 22:27:52 2010
    @@ -73,6 +73,9 @@
           <?php
             if($menu) {
               $base = get_option('home');
    +		  if ($title == 'Admin') {
    +		    $base = get_option('siteurl');
    +		  }
               print '<div id="menu"><ul class="breadcrumbs">';
               $page = $_SERVER['REQUEST_URI'];
               if(substr($page, -9)=="/wp-admin") {
Viewing 2 replies - 1 through 2 (of 2 total)
  • dqparker

    (@dqparker)

    Thanks for this post. I made the changes and the admin panel now works but I still can’t shrink images. Do you have the cure for this one also. I think it is related but I’m not sure which file needs to edited.

    dqparker

    (@dqparker)

    I made the same change to the wpmp_transcoder.php file and now the images are displaying. They are actually a little too small but it works now.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: WordPress Mobile Pack] Links in admin panel incorrect’ is closed to new replies.