Created
October 16, 2012 14:51
-
-
Save dklawson/3899757 to your computer and use it in GitHub Desktop.
User Avatar WP Plugin - dir patch 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/public_html/wp-content/plugins/user-avatar/timthumb-config.php b/public_html/wp-content/plugins/user-avatar/timthumb-config.php | |
index fce3b18..06ec2db 100644 | |
--- a/public_html/wp-content/plugins/user-avatar/timthumb-config.php | |
+++ b/public_html/wp-content/plugins/user-avatar/timthumb-config.php | |
@@ -8,13 +8,6 @@ if( isset($_GET['id']) && is_numeric($_GET['id']) ){ | |
} else { | |
die(); | |
} | |
-// this is the standard set up with wp-content living 3 levels down | |
-define ('WP_CONTENT_DIR', dirname(dirname(dirname(__FILE__)))); | |
-define ('AVATARS_DIR',WP_CONTENT_DIR.'/uploads/avatars/'); | |
-// cache the file inside the avatar directory | |
-// please modify this to your hearts content | |
-if(! defined('FILE_CACHE_DIRECTORY') ) define ('FILE_CACHE_DIRECTORY', AVATARS_DIR.$id.'/cache'); | |
- | |
// this are pretty much the standard settings | |
if(! defined( 'DEBUG_ON' ) ) define ('DEBUG_ON', false); // Enable debug logging to web server error log (STDERR) | |
diff --git a/public_html/wp-content/plugins/user-avatar/user-avatar.php b/public_html/wp-content/plugins/user-avatar/user-avatar.php | |
index 04ecc22..0d856cc 100644 | |
--- a/public_html/wp-content/plugins/user-avatar/user-avatar.php | |
+++ b/public_html/wp-content/plugins/user-avatar/user-avatar.php | |
@@ -115,10 +115,13 @@ function user_avatar_core_set_avatar_constants() { | |
*/ | |
function user_avatar_core_avatar_upload_path() | |
{ | |
- if( !file_exists(WP_CONTENT_DIR."/uploads/avatars/") ) | |
- mkdir(WP_CONTENT_DIR."/uploads/avatars/", 0777 ,true); | |
+ $upload_dir = wp_upload_dir(); | |
+ $avatar_dir = $upload_dir['basedir'] . "/avatars/"; | |
+ | |
+ if( !file_exists($avatar_dir) ) | |
+ mkdir($avatar_dir, 0777 ,true); | |
- return WP_CONTENT_DIR."/uploads/avatars/"; | |
+ return $avatar_dir; | |
} | |
/** | |
@@ -129,7 +132,10 @@ function user_avatar_core_avatar_upload_path() | |
*/ | |
function user_avatar_core_avatar_url() | |
{ | |
- return WP_CONTENT_URL."/uploads/avatars/"; | |
+ $upload_dir = wp_upload_dir(); | |
+ $avatar_url = $upload_dir['baseurl'] . "/avatars/"; | |
+ | |
+ return $avatar_url; | |
} | |
/** | |
@@ -591,10 +597,7 @@ function user_avatar_fetch_avatar( $args = '' ) { | |
if( $avatar_img = user_avatar_avatar_exists( $item_id ) ): | |
- $avatar_src = get_site_url()."/wp-content/uploads/avatars/".$item_id."/".$avatar_img; | |
- if(function_exists('is_subdomain_install') && !is_subdomain_install()) | |
- $avatar_src = "/wp-content/uploads/avatars/".$item_id."/".$avatar_img; | |
- | |
+ $avatar_src = USER_AVATAR_URL.$item_id."/".$avatar_img; | |
$avatar_folder_dir = USER_AVATAR_UPLOAD_PATH."{$item_id}/"; | |
$file_time = filemtime ($avatar_folder_dir."/".$avatar_img); | |
@@ -633,7 +636,7 @@ function user_avatar_delete(){ | |
$user_id = "?user_id=".$user_id; | |
user_avatar_delete_files($_GET['u']); | |
- wp_redirect(get_option('siteurl') . '/wp-admin/'.$pagenow.$user_id); | |
+ wp_redirect(admin_url($pagenow.$user_id)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment