lenart
Forum Replies Created
-
Forum: Plugins
In reply to: [WP-PageNavi] [Plugin: WP-PageNavi] multilanguageI’m not sure the same problem applies to your case but I had problems displaying texts in languages other than english. I have WPML installed and have tried several ways to get wp-pagenavi load my language files.
I looked at the source and noticed that gettext functions are not used when passing the text to output. I ended up hacking the plugin core and hope plugin authors fix this or provide better instructions.
// in core.php find $options and wrap it up in gettext function // you should repeat this for each output text you want to translate ... $pages_text = str_replace( array( "%CURRENT_PAGE%", "%TOTAL_PAGES%" ), array( number_format_i18n( $paged ), number_format_i18n( $total_pages ) ), __($options['pages_text'], 'wp-pagenavi') ); ...
Forum: Networking WordPress
In reply to: Userphoto plugin with multisite installationI changed the plugin code and got it to work with wordpress multisite installation. It still uses switch_to_blog() which isn’t advised as it takes up a lot of resources and time but for now this is what I have.
Similar discussion: Replicate photo across multisite blogs
Forum: Plugins
In reply to: [User Photo] [Plugin: User Photo] Replicate photo across multisite blogsAfter reviewing the code again I noticed the switch_to_blog() call takes quite a lot of time to process. Reading in the WPMU Codex there’s a warning not to use this function in front-end. On the regular Codex page there’s no warning though.
I think this problem needs a different solution to my approach above.
Forum: Fixing WordPress
In reply to: user photo conflicting across multiple subdomainsUser photo only supports one profile per blog. This means if you’re using wordpress network this likely won’t work because of the way wordpress handles file uploads for multiple blogs.
You can try my fork available on GitHub.
Also see this discussion about similar issue.
Forum: Plugins
In reply to: [User Photo] [Plugin: User Photo] Replicate photo across multisite blogsRather than using above code I changed the plugin so that it writes the blog ID from which the photo was uploaded and use this when retrieving the photo. I think it’s better and works even if administrators change users photos.
Here’s the idea:
if (function_exists('is_multisite') && is_multisite()) {
$blog_with_photo = get_user_meta($userID, 'userphoto_blog_id', true);
if ( !empty($blog_with_photo) ) {
switch_to_blog($blog_with_photo);
} else {
add_user_meta($userID, 'userphoto_blog_id', $blog_id, true);
// no need to switch blog as we'll use this blog as user's default
}
}
And link to working file:
https://gist.github.com/1021388#file_user_photo.phpFeel free to update the code (gist) and make it even better.
Forum: Plugins
In reply to: [User Photo] [Plugin: User Photo] Replicate photo across multisite blogsI use WP network to show the same site in different languages. I wanted to use the same code on my site but it didn’t work. There are some problems with the hack mentioned above!
Because I was uploading photos for all members they were stored under the blog I was logged in to (let’s say 3). The user’s preference might be different (let’s say 2) so this won’t work as it will try to get the photo from blog 2 instead of blog 3.
One way to solve this would be to force uploading to the same folder every time (blog 1) since it always exists. For this we’d need to use something else instead of
wp_upload_dir();
which returns the upload directory for currently active blog.Another way would be to save the blog ID in user_meta (when uploading the photo) and use it when we want to show the picture. This might be the quickest and safest way.
I hope I’ll be able to fix this and upload the updated code.