• ChichipioWilson

    (@chichipiowilson)


    Hello. Thanks for the code. I don’t know if you’re still maintaining the plugin, but if you are, you might want to take a look at the getSettings() function. The 2 options you check here default to ” for a fresh install. So in order to keep using your plugin I had to modify it so ‘uploads’ defaults to the standard path if those options are empty.

    public static function getSettings()
        {
            $blogurl_settings = blogurlShortcodes::userSettings();
    
            // It's best not to touch this if / else statement
            if( '' != get_option( 'upload_url_path' ) )
            {
                // This is set in Settings > Miscellaneous > Full URL path to files
                $blogurl_settings['uploads'] = get_option( 'upload_url_path' );
            }
            else if( '' != get_option( 'upload_path' ) )
            {
                $blogurl_settings['uploads'] = $blogurl_settings['wordpress'] . '/' . get_option( 'upload_path' );
            }
            else
            	$blogurl_settings['uploads'] = $blogurl_settings['wordpress'] . '/wp-content/uploads';
    
            // To define your own upload URL path (for [blogurl uploads], comment out the line below
            // $blogurl_settings['uploads'] = 'http://yoursite.com/wp-content/uploads';
    
            return $blogurl_settings;
        }
    }

    http://wordpress.org/extend/plugins/peters-blog-url-shortcodes/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Peter

    (@pkthree)

    Thanks for bringing this up! Perhaps the code should simply be falling back to wp_upload_dir() (http://codex.wordpress.org/Function_Reference/wp_upload_dir), which has a similar purpose.

    Thread Starter ChichipioWilson

    (@chichipiowilson)

    You’re right. I’m still discovering wp functions so I sometimes tend to go with the manual solutions until someone points me in the right
    direction.
    Assuming $upload_dir = wp_upload_dir();, then $upload_dir['baseurl'] should work nicely.
    Thanks.

    Plugin Author Peter

    (@pkthree)

    Ah good. I’ve updated the plugin now to consider wp_upload_dir (and the ‘baseurl’ return element) first. Thanks again!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘upload_url_path and upload_path are empty’ is closed to new replies.