The MU forums have moved to WordPress.org

LeagueManager Plugin Fixes (7 posts)

  1. chinocharles
    Member
    Posted 14 years ago #

    OK, So I'm using the LeagueManager plugin for a local sports site and I am having a little bit of an issue making it work correctly. Two things.

    One, the plugin isn't generating proper thumbnails. I could just batch resize them but that shouldn't be necessary. I have been using the get_the_image plugin successfully so I was just going to replace whatever thumbnail generator it uses out of the box (probably timthumb) with that, but I can't find the code! Nothing in the plugins folder or the mu-plugins folder. Where would I find the code for the plugin?

    Two, there is a javascript button that cycles through the different games in the database that doesn't work with WPMU but did with WP. I'm probably on my own on that one, but that isn't the end of the world. The big one is the first one.

    Thanks!

  2. cafespain
    Member
    Posted 14 years ago #

    Maybe let us know what the plugin is and how to find it online?

  3. chinocharles
    Member
    Posted 14 years ago #

    Sure, sorry about that.

    http://wordpress.org/extend/plugins/leaguemanager/

    It gives you an interface in the backend to have sports and then add teams, matches and seasons within those sports. The teams include a thumbnail image, and then it automatically spits all of this information out on the sidebar in the form of a widget with a javascript button to cycle through the matches. (Either the last matches w/ scores, the matches coming up or a combination of the two) I know this works well in regular old Wordpress but I'm having a bit of trouble making it work in WPMU.

  4. chinocharles
    Member
    Posted 14 years ago #

    I also just alerted the plugin author to this thread in hopes of resolving some of these issues.

  5. shawnkltucker
    Member
    Posted 14 years ago #

    The LeagueManager plugin is not geared towards WPMU.
    But I was able to get it working by making the following changes.

    I am using

    • Wordpress MU 2.8.4
    • LeagueManager 3.4 RC2

    The main problems with this plugin have to do with locating the upload directory for a given league, and then locating the images that are uploaded to that directory.

    So... do the following,

    In admin.php, modify the addLeague function to automatically set the path to the blogs personal directory.

    function addLeague( $title )
    	{
    	global $wpdb;
    	global $blog_id;
    	$settings = array( 'upload_dir' =>  'wp-content/blogs.dir/'.$blog_id.'/files/leaguemanager',
            ...
            ...
            }

    Then remove the ability to modify the path to the upload directory in the admin settings page, settings.php. This isn't something you want your blog users to do anyway.

    //Approximately Line 115 of settings.php
    <!-- This should not be configurable in a multiuser site.
    	<tr valign"top">
    	  <th scope="row"><label for="upload_dir"><?php _e( 'Upload Directory', 'leaguemanager' ) ?></label>
              </th>
    	   <td><input type="text" size="40" name="settings[upload_dir]" id="upload_dir" value="<?php echo $league->upload_dir ?>" /></td>
    	</tr>
    -->

    The next problem to tackle is the referencing of the image and thumbnail paths. I found the code for this to be quite odd, so it's significantly different.

    You need to modify core.php, specifically the getImagePath and getThumbnailPath functions like so,

    function getThumbnailPath( $file )
            {
    		$league = $this->getCurrentLeague();
    		if ($file != false)
    		{
    		return ABSPATH . $league->upload_dir . '/' . 'thumb_'.basename($file);
    		}
    		return false;
    	}
    function getImagePath( $file = false )
    	{
    		$league = $this->getCurrentLeague();
    		if ( $file ) {
    		     return ABSPATH . $league->upload_dir . '/' . basename($file);
    		}
    		 else
    		    {
    			 return ABSPATH . $league->upload_dir;
    		    }
    	}

    I also changed line 377 in upgrade.php for good measure.

    $settings['upload_dir'] = 'wp-content/blogs.dir/'.$blog_id.'/files/leaguemanager';

    It's working so far for me, but if anyone has any more info on necessary modifications to this plugin for WPMU compatibility , I would love to know.

    -Shawn Tucker

  6. shawnkltucker
    Member
    Posted 14 years ago #

    Some other things to note on changes are,

    You explicitly need to set the $settings['upload_dir'] in the settings.php file on an update.

    You will also need to assign a unique filename on an image upload. This just helps prevent problems in the future.

  7. shawnkltucker
    Member
    Posted 14 years ago #

    I also noticed that the old image wasn't getting deleted when you uploaded a new one. You'll need to fix that too.

About this Topic

  • Started 14 years ago by chinocharles
  • Latest reply from shawnkltucker