Matt
Forum Replies Created
-
Forum: Plugins
In reply to: [Broadcast] Images added to target site get incorrect GUIDI don’t have the resources to test a subdomain install at the moment.
Forum: Plugins
In reply to: [Post Views Counter] Integration in theme, but following restriction settingsWas anything relating to this added in the last release?
Forum: Plugins
In reply to: [Broadcast] Images added to target site get incorrect GUIDSorry, saw this when you replied and then forgot about it. I have not tested it on a subdomain install but I don’t see how that would be any different. Still matching the whole beginning part of the site url. I have done two more posts on my own site since the modification and it’s working.
Forum: Plugins
In reply to: [Broadcast] Images added to target site get incorrect GUIDJust got done checking it out. I see you have the note at line 259, ‘
wp_upload_dir is incorrect on child sites, so we override it during broadcasting.… I’m not sure why that is and my research is mixed on confirming it. Some say broken but one ticket said it was fixed. However, when I was trying to debug wp_upload_dir within the broadcasting_upload_dir function I kept getting a server error. Possibly the function isn’t ready yet? Not sure there.However, as for the actual double site path issue, what I found was within broadcasting_upload_dir where you are substituting the path the path was already correct at this point (at least in my case). So for testing I did this:
public function broadcasting_upload_dir( $upload_dir ) { if ( ! isset( $this->__siteurl ) ) return $upload_dir; error_log('$this->__siteurl'); error_log(var_export($this->__siteurl, true)); $current_url = get_option( 'siteurl' ); error_log('$current_url--'); error_log(var_export($current_url, true)); error_log('original $upload_dir--'); error_log(var_export($upload_dir, true)); foreach( [ 'url', 'baseurl' ] as $key ) { if (substr(strtolower($upload_dir[ $key ]), 0, strlen($current_url)) != strtolower($current_url)) { $upload_dir[ $key ] = str_replace( $this->__siteurl, $current_url, $upload_dir[ $key ] ); } } error_log('altered $upload_dir--'); error_log(var_export($upload_dir, true)); return $upload_dir; }And the output was:
[23-Feb-2016 13:52:10 UTC] $this->__siteurl [23-Feb-2016 13:52:10 UTC] 'http://www.abington.k12.pa.us' [23-Feb-2016 13:52:10 UTC] $current_url-- [23-Feb-2016 13:52:10 UTC] 'http://www.abington.k12.pa.us/junior' [23-Feb-2016 13:52:10 UTC] original $upload_dir-- [23-Feb-2016 13:52:10 UTC] array ( 'path' => 'D:\\inetpub\\admin/media/sites/junior/2016/02', 'url' => 'http://www.abington.k12.pa.us/junior/media/sites/junior/2016/02', 'subdir' => '/2016/02', 'basedir' => 'D:\\inetpub\\admin/media/sites/junior', 'baseurl' => 'http://www.abington.k12.pa.us/junior/media/sites/junior', 'error' => false, ) [23-Feb-2016 13:52:10 UTC] altered $upload_dir-- [23-Feb-2016 13:52:10 UTC] array ( 'path' => 'D:\\inetpub\\admin/media/sites/junior/2016/02', 'url' => 'http://www.abington.k12.pa.us/junior/junior/media/sites/junior/2016/02', 'subdir' => '/2016/02', 'basedir' => 'D:\\inetpub\\admin/media/sites/junior', 'baseurl' => 'http://www.abington.k12.pa.us/junior/junior/media/sites/junior', 'error' => false, )So the path was already correct and then the str_replace adds a second site path in.
So I wrapped the str_replace as follows and it fixes it:
foreach( [ 'url', 'baseurl' ] as $key ) { if (substr(strtolower($upload_dir[ $key ]), 0, strlen($current_url)) != strtolower($current_url)) { $upload_dir[ $key ] = str_replace( $this->__siteurl, $current_url, $upload_dir[ $key ] ); } }Not sure if the strtolower’s are necessary but I did it out of caution.
p.s. The image itself on the target site is not being altered. I assume (without further testing) that you are not re-pointing images inserted with a different image sizes? For example, on this particular post there is an image inserted at the “medium” size. So it’s broadwaylogo-300×154.jpg. On the target site it’s left unchanged, still being “SRCed” to the root site. The target for the link itself is now properly updated to point to the target site with the correct path (after the above change).
Forum: Plugins
In reply to: [Broadcast] Images added to target site get incorrect GUIDYes, I have
define( 'UPLOADS', 'media' );in my wp-config and then I am using the ‘upload_dir’ filter as follows. Basically I am replacing the site ID with the site path and then adding in ‘posts’. Lastly just replacing the post date with todays date. I removed some stuff I do with pages and really I think the only thing relevant is what’s in theif (is_multisite()) {block but left the rest in anyway.function custom_upload_dir( $param ) { $blog_id = 1; if (is_multisite()) { $blog_id = get_current_blog_id(); if ($blog_id > 1 && substr(strrev($param['basedir']), 0, strlen('/sites/'.$blog_id)) == strrev("/sites/$blog_id")) { $network_path = network_home_url( '', 'relative' ); $site_path = home_url( '', 'relative' ); $site_path = str_ireplace($network_path, '', $site_path); $param['path'] = str_replace("/sites/$blog_id", "/sites/".$site_path, $param['path']); $param['basedir'] = str_replace("/sites/$blog_id", "/sites/".$site_path, $param['basedir']); $param['url'] = str_replace("/sites/$blog_id", "/sites/".$site_path, $param['url']); $param['baseurl'] = str_replace("/sites/$blog_id", "/sites/".$site_path, $param['baseurl']); } } if ( isset( $_REQUEST['post_id'] ) ) { $post_id = absint( $_REQUEST['post_id'] ); $post = get_post($post_id); } if (!empty($post)) { $post_type = get_post_type($post); } if (!empty($post_id) && !empty($post)) { $breadcrumbs = array(); if ($post_type == 'page') { //edited out as not applicable } elseif ($post_type == 'post') { $breadcrumbs[] = 'posts'; } if (!empty($breadcrumbs)) { $breadcrumbs = array_reverse($breadcrumbs); $path_to_insert = implode("/", $breadcrumbs); $new_path = $param['basedir'] . '\\' . $path_to_insert . substr($param['path'], strlen($param['basedir'])); $new_url = $param['baseurl'] . '/' . $path_to_insert . substr($param['url'], strlen($param['baseurl'])); $param['path'] = $new_path; $param['url'] = $new_url; } $y = ''; $m = ''; $d = ''; $time = get_the_time('Y-m-d', $post); if (strlen($time) == 10) { $y = substr( $time, 0, 4 ); $m = substr( $time, 5, 2 ); $d = substr( $time, 8, 2 ); } //replace post date with today's date if (strlen($y.$m.$d) == 8 && substr(strrev($param['path']), 0, 7) == strrev($y.'/'.$m)) { $add_to_dir = date("Y")."/".date("m"); $param['path'] = substr($param['path'], 0, strlen($param['path'])-7).$add_to_dir; $param['url'] = substr($param['url'], 0, strlen($param['url'])-7).$add_to_dir; } } return $param; } add_filter('upload_dir', 'custom_upload_dir');Forum: Plugins
In reply to: [OnePress Image Elevator] Stopped WorkingMy own hosting — running on Windows 2008 R2 / IIS 7.5
Forum: Plugins
In reply to: [OnePress Image Elevator] Stopped WorkingThey could be running outdated WP?
Forum: Plugins
In reply to: [Post Views Counter] Integration in theme, but following restriction settingsAny update to when this may get implemented? Tempted to do my own fix in the meantime but would prefer to avoid modifying the plugin.
Forum: Plugins
In reply to: [Post Views Counter] Integration in theme, but following restriction settingsI can see how that would work but I thought it would be simpler just to move the following code out of that function:
// get groups to check it faster $groups = Post_Views_Counter()->options['display']['restrict_display']['groups']; // whether to display views if ( is_user_logged_in() ) { // exclude logged in users? if ( in_array( 'users', $groups, true ) ) return $content; // exclude specific roles? elseif ( in_array( 'roles', $groups, true ) && Post_Views_Counter()->_counter->is_user_roles_excluded( Post_Views_Counter()->options['display']['restrict_display']['roles'] ) ) return $content; } // exclude guests? elseif ( in_array( 'guests', $groups, true ) ) return $content;Modify into a function as such:
function pvc_is_restricted() { // get groups to check it faster $groups = Post_Views_Counter()->options['display']['restrict_display']['groups']; // whether to display views if ( is_user_logged_in() ) { // exclude logged in users? if ( in_array( 'users', $groups, true ) ) return TRUE; // exclude specific roles? elseif ( in_array( 'roles', $groups, true ) && Post_Views_Counter()->_counter->is_user_roles_excluded( Post_Views_Counter()->options['display']['restrict_display']['roles'] ) ) return TRUE; } // exclude guests? elseif ( in_array( 'guests', $groups, true ) ) return TRUE; return FALSE; }And then update the original function:
public function add_post_views_count( $content ) { if ( is_singular() && in_array( get_post_type(), Post_Views_Counter()->options['display']['post_types_display'], true ) ) { if (pvc_is_restricted()) return $content; switch ( Post_Views_Counter()->options['display']['position'] ) { case 'after': return $content . '[post-views]'; case 'before': return '[post-views]' . $content; default: case 'manual': return $content; } } return $content; }… and then theme authors could use pvc_is_restricted() to test if the views should be displayed or not.
Forum: Plugins
In reply to: [Media Library Assistant] Media Library Link To Setting not exported/importedI updated it and I believe the default setting is working and working they way I hoped it would. I wanted only images to have a default link to of none and all others to keep the default behavior. At one point inserting links to files (e.g. PDFs) kept getting inserted with just the media title and no link (and choosing to link it manually would work but would not survive a page refresh). Not sure if that was MLA overriding it or not.
Any update here? Been a week, having the same problem. thanks
Forum: Plugins
In reply to: [Global Content Blocks] Editors cannot edit blocksI’m having this problem too. What is weird is that editors used to be able to edit the blocks. Something changed on a previous update (my editor probably hasn’t tried to change something in a while) that caused it to stop working.
Forum: Plugins
In reply to: [Media Library Assistant] Attachment Categories Missing from Add Media ModalYup, all good.
edit: Sorry, marked it as resolved. Just noticed you meant to leave it unresolved.
Forum: Plugins
In reply to: [Media Library Assistant] Attachment Categories Missing from Add Media ModalYou’ve described it to a T. I didn’t even notice the “Att. Categories” plain text field but I do see that now. And yes, searching for a file does refresh it and show the checkboxes properly.
There is no need for any img-tags, so the second test will exclude lots of potential valid uses.
Yea that’s certainly a mistake and not something I considered.
What you’re doing here is taking a very straightforward default behaviour (eg: if it’s not “lightbox” it’s not lightboxed), inverts it and end up making the problem vastly more complicated to solve.
You lost me here. The plugin automatically light boxes links without having to manually specify “lightbox.” You previously had instructed that if you want to override the lightbox, then specify anything in the rel field. This would cause the plugin to add a second rel tag which would inevitably break the jquery selector from selecting it and also what caused the problem with the latest version of WordPress (the new version of WP puts these tags in automatically now).
The fix that I outlined was to allow for the automatic light boxing of images that already have data in the rel tag. I haven’t gotten a chance to see what changes you’ve made to update the plugin but the idea of me adding support for “nolb” , “nobox” etc was to provide a way for a link NOT to get automatically lightboxed. Other plugins use similar words to prevent auto-lightboxing so it kind of makes it easier for users to switch between if they are supported.
That’s a fair point. I might look into letting WP jQuery Lightbox play nice with other users of the rel-attribute. 🙂
Again I’m confused… All users of the latest WP version are using the rel attribute now. WP automatically inserts tags in there.