codejp3
Forum Replies Created
-
Forum: Plugins
In reply to: [bbp style pack] Quotes not working with “Text Editor Only”I went ahead and took care of this. Wasn’t as simple as I was expecting, but nothing too serious.
Here’s the exact changes made:
1.) /js/bsp_quote.js
Now checks for which editor is currently visible. This handles all cases, even if both editors are active.jQuery(document).ready(function($) { $('.bsp-quote-link').click(function() { var id = $(this).attr("href").substr(1); var data = { 'action' : 'get_status_by_ajax', 'id' : id, 'security': bsp_ajax_object.quote } $.post(bsp_ajax_object.ajax_url, data, function(response) { // if tinymce editor currently visible if( $('.mce-tinymce.mce-container.mce-panel').is(':visible') ) { tinymce.get("bbp_reply_content").execCommand("mceInsertContent", false, response); } // if default text editor currently visible if( $('textarea#bbp_reply_content').is(':visible') ) { quote = response; replyTextfield = $("#bbp_reply_content"); text = replyTextfield.val(); if(jQuery.trim(text) != ''){ text += "\n\n"; } text += quote; replyTextfield.val(text); } // scroll to new_post form location.hash = "#new-post" ; }); }); });2.) /includes/generate_css.php
Now enqueues the bspstyle-quotes CSS file both ways – directly in tinymce (if active) and as a separate stylesheet (if text editor active). Also now includes the versioning timestamps for that file in case it gets enqueued as a separate stylesheet://if quotes active if ( !empty( $bsp_style_settings_quote['quote_activate'] ) ) { // determine which editor is currently being used // no settings specified, using default text editor if ( empty( $bsp_style_settings_form['Show_editorsactivate'] ) ) { $text_editor = true; $tinymce_editor = false; // settings specified, set flags based on settings value } else { switch ( $bsp_style_settings_form['Show_editorsactivate'] ) { case 0 : $text_editor = true; $tinymce_editor = false; break; case 1 : $text_editor = false; $tinymce_editor = true; break; case 2 : $text_editor = true; $tinymce_editor = true; break; } } /* add the style sheet */ $quotes_css = bsp_add_custom_editor_style(); // only if quotes css file exists if ( $quotes_css ) { // if tinymce being used if ( $tinymce_editor ) add_filter( 'mce_css', 'bsp_add_custom_editor_style' ); // if default text editor being used if ( $text_editor ) add_action( 'wp_enqueue_scripts', 'bsp_enqueue_quote_style' ); } //and enqueue the js add_action( 'wp_enqueue_scripts', 'bsp_enqueue_quote' ); } //this function creates the style sheet, generated when the quotes tab is accessed. function generate_quote_style_css() { require_once( ABSPATH . 'wp-admin/includes/file.php' ); global $bsp_css_location ; ob_start(); // Capture all output (output buffering) require ( BSP_PLUGIN_DIR . '/css/styles-quote.php' ); $css = ob_get_clean(); // Get generated CSS (output buffering) $css_filename = 'bspstyle-quotes'.( is_multisite() ? '-'.get_current_blog_id() : '' ).'.css'; update_option( 'bsp_style_quote_generation', time(), true ); if ( !empty($bsp_css_location['activate css location'] ) && !empty( $bsp_css_location['location'] ) ) { $location = $bsp_css_location['location'] ; // if it starts with '/' - remove if ( 0 === strpos( $location, '/' ) ) { $location = substr( $location, 1, strlen( $location ) ) ; } // if it doesn't end with a '/' add one if (substr( $location, strlen( $location )-1, strlen( $location ) ) !== '/' ) { $location = $location.'/' ; } $path = get_home_path(); $path = $path.'/'.$location ; file_put_contents( $path.$css_filename, $css, LOCK_EX ); // Save it } else file_put_contents( BSP_PLUGIN_DIR . '/css/'.$css_filename, $css, LOCK_EX ); // Save it } function bsp_add_custom_editor_style() { $css_filename = 'bspstyle-quotes'.( is_multisite() ? '-'.get_current_blog_id() : '' ).'.css'; if ( !empty( $bsp_css_location['activate css location'] ) && !empty( $bsp_css_location['location'] ) ) { $location = $bsp_css_location['location']; // if it starts with '/' - remove if (0 === strpos( $location, '/' ) ) { $location = substr( $location, 1, strlen( $location ) ) ; } // if it doesn't end with a '/' add one if ( substr( $location, strlen( $location )-1, strlen( $location ) ) !== '/' ) { $location = $location.'/' ; } // return custom URL location if ( file_exists( ABSPATH.'/'.$location.$css_filename ) ) { $location = home_url().'/'.$location ; return $location.$css_filename; } } else { // return default URL location if ( file_exists( plugin_dir_path( dirname( __FILE__ ) ).'css/'.$css_filename ) ) { return plugins_url( 'css/'.$css_filename, dirname( __FILE__ ) ); } } // return false, no file found return false; } function bsp_enqueue_quote_style() { wp_register_style( 'bsp_quotes', bsp_add_custom_editor_style(), array(), get_option( 'bsp_style_quote_generation', time() ) ); wp_enqueue_style( 'bsp_quotes' ); } function bsp_enqueue_quote() { wp_enqueue_script( 'bsp_quote', plugins_url('js/bsp_quote.js',dirname( __FILE__ )), array( 'jquery' ), get_option( 'bsp_version' ) ); wp_localize_script( 'bsp_quote', 'bsp_ajax_object', array( 'ajax_url' => admin_url( 'admin-ajax.php' ),'quote' => wp_create_nonce('get_id_content') ) ); }The end result is that quotes are now working regardless of which editor you have active, and if you have BOTH editors active, the quotes functionality will happen based on which editor tab is CURRENTLY ACTIVE in the reply form.
I’m including this in the 5.2.6 release. Uploading to GitHub now. Re-download with these new changes to test it out for yourself:
https://github.com/codejp3/bbp-style-pack/archive/refs/heads/proposed-v5.2.6.zipForum: Plugins
In reply to: [bbp style pack] Multisite CompatibilitySounds good!
I’m still playing around and trying to test as much as possible to find any last minute hidden issues/bugs, but so far everything is working great.
If I find any issues, I’ll patch them, update the GitHub repo and notify you as well.
Thank you for the quick reply!
I wish I could have given you more information, but no debug messages were being kicked out. It just “broke” all URLs on the page without any indication ‘why’.
Just confirming that this did fix the network admin plugins page issue.
function enqueue_feedback_scripts() { $screen = get_current_screen(); if ( isset( $screen ) && $screen->id == 'plugins' ) { if ( $hook == 'plugins.php' ) { wp_enqueue_script( 'atlt-free-feedback-script', $this->plugin_url . 'includes/Feedback/js/admin-feedback.js', array( 'jquery' ), $this->plugin_version ); wp_enqueue_style( 'cool-plugins-feedback-style', $this->plugin_url . 'includes/Feedback/css/admin-feedback.css', null, $this->plugin_version ); } } }Thank you for the temporary fix until the update is released.
Forum: Plugins
In reply to: [bbp style pack] Multisite CompatibilityNo. All of the magic for multisites is handled in /includes/generate_css.php (appends the site ID to each generated filename), and /bbp-style-pack.php activation hook function (regenerates deleted files when plugin is upgraded).
As long as the code for those is intact, nothing extra or new is needed for multisites in future releases. It was coded so that if it’s not a multisite install, those multisite-specific things get ignored and it will generate/regenerate CSS/JS files like it always has (without any site ID appended to the filename).
One thing I previously mentioned that I WANTED to do for multisites is to setup a network admin option to choose 1.) Network-Wide Settings For All Sites, or 2.) Individual Settings For Each Site. I ended up NOT doing that because there’s no clear way to code for it. The Style Pack settings can/will vary greatly largely based on the THEME a site is using. In a multisite install, each subsite can have their own theme, and quite often do. There’s no clear way to code for that, so I didn’t do it. What I chose to do personally as a workaround was utilize the already existing Import/Export Settings tabs within Style Pack. I have the styling setup on one subsite, and I just export those settings and then import them into all of the other subsites that I want to match.
If I can ever clearly visualize a way to code for “Network-Wide Global Settings” then I may add that in the future. Until the coding path for that is clear, I’m not touching it and sticking to the Import/Export Settings workaround.
Forum: Plugins
In reply to: [bbp style pack] Close forums and topics ?Nope. It will only bust the local WP cache & Cloudflare cache when you actually make a change within Style Pack that causes your CSS/JS files to be re-generated. Otherwise, whatever is currently cached by either is what gets served to end user browsers.
Furthermore, the changes I added, don’t clear the cache site-wide. They only affect Style Pack generated files, so even when the cache is busted, it should have minimal impact on lost performance.
It’s necessary in order to make sure you’re serving the latest/greatest to end users, but done so in a manner that it only happens when actually needed, and only for the specific CSS/JS files it’s needed for.
Ideally, you’ll never have to manually mess with WP cache or Cloudflare cache for reasons related to Style Pack. It’ll be automated based directly on the changes you make within the plugin.
Forum: Plugins
In reply to: [bbp style pack] Close forums and topics ?If one device is not including the custom CSS, but another device is, then it’s a device-specific browser cache issue. A way to try to get around that is to hold the “shift” key when you click the refresh button, which tells the browser to do a “hard refresh” reloading files instead of using its’ local cache.
My caching fix in the upcoming update should take care of that. It’ll bust local WP cache, bust the Cloudflare cache, and tell browsers to re-cache the files any time you change settings/regenerate the style files within Style Pack.
I know that your plugin is an add-on to Loco translate.
How does that address the issue with your plugin breaking the network admin plugins page anytime your plugin is network-activated on multisite?
Loco Translate works fine when network activated. Your plugin breaks the network admin plugins page when it’s network activated.
Here’s a demo video to drive the point home:
https://wp-multisite.local-dev.codejp3.com/temp-videos/automatic-translate-breaks-netowrk-admin-plugins-page.webmForum: Plugins
In reply to: [bbp style pack] Multisite CompatibilityOne more follow-up with the tinymce issue. I’ve narrowed it down and figured out the cause, and it actually DOES affect the current plugin 5.2.5 version and current WP 6.1.1 version as well.
Making a separate support topic about it for further discussion:
https://ww.wp.xz.cn/support/topic/quotes-not-working-with-text-editor-only/Forum: Plugins
In reply to: [bbp style pack] Multisite CompatibilityI’ll be around, and offer any support I can. For both my additions/changes, or the plugin as a whole.
Forum: Plugins
In reply to: [bbp style pack] Multisite CompatibilityI will add that if this update is “too much” for a single update, I can split it into multiple updates.
5.2.6 – Topic Count changes so those 2 plugin updates can be release at the same time.
5.2.7 – Bug Fixes
5.2.8 – Performance Tweaks
5.2.9 – Multisite Compatibility
5.3.0 – Translation Fixes
More work on my part, but easier to digest if having all of these wrapped up into a single update is “too much”. It’s your plugin. Whatever works best for you.
- This reply was modified 3 years, 4 months ago by codejp3.
Forum: Plugins
In reply to: [bbp style pack] Multisite Compatibility@robin-w – As promised, here’s proposed v5.2.6 update info.
Private GitHub Repo:
https://github.com/codejp3/bbp-style-packCurrent 5.2.5 “main” branch:
https://github.com/codejp3/bbp-style-pack/tree/mainProposed 5.2.6 branch:
https://github.com/codejp3/bbp-style-pack/tree/proposed-v5.2.6Side-by-side code comparison “pull request”:
https://github.com/codejp3/bbp-style-pack/pull/4/filesDirect Download:
https://github.com/codejp3/bbp-style-pack/archive/refs/heads/proposed-v5.2.6.zipExplanation & Demo Video:
https://wp-multisite.local-dev.codejp3.com/temp-videos/bbp-style-pack-5-2-6.webmMultisite Dev Server Account created and password reset sent to you.
GitHub Repo invitation link sent to you.
Forum: Plugins
In reply to: [bbp style pack] Close forums and topics ?New update with #15 fix included should be released within the next few days after robin has a chance to go through the update. It’s BIG, so it may take a little while until it’s released officially.
The update also includes caching enhancements to try to prevent the very issue you experienced (and quite a few others do too). Any time a new file is generated, the version number of that generated file is updated, telling all browsers to load the new file instead of using what it has cached. Should help eliminate the abundance of “it’s not working …oh wait, yeah it is, it was just a caching issue” support topics.
The update does NOT include a new option to hide the “you must be logged in to create new topics” like you also wanted to do, but I did take note and maybe it’ll be included in the future. The CSS code will hold you over until then.
Cheers
If you downloaded already…. re-download. I added machine translation files for FR, RU, and JA.
Finalizing Style Pack changes now. Should be today, and ideally both plugin updates get rolled out at the same time….after any additional testing and revisions you may want to do of course!
Forum: Plugins
In reply to: [bbp style pack] Close forums and topics ?I just tested Forum Index #15 on my test site and sure enough, the text will change, but hiding checkbox is broken. I’m working on an update to hand over to @robin-w later today and will include a fix for this. In the meantime, that css code will hold you over, and you can safely delete it once an update rolls out with #15 working again.
To hide the “you must be logged in” message:
#bbpress-forums .bbp-no-topic .bbp-template-notice { display: none; }That will hide the message, but still display the login form.
or combine them both into one:
#bbpress-forums .bbp-template-notice, #bbpress-forums .bbp-no-topic .bbp-template-notice { display: none; }Forum: Plugins
In reply to: [bbp style pack] Last update broke forum stylesI think I narrowed this one down some more.
Custom generated files get removed on plugin update. I’ve found myself having to go into BSP and re-click “save options” just to regenerate custom files after an update.
A minor inconvenience for a single site install. A total pain for multisite installs.
I added a plugin_activation hook that will automatically regenerate custom files any time the plugin is updated, for both single site installs and multisite installs.
This will be included in the update I send you later today.