WordPress, fetching users with an exact match in a string of comma separated values in user_meta

I have data saved in user_meta -> areapref field. It is basically a string of comma delimited post IDs (e.g. 2, 37, 200, 300 etc.)

I need to check if the user has a particular ID in this field. If so… do stuff.

I can check if an ID is in areapref using LIKE. But I believe this has an issue. If one location is ID=10, and another is ID=100 – both will match with 1, or 10? Or am I misunderstanding LIKE. I fear CONTAIN would have the same issue.

I need to know how to get a list of users who have an ‘exact match’ within the areapref string? So search for ID 2, will return only 2, NOT 22, or 20, 200 etc. I’ve spent hours going through stackexchange/overflow/wp codex and cannot find an answer… though I am dense!

Here’s enough code I hope to show what I’m currently doing… any ideas greatly appreciated.

function ds_notify_new_event( $  post_ID ){ $  url = get_permalink( $  post_ID ); $  event = get_the_title( $  post_ID ); $  localeID = get_post_field( 'location_id', $  post_ID); global $  wpdb; $  locale = $  wpdb->get_var( $  wpdb->prepare( " SELECT post_id FROM {$  wpdb->prefix}em_locations WHERE ID = %d ", $  localeID ) );  $  args = array(         'role'    => 'subscriber',         'meta_query' => array(                 array( 'key' => 'areapref', 'value' => $  locale, 'compare' => 'LIKE' ),                 // just checks usr is ok with email                 array( 'key' => 'notify', 'value' => 'yes', 'compare' => '=' )              ),         'fields' => array( 'display_name', 'user_email' )     ); // retrieve users to notify about the new post $  users = get_users( $  args ); 

// do stuff with users

Plugin or standalone script for wordpress automatic generate passwords for admin users with 24h regenerate

I have clean wordpress installation with one admin user. I want some script or plugin with autogenerate passwords for WordPress’s admin and sent automatically to email notification. Is possible? Example : i have user’s admin with password ‘test’ – i want generate random passwords for this admin once at 24h and send automatically thsi fact to email.

How to model inheritance in MySQL for adding and deleting users?

I currently have a MySQL database and our ERD has inheritance for various tables. One is User which has as children: administrators, students and professors. The tables look as follow:

CREATE TABLE `Users` (   `id_number` int DEFAULT NULL,   `First_name` varchar(50) DEFAULT NULL,   `Last_name` varchar(50) DEFAULT NULL,   `User_Type` varchar(14) DEFAULT NULL ) ENGINE=InnoDB CREATE TABLE `Advisor` (   `Faculty_id` varchar(2) DEFAULT NULL,   `Student_id` varchar(5) DEFAULT NULL,   `Date_Assigned` date DEFAULT NULL ) ENGINE=InnoDB  CREATE TABLE `Faculty` (   `Faculty_id` varchar(13) DEFAULT NULL,   `Room_id` varchar(2) DEFAULT NULL,   `Faculty_Speciality` varchar(16) DEFAULT NULL,   `Faculty_Rank` int DEFAULT NULL,   `Faculty_Type` varchar(9) DEFAULT NULL,   `user_type` varchar(13) DEFAULT NULL ) ENGINE=InnoDB 

I’m aware that things such as PRIMARY KEY are missing for the ids and REFERENCES for foreign keys. Similar is found on this post How to model inheritance of two tables MySQL. However, what I want to know is when adding users how to populate both tables (parent and children)? Meaning that both tables user and student get the same information? How would this work on data that gets over 3000 students?

Healing options for non magic users

Three members of our party want to leave but one of them is a cleric who is our healer. Since we are levelling up to level 4 we could take on feats and there is the feat of Healer or of Magic Initiate, the latter allowing us to learn a first level healing spell.

What would be the best option or are there any other options to replace our healer?

How to apply discount for registered users

I have to build a learning platform where users can buy courses. I have decided to use LearnDash. But a unique scenario here is that I have to apply a 20% discount on the course price if the user registers as a member. I am using Memberpress for members’ management. A similar plugin "Conditional Discounts" is available for WooCommerce, but how can I do this for LearnDash? Any idea?