Connect to Ms SQL Server

You have probably figured it out by now, but just in case. I was also asked to pull data from an MS SQL server and present the data on a WordPress site. In my plugin, I stored the connection values (encrypted) as options. Here are the basics. Connection Function: public function rimsdb() { global $rimsdb; … Read more

Some weird users in database

Might be this is due to the Spam. Diable use registration under the General -> Settings if you don’t need registration on the front-end or use the captcha or other spam protection plugins. Regarding the backend -> Have you checked the wp_usermeta table if any role assigned to those users or not? Check user roles … Read more

Insert Custom Data into wpusers

Never modify the WordPress core table schemas, such as wp_users etc under any circumstances. The next time WordPress changes its tables, your custom columns will be destroyed, and all the data will be deleted. This is unavoidable. Instead, use the User Meta API and table: Retrieving a user meta: $phone = get_user_meta( $user_id, ‘phone_number’, true … Read more

Error missing MySQL extension

The solution to this will require server level changes, this isn’t something you can fix by changing PHP files. Your host needs to install the mysqli PHP extension

CreateOrUpdate in WordPress

If I’m not too badly mistaken, I don’t think there’s a similar method in $wpdb. replace, https://developer.wordpress.org/reference/classes/wpdb/#replace-row, is kind of like that, but not quite as sophisticated I believe. You probably need to build a helper function for that yourself, which wraps update, insert and a bit of logic together. Or use query method with … Read more

Match tag names with form titles

I don’t see PHP syntax errors (like unwanted brackets) in your code, but there are two WordPress-specific issues that need to be fixed: Note that wpdb::prepare() needs one or more placeholders (e.g. %s for strings and %d for numbers) and the replacement value for each placeholder. So in your case, the correct $wpdb->prepare() would be: … Read more