Is it possible for plugins to block System Events in Joomla? I'm currently using a url rewriting plugin and the onAfterRoute event does not seem to be called (which I need for another plugin)
Thanks
Plugins shouldn't be blocking the onAfterRoute event. However, plugins responding to that event must be published after they are installed.
Also, onAfterRoute is called after the URL is parsed and variables have been pushed into JRequest. Is this this point where you're wanting the plugin to be called, or does it need to come before onAfterRoute?
Does the other plugin (the one that uses onAfterRoute) work if you disable the URL rewriting plugin? If not, then that's not the problem.
If it does, then I suggest you look at the plugin and find the bit that targets onAfterRoute to see what it's doing. (Maybe post it here if it's not too involved.)
Related
I need to set a session value in my plugin, but session isn't started when WordPress loads my plugin and I don't want to run if (!session_id()) session_start(); manually, because other plugins might rely on setting cookies, etc and face a "headers already sent error".
Is there any hook in WordPress that runs after session is started?
If not, how do you professionals handle such situations?
Wordpress does not use session. There are actually a number of reasons for this outlined very well in this stackexchange post:
https://wordpress.stackexchange.com/questions/167585/using-sessions-to-filter-posts-bad-thing/168089#168089
I would say if you are concerned about stepping on a plugin's toes, try hooking into "plugins_loaded" and use that hook as an entry for your plugin (if you can, I know that will limit functionality somewhat). But because Wordpress does not start a session itself it is really a coin toss whether you are interrupting another plugin or not.
session_start() isn't used by Wordpress.
Have you tried wp_loaded firing after WordPress is fully loaded? Or even wp which fire after the WP object is set up (ref array).
You can have a look at this question which will give you the action run sequence.
You can also have a look at the CODEX to have a better view at all action hooks available https://codex.wordpress.org/Plugin_API/Action_Reference
I know very little of WP aside form it being a CMS geared towards (or started from) blogging, but may people have found the product capable of functioning as their sites CMS.
I was recently asked to write a PHP app to signup, (with email confirm and email notification to admin), login to make and manage orders. - so a user can register and get an email confirmation... once they are approved, they can log in, and place an order. and manage their information. There is also an admin section to manage the users and requests... ALL very straight ahead.
So I write it - and test it and everything is fine... Until the client tells me that it's going to be part of a WP site.
Problem, the client ONLY knows HTML, NOT PHP... I don't know WP.
When I upload a directory to the root - and try to run the app, I get redirect to /$url .. and a page not found displaying in the WP theme.
I have a feeling it has to do with the AUTH module I'm using... but there is a huge BIG PICTURE issue I need to conquer - how to integrate an existing PHP app into a WP site...
Q: how do I reference and use the WP emailing system?
thx - I know it's a broad question. but if someone can point me into a direction...
I have read the post regarding templates in WP and setting up a template with PHP code so it's executed... but it seems 'wrong' to have to create a template for each php page.
What your app is about ? If you got only the Auth module already coded you should only import user and password because WP does this out-of-the-box.
Wordpress can be twist up for your need but you need to do it in the WP way :).
If you want to add some functions to it check out the plugin library on wordpress.org. If you know wordpress and no plugin match your needs then the best way to go is writing your own plugin : https://codex.wordpress.org/Writing_a_Plugin
Or maybe just add your custom functions into functions.php, see https://codex.wordpress.org/Theme_Development#Functions_File
For pages, you basically have to type of it in WP : articles - i.e. blog posts - and the static pages. You can add some custom one check https://codex.wordpress.org/Post_Types
I know this answer is more a bunch of links but if you don't nothing about WP you should first learn how it works before try to hack it.
Hope it helps !
How can I disable OnePage Checkout in OpenCart?
Version 1.5.x comes with it in the default template and I would rather not use it as we want to have step by step pages and not use Ajax (speed/page views and process serves our needs better) for our customers.
It is possible to remove the one-page setup, but you'll have to do a very good work on the template (the checkout folder contains all steps). You will need personalized controllers as well. The built-in checkout page uses jQuery and Ajax to gathering all the information necessary in only one page, to send everything together when the customer clicks "confirm".
Once you don't want to use ajax, you will have to send the information from one page to the next using post requests, putting then in hidden <input>'s and/or in $_SESSION variable. Anyway, you will have some problems with the countries and locations, since OpenCart retrieves then via ajax.
Actually, some time ago I've found some templates on ThemeForest and other sites that implemented what you want, but I don't know if they are available anymore.
I would actually recommend you use something like Uber Checkout which while its still a short checkout process, is better visually as you don't have the panels that are standard in 1.5.X. If you're wanting to completely rewrite it to work like the old checkout system, well in theory it's already there, you just need to rewrite the controllers for the various steps to output full pages rather than JSON and put in validations through each step to make sure previous steps have been completed
Hey there. I'm currently learning how to write plugins for wordpress platform and I already know the basics. However, I need to invoke some function when a single article page (single.php) loads. Basically, I want to take that post ID and use it in my algorithm. I can't find any pre-defined action hook in wordpress framework so I thought I could write my very own one, but I don't know what's the mechanism for it. I read several guides on internet but still have no clue how it works. Can someone help me with this? Code examples are welcome.
You can start at the loop_start hook and check is_single() or whatever else you need to determine if you're being called from a singular page. I highly doubt you need to be creating new action hooks in the WordPress core for whatever you're doing.
Hopefully someone can help me out with this. I am upgrading a widget from the (really) old method of get_option/update_option to store/retrieve widget options to use the newer Widget API. The goal is to be able to use multiple instances of the widget, which I have successfully done, but now I'm running into a problem.
The plugin I'm working with is currently being used on somewhere between 500 and 1000 sites, most of which have some of the plugin widgets enabled. If I commit the widget upgrades to the next release of our plugin, all sites will lose the option values and placement of existing widgets. Does anyone know of a way around this?
Looks like WordPress will take care of it for you - new widgets store a _multiwidget key in the settings array, if it's not there, wp_convert_widget_settings() gets on the case.