I am writing a little plugin to access the Instagram API for one account with some simple custom methods. I am curious as to how/where one should save this type of cache within the Wordpress system to be standard? (i.e. Flat file, stored in X location with other cache files.)
Standalone, I would probably use a flat file to store the cache being it will only be updated periodically and only pulls a few posts from one account. But perhaps there is a good way to use Wordpress to store this data to the DB. Either way I am not sure where this should be located within Wordpress's DB or file structure. Thank you!
Related
How can I remove one table from wordpress tables without losing wordpress site?
I mean the main tables, not the plugin tables.
For example, the comment table or post table - if I remove it from phpmyadmin and then go back to the wordpress site it shows me an error and starts repairing the database. I want to be able to delete for example the comment table or option table or the main table without losing the wordpress site. I want just the user table in the wordpress site, and want to remove the other tables.
How I can edit wordpress core files that don't check the database table or just check if the user table exists?
Thanks.
Best regards
As noted in the comments, WordPress requires all the tables that it creates, even if it doesn't seem like it is using them. You can absolutely build a system that only uses WordPress for authentication and/or authorization (I've built several), but you must accept that the other tables and all of the core code exists.
If instead you just want a secure login and session, I would encourage you to look at a library such as PHP-Auth or even better, Symfony. With the latter you can very easy get an authentication and authorization in place and then move on to your code.
However, if you are dead-set on using WordPress, and you are willing to accept that the other tables must exist even if you aren't using them, here's some code that we've used successfully on many sites. The documentation is pretty good but generally it relies on overriding WordPress's action for template_include which allows you to run whatever file/code you want. We almost always pair that code with this theme whose sole purpose is to force users to login before doing anything.
Explaining everything in there is out of scope for this site, and I would very much encourage you to not use it unless you have a very specific need that cannot be satisfied by using a third-party library.
I just got some questions, maybe some of you can answer.
The benefit by Nextcloud / Owncloud and so on is more than just uploading taking files with you and so on.
It does version the files, make them downloadable - as well secure behind.
It would be benefitial for me and most everyone who is dealing with the Question:
"How to upload documents, link them in some kind of Database (which main purpose is to operate with information) and versioning, saving, editing and so on does not need to be implemented by me / others, because it is handled by Nextcloud (in my case prefered)?"
Is there any script outside, or maybe some kind of plugin to have that benefit?
In my vision I would need:
One "Drag and Drop" Area for Documents / Pictures etc.
This should have a hidden field, which is filled with a id, with which the system can identify the file.
a onetime Link (with retention of that link by one day or so) what is generated by php (could also be a script) and generates a share Link for given id.
(not needed since now, but nice to have:) some script as in 2, where versions of some given File should be viewed.
Some solution could be:
something similar to an "iframe" for a shared link with public upload.
But Im not very happy of using IFrames... Something better would be nice.
Drag & Drop is available in the Web UI. For additional meta data, use a hook mechanism on postCreate (\OCP\Files\Node $node) within a custom app/module you'd need to deploy. For hooks, see https://docs.nextcloud.com/server/12/developer_manual/app/hooks.html.
About meta data: you don't need to store them in a database necessarily, you can also use custom WebDav properties. I wrote a blog post about it recently: https://medium.com/#mathiasconradt/how-to-assign-custom-meta-data-to-your-documents-on-nextcloud-23356cf3f926
Links with a time limit to be valid can be generated manually via Web UI. If you need it automated on upload, use the same approach as in (1): hook mechanism that listens to file creations, as part of a custom app.
at the moment, you can only restore old versions. I think you cannot diff/view them. Would require a custom app.
General info on how to write your own module / app: https://docs.nextcloud.com/server/12/developer_manual/app/index.html
I'm coding an iOS app that will share information with a wordpress site.
I had originally created a separate database with a custom data entry page in php but the client would like data entry to be done via wordpress forms for both user and admin.
So the easiest way to modify my code is just to look at the table wordpress creates and read from it directly. Is this common practice or considered a no-no?
If you're hosted on Wordpress.com, you can use the REST API documented here:
http://developer.wordpress.com/docs/api/
Otherwise, your main alternative is a third-party REST API plugin, which you could use to give your iOS app access via HTTP to whatever data and CRUD operations you choose. Here are links to a few of those:
http://wordpress.org/plugins/json-api/
http://thermal-api.com/
http://jetpack.me/support/json-api/
What you're describing is both a common practice and considered a no-no.
Just install a JSON/XML plugin in your Wordpress system and get the data from there. Best option you got in my opinion.. A separate database needs to be synchronized with the wordpress database, which is a pain in the ass..
I'm using Wordpress to manage posts in my website, but I don't want to use Wordpress template/visualization. I will use it only to manage the content and program a bit to display the content in my website.
Well, I can access the Wordpress database and load the content with my own queries. But I want to know if is viable to use Wordpress to create the bridge between my site and the Wordpress database.
Simplifying, I want to know if Wordpress provides methods like getAllPosts(), getAllComments that already manage the database connection, queries and returns some objects or I need to build this in my application.
Not native wordpress, but this is very "viable" through plugins. Example: http://code.google.com/p/wordpress-posts-api/ that claims to do what you want for posts, and you could expand to load comments as well - or you may find an exact plug in that you want with a bit of searching.
I've never actually used one written by someone else for this, but have built similar functionality to expose posts etc for XML feeds (then displayed in Flash, for example). Relatively easy if you start with someone else's plug-in and expand.
Just one word of warning - these plugins are great as the operate in the full WordPress environment, so are easy to run. The downside is that they operate in the full WordPress environment, and are therefore inefficient under high stress. If you're going to hammer it, I'd write a caching buffer first, and only make the full call to WordPress when the cache expires.
I have a PHP app, and I want some of the latest data to be extracted and display on a Joomla portal. I just couldn't figure out, can I return an XML document or what is the best way to do?
You can return these information in XML format and for example: snJxml2xslt2joomla
You can also return these information in RSS format and use the standard RSS feed module to show it in Joomla!
Or do you want to show some information FROM the Joomla site on an other site?
I'll assume that you want to display the information within a module in Joomla. If that's the case, then you can write your own database connection code (or override Joomla's) and pull the data directly out of the PHP application's database (assuming it's in a database).
If it's not, then there are several RSS/XML parsers within Joomla that will work such as the XML-RPC.
I would suggest to run a cron job to pull a data on regular basis and insert it into your local joomla portal DB. This way you have greater control over what you'd want to do with the data.
This might not be the best solution though. It also greatly depends on the kind of information you'd want to bring across. XML could be a bit more involved in terms of getting the structure right and so on.