Reading/writing to the WordPress database using WordPress and Javascript - wordpress

I am working with a client who is using WordPress. I am not familiar with WP like I am with other frameworks. In this situation, the client wants to allow users to enter data into a form and I will create pages to display this data so it can be managed. I am thinking I need to get the user entered data saved into a table. I will then read from this table to display in another page. I need to do CRUD stuff within WP with JavaScript.
Are there plugins that will allow me to create tables within the WP database? Can I use JavaScript to read/write to them, or do I need to use PHP? I don't have access to the source code so I am doing everything via the functions.php and JS files.
Because I don't have much experience with WP, I am not sure what can be done. Thanks for any suggestions.

While it's definitely doable programmatically, I don't see much reason in recreating the wheel. Perhaps Contact Form 7 would work for you. If not, Gravity Forms can do what you need, but I believe there is a cost for that.

Related

Display products from Woocommerce in external application

I have a question about integration e.g. Woocommerce with external app.
What is the best and safe method to accomplish this goal?
Woocommerce has REST API but it might be quite vulnerable and will not show anything (products etc.) to non logged user(which is understandable).
Only safe idea that's comes to my mind is creating scripts inside WordPress and access them via AJAX but I'm worrying about performance of this method.
Maybe there is a right way that I'm not familiar with?
For that purpose, you should create an API from scratch of the wordpress database. wordpress databse has all of you need in a good way and only some php codes needed to create and execute the API. then in you app with AJAX you should access that.
this link may help you:
https://developer.okta.com/blog/2019/03/08/simple-rest-api-php
The right way is likely creating your own API if you don't want to use Woocommence's one. That means you make a plan of what you need to expose, all the routes and start building the API. I warmly recommend the book by Phil Sturgeon - Build APIs you won't hate. The author is also a co-founder of https://phptherightway.com/ so it's quite reputable.

Best Option for Wordpress Form That Updates External MySQL Database Table?

I have a Wordpress site that I need to place some forms on that when submitted the form data is updated in an external MySql database of an in-house business system.
Obviously you could customize the PHP form handler of whichever form plugin you choose, but I would imagine in most cases this is not plugin 'upgrade safe'
The other option would be do develop the form (and handler) outside Wordpress and include it in an iFrame on a Wordpress page. This is a clunky solution though in my opinion as I think iFrames should be avoided whenever possible.
IDEALLY, there's a really robust form plugin out there that has taken these things into consideration and allows modular update of external databases by specifying database credentials and what form fields you want to map to which tables and fields. Or at the least provide an option of an include file for any custom post processing of the form data that is upgrade safe.
What are the best options?

How can I edit meta fields in multiple posts without database access?

I have 150 posts in my WordPress site that have a custom field value that I need to change. I do not have database access to make these changes and I was wondering if anyone had any ideas about how to automate this process?
The change I need to make is to change to urls from absolute to relative references. I am not sure how to approach automating this and any help getting me in the right direction would be appreciated.
Thank You for your help!
This is impossible without FTP, Database Cpanel or Backend access. I'd spend your efforts on gaining access rather than a work around.
If you have administration access install wp-dbmanager it will allow database table manipulation.
Without database access you could only write a plugin to do this or export specific tables and edit them then re-upload them with the plugin above.

Wordpress to use Drupal users' credentials

I have both Wordpress and Drupal installed on two domains. I want the users that register via Wordpress to be stored in Drupal's user table. Also, any login attempts should be checked against Drupal's database.
I don't have a lot of experience with either (though I'm fairly confident in my PHP skills). I am not looking for a way to mirror the users, but to actually tell Wordpress to use Drupal's database.
I think I have to rewrite the login and register methods on Wordpress. Am I wrong? And what's the best way to do this? (what files do I need to go into)?
You wouldn't want to tell Wordpress to use Drupal's entire database as it'll just create a lot more headaches. You're better off loading something like Drupal's boostrap and attempting to call the registration functionality, this again would cause more issues.
Is there a particular reason preventing you from using one system? Migration plugins/modules exist for both CMS'.
I'm sure others have come across the same issues.
http://wordpress.org/extend/plugins/external-database-authentication/
Wordpress and Drupal SSO/Single Sign On
How to register a user to Drupal 6.x without using the API?

Wordpress - Database

New to Wordpress.
I am aware the default database to Wordpress is MySQL.
Like livejournal, i have a small requirement which allows Admin to post content and registered users on the website are allowed to post contents.
I decided to go with Wordpress, but still have not done much research on allowing registered users to post contents as like admin.
I am wondering, What database would be the best to go with ?
SQL or MySQL ?
Also, whether these contents are stored in the Database or in the form of .doc ?
The database you use doesn't matter as long as Wordpress supports it.
Comment functionality is built into Wordpress. You don't need to do any custom development to make it happen. If you only want registered users to be able to comment, you'll have to make a setting requiring users to be registered and logged in to comment. This setting is under Settings - Discussion. Comments are stored in the database.
Those are a few questions in one, so I'll answer each one of its own and paraphrase:
Can Wordpress use some other database than MySQL?
No, Wordpress only supports MySQL, so there is no choice.
Are the posts or pages/content in Wordpress stored in a database or in a .doc file
The contents of posts in Wordpress, just like in liveJournal, are actually stored in a database.
Is it possible to allow users in Wordpress to submit content that an admin can then review and publish/delete later etc.
Yes. Very much so. I believe it's built into Wordpress, you just need to have a registered user and enable the feature.

Resources