Multisite support
-
Enabling the plugin network wide gives failed sql queries. Also, it would be nice to have shortcodes network wide.
Maybe you can take a look at this plugin code:
http://wordpress.org/plugins/shortcode-exec-php/
-
Hello natostanco,
Thank you for bringing this to my attention, and I apologize for the delay in response. I’ve been extremely busy over the last week and haven’t had the time to completely investigate this yet.
I anticipate being able to devote the necessary time to fix this over the next week and a half. Hopefully, it won’t take long and I’ll have it patched in a few days.
Again, sorry for the delay, and I will let you know if and when I complete the fix.
Hello again!
I released an update a few minutes ago that should address your problems and concerns. The current version with your fix should be v2.0.5. Any version earlier than this will still have problems.
This update includes lots of love for multisite users. First, it works ;P. Second, you can now create network wide shortcodes, as you mentioned, and much more.
If you’re willing to give the plugin another shot, you can find a brief explanation of how it handles multisite here: http://adblockingdetector.jtmorris.net/using-ad-blocking-detector-multisite/.
I don’t have much experience with managing production multisite websites, so if you have any ideas or suggestions, or you find a problem, please let me know!
Sorry it took so long.
Neat, I had a couple of codes that got deleted with the upgrade but no big deal.
returning here, I started using the plugin again, network codes do not work for me, they get listed in the single site shortcodes list, but they do not get detected on the front end.
Secondly I think there are a couple of issues with shortcode implementation here, well not really issues but more like way to improve them:
1 – Shortcodes building should be done on the fly, instead of having a dashboard to manage them, being able to just write a shortcode in a text widget or wherever else you want to put them and just execute them would be very practical.
A few examples of implementations would be:
a)[ADB not_blocked="ad_code_goes_here" blocked="alternative_code_goes_here"]
b)[ADB not_blocked="true"]ad_code_goes_here[/ADB][ADB blocked="true"]alternative_code_goes_here[/ADB]2 -The type of shortcodes just mentioned would useful to wrap all the stuff you want around them like php or js. Yet, they could be very long and messy at sight and this is why the option for storing shortcodes in IDs is fine for who wants cleaner and compact shortcodes, and for this reason you should store ids under the hood and allow users to call shortcodes by labels, because they are easier to remember, therefore people don’t have to go look at the shortcode building dashboard to find out what a shortcode does.
Long reply forthcoming. I’ve broken it up into sections for readability.
Network Shortcodes
=====================================
Can you elaborate more on what precisely is not working regarding network wide shortcodes on the front end? Everything works as intended on my local testing sites and one of my soon to be production sites. If you give me a little more detail (e.g. “Nothing shows up where the shortcode is inserted.”, “An error message is given.”, “Ad block detection doesn’t work for network shortcodes.”, et cetera), I can look into the problem more deeply. But, as it’s working for me, I don’t know where to start looking.On The Fly Shortcodes
=========================================
That is an interesting idea that I hadn’t thought of. I will strategize about how I could do that. However, right away, there are a few technical problems I foresee (I’ve elaborated on the biggest offenders below if you’re interested, if not, skip to the last paragraph in this section.).Most, but not all, of the problems boil down to the WordPress editor. The absolute worst decision I’ve made with this plugin is using WordPress’ WYSIWYG editor in the dashboard, and has been the cause of most of the most difficult to resolve bugs, and breakage after WordPress updates. And that’s when I have full control over its appearance and behavior. There is a lot of brute-forcing going on behind the scenes to make the dashboard work correctly. Every time WordPress gets an update, I nearly have a panic attack for fear they’ve changed the editor’s behavior yet again (an exaggeration, but not by much).
Depending on the post editor, which I do not control entirely and can not brute-force, will cause a great deal of mayhem.
One problem with it is that the editor doesn’t like code. Any JavaScript, HTML, or CSS it doesn’t create itself gets mangled. Copied and pasted ad codes will not be saved correctly unless I disable a few default behaviors of the editor (wpautop for example). Which will mess up the normal behavior of the editor. If I do disable those features and get it to where code is saved properly, when the post gets loaded the next time, it will break it then as the editor will try and turn things into HTML entities. And that’s just the default editor’s behavior. If the user has made modifications to how it works (through plugins or otherwise), it will cause other problems.
Another problem is the Visual tab. The visual tab can execute code it stumbles upon inside it when it is activated. Depending on what the user types into their shortcode, that can be both an unintended consequences security concern and can break the layout.
I can implement that shortcode methodology, but anything besides basic text and some HTML will not work consistently, and that will frustrate less technical users. Again, I will dwell on this to see if I can come up with something. There’s just a lot of tricky concerns that need addressing to make this a reality.
Calling Shortcodes By Labels
=======================================
Another good idea that I’ll think about how to safely implement. My main concern is with other languages and special characters in the label. Integers are widely supported and don’t depend on database schema, PHP versions used (for string comparison and special character handling), and how WordPress handles the form submission and pre-validation processes.Another, lesser, concern is with editing of shortcodes. The ID number cannot be changed by editing the shortcode (on purpose). The label can (also on purpose). If selection in the shortcode were done by label, and the user changes the label, the shortcode would no longer work and an error message would take its place (widgets, templates, et cetera could protentially break). It’s not a big deal for tech-savvy users who setup the site themselves and can quickly troubleshoot, but could be confusing for others.
Again, I will ruminate on this idea and see if I can make it work consistently.
BTW, is the reasoning behind this suggestion that you are doing a lot of inserting of ABD shortcodes into posts/pages/et cetera? If that is the concern, I can implement a shortcode selector in the TinyMCE editor which would allow choosing a shortcode by name (much like the sidebar widget does), and have it auto construct the shortcode with the ID (eliminating both concerns).
Before I do that, however, I need to finish the global options page I’ve been working on. Not everyone would want that shortcode selector cluttering up their editor, so I would need an enable/disable option. Unfortunately, creating that settings page would best be done alongside several other “improvements” and “fixes” and I’ve been working for months to wrap all that up. It’s driving me mad. ;p
The problem with network shortcodes is that the ID is not recognized, therefore it displays the error msg “no id” etcetc, in the single site dashboard they get listed, in the front end the IDs are not recognized.
About the editor I don’t know, not practical about those i just use plain text, maybe you should disable some sanitize features to make it more robust, I don’t know really.
Anyway I am currently using shortcode exec php plugin for network wide plugins.
This is an example of shortcode I am using with ADB:
echo do_shortcode( " [adblockingdetector noadblock=' " . $head . " ' adblock=' " . php_function() . " ' ] ");Just gotta make sure you don’t mess quotes and doublequotes and you’re fine.
I just added those 2 arguments adblock and noadblock to the shortcode and passed them to $ab and $noab disabling the db query. Works ok.
Hello, I want to put a image that i uploaded in my site on the background, is possible?
Hi Protoss,
It is possible, but as the question is unrelated to this multisite topic, I have opened up a new support thread and copied over your question there. I will respond there so that threads stay on topic.
Here’s a link to the new thread: https://wordpress.org/support/topic/change-background-image-when-blocker-detected?replies=1#post-6575237
It’s titled Change Background Image When Blocker Detected.
The topic ‘Multisite support’ is closed to new replies.