Currently I am making a WordPress plugin that will need to store an access token. I understand that it will have to be stored in a database. I've been told I can store it in a Redis database but I am concerned this will be a problem for users that don't use Redis. The alternative solution I've been thinking of is storing it in the WordPress database. Is this a better solution? Any suggestions would be greatly appreciated.
You definitely should write your plugin to store this sort of information in the WordPress mySQL instance. You are correct that most WordPress installations don't have access to Redis. To rephrase that: WordPress can't use Redis (with a very few exceptions).
You don't say much about the tokens you need to store.
If it's one per registered user, you can use the wp_usermeta table. If it's one only for the whole WordPress installation upon which your plugin is installed, you can use the wp_options table. If some of your WordPress posts/pages have their own token, you can use wp_postmeta.
If you need a whole bunch of these tokens, chosen by something besides users or posts, you may need to have your plugin create a new table in the WordPress database.
Related
I have a question about manually inputting information in a MySQL databases (specifically in meaning Woocommerce order databases). I have some orders, that I get from another database and have to input them in in a Woocommerce database, which by now I found out that it consists out of several different ones, and not from just one. The Woocommerce is a plugin in Wordpress. Does anybody have any idea on how that could be done?
Some additional information: I am working with Wordpress 4.4.2 and Woocommerce 2.5.5.
I would not try to directly insert data into woocommerce's database because this method is not really documented and would require intricate knowledge of woocommerce's database.
I would rather use woocommerce's rest api to create the orders. The documentation has examples for various programming languages. There is another bulk creation api as well, but found no examples on how exactly to use that one, since the example in the documentation is on bulk updates only.
My website mostly use Django + Mysql and sometimes Redis for some frequently access data.
My problem is how to sync data from Mysql to Redis automatically when I write data to Mysql by Django admin page.
Thank you for giving me some advice. It also will be appreciated if someone can tell me how to write data into Redis directly by Django admin page
Thank you!
What you want to achieve looks like using Redis as a cache. The pattern is:
Always look for the data in redis
If it's not in redis, get it from MySQL
and store it in Redis with an expiration date, using the expire command
Doing it like this, you have to modify you app, not the admin page. But there could be a delay between the writing of the informations in the admin page, and their availability to the clients.
You may delete the data from the Redis cache in the admin, when storing them, to ensure the newest version will always be delivered. But you will have to modify Django admin page for this.
I'm in the process of moving a Magento store into WooCommerce. The problem is that Magento and WordPress have different password authentication algorithms.
The way Magento stores the password: md5($salt.$password).':'.$salt;
The way WordPress stores the password: md5($password)
Is there a way to export existing Magento customers into WordPress and keep their passwords?
No, there isn't. As you noted, Magento stores its passwords with a salt
password:salt
Wordpress also stores its passwords with a salt — except the salt is an empty string and the same for everyone (i.e. Wordpress doesn't use a salt).
The is a security feature of Magento's hashing, and is meant to stop exactly the sort of thing you're trying to do.
In theory you could generate a rainbow hash table for each of the unique salts in the database, use this to crack your users passwords, and recreate them in Wordpress with a salt-less hashing. However, that's a non-trivial task if you're not familiar with the implementation of hashing algorithms, and would also take a significant amount of time.
The usual approach to this is to create new accounts in the new system, and then automatically email users a password reset link the first time they attempt to login (with additional messaging explaining things)
You could also look into changing Wordpress's login functionality — but that sounds like a different question.
Try this WordPress plugin. It allows to migrate customer passwords to WooCommerce. After finished the migration, just contact them and they will send you an additional plugin that allows your customers log in using their old passwords.
Plugin link: https://wordpress.org/plugins/nextcart-woocommerce-migration/
Tt works like a charm!
I am working out how to synchronize wordpress installations where both can be updated simultaneously, and both can work offline, then come online to sync.
I think the easiest way to sync posts between sites, is to include the site id in the primary key of the posts. Therefore, any post is identified by an incremental id and the id of the server location it was created from.
Is this possible to achieve with a plugin?
What dangers lie ahead if I pursue this path?
Is there a better, alternative way to achieve what I am trying to achieve?
It is possible in several ways:
- Write a stored procedure inside the first Wordpress installation's php files, that inserts the content into the other database when something is written to it. This one probably won't work offline.
- Write a function that compares the two databases at a schedule time using a simple sql query and creates a diff log. Then copies over the difference to the other database.
It depends why you need to do this, but if this works, I would recommend this solution:
- Keep one wordpress installation. Maintain one database, and connect to it from the other website to load the content. You can create your own SQL connection to it and load whatever content you need.
- Keep one wordpress installation, and use it's RSS feed to read the content and display it in whichever second website you need to do it in.
I can't imagine how a plugin would be of much help, especially keeping the databases in sync offline too. In my experience, its usually better to write your custom php scripts, rather than use a plugin so you can have a more direct control over the functionality.
Hope this helps.
This is a doozy of a question...
I am developing a new wordpress website to replace my client's massively sized blog (tens of thousands of pages). Their existing blog is built on a custom PERL blogging platform from 1992...so as you can imagine, it needs updating.
My job is to find the BEST possible way to migrate all of their existing data into a format that wordpress can understand.
The new theme is very advanced, and this job is very advanced as well. After searching for specialists, I can't seem to find anyone who specialized in this field. What would you do in this situation? Thanks!
I've done this before, it's not that hard. I approached it as a wordpress plugin. First get the plugin to connect to the old database and get it to pull the information you need. Then you can use native wordpress function to insert new users, posts, comments, etc.
I did it line by line, which isn't the most efficient approach, but it is the easiest. I used an AJAX front-end to display the conversion status and repeatedly call the converter back-end, as the actual migration took up to several hours.
If the site can't be shut down for that long while you migrate the database, you could either look at doing a proper bulk export/import, or lock old topics and migrate those over first.
My converter was for an old PHP nuke site, and due to the fact that we were using WP-United, I didn't have to worry too much about user credentials and comments. However, the code might help you get started: http://www.wp-united.com/releases/php-nuke-converter
I have done a couple of these Wordpress migrations. The theme you're using in Wordpress is really not that big a deal, most likely. Themes in Wordpress don't ordinarily impact the database structure.
The Wordpress side is easy, it's in MySQL in most cases. The place to start for you would be to determine how the data in the PERL blog is stored. If it's a custom blog solution, there probably isn't a script you can find to do the migration. Hopefully, it's in a data form that will allow you to do a data dump in a format MySQL will allow you to import using something like phpMyAdmin (a popular GUI for MySQL). At that point, you can create a MySQL statement to match up the relevant fields in your old data with those in MySQL. If you're not comfortable doing it and want an expert, the thing to do is find out how the PERL blog stores it's data and find someone who is familiar with both that format and MySQL.