What’s the correct way to add capabilites to user roles?

A third-party plugin adds the capability ‘edit_booked_appointments’. I’d like to assign this capability to the already existing user role ‘editor’. I created the following function in my child theme:

function add_booking_role_to_editor() {     $  role = get_role( 'editor' );      $  role->add_cap( 'edit_booked_appointments', true );  }  add_action( 'init', 'add_booking_role_to_editor'); 

As far as I understand the whole topic, user roles get written to the database so there is no need to hook this function into the ‘init’ action. What would be the correct way to do this? Is there a way to fire this once, after the corresponding plugin has been activated? I tried it with the action ‘plugins_loaded’ but that did not work at all.

What is the most unique data identifier for a phone user that cannot be repeated?

I’m currently developing an android (and probably iOS in the future) application for my company.

I was wondering what is the most unique data identifier to authenticate the users. A data that cannot be repeated through users.

For example:

Email? That user can log in with another phone using the email and password

Phone number? Could be the most unique one but it would required to verify the phone and I will have to setup a SMS validation service like WhatsApp

IMEI? It pretty much validates the unique phone but it can be spoofed or replaced. Although I don’t know if the application required permissions for this.

EDIT: Maybe a mix of all this methods?

My main goal is to save this data as a database and make it the primary key of it and with this know exactly who’s the user that it’s really using the company web services.

I hope you guys can help me.

Thank you.

Define user variables to use in a SQL that has an “in” statement in MySql Workbench

I am trying to use defined variables in MySql Workbench I am using version 6.3 of Workbench I am trying to run ad hoc queries that can have a value or multiple values:

If I have a single value, the query runs ok set @Zdept_Id=”548″ and then Select * from employees where dept_Id in (@ZDept_Id)

but if I want to execute this for multiple departments, the query only returns values for the first number

set @Zdept_Id=”548,221,1973,905″ and then Select * from employees where dept_Id in (@ZDept_Id)

Dept_Id is an integer.

Thanks

PS. These are reports that I run once a month, so automating them is not an option due to cost/benefit.

How to sort ints with user input?

I am trying to sort in ascending or descending order with user input however its telling me about a syntax error that i have no idea about. This is the code that I have.

N = [10, 2, 1, 8, 5, 7, 6, 4, 3] A = int(input(“Ascending or Desending order, press 1 for acsending or 2 for descending order”) if (number == 1): N.sort() print(N) elif (number == 2): N.sort(reverse = True) print(N) else: print(“Sorry, but there is no sorting pattern”)

What user agent does Amazon WorkMail use? [closed]

I recently had a spike of clicks on my newsletter, which is sent with tls encryption, but most of them seems to originate from ec2 instances with this user agent : “Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36”.

Can anyone advise as to the reason for it ? (the subscribers are not that tech-savy)

How did Stuxnet prevent the user from seeing the malicious files on a USB stick?

From what I can tell there were two main TMP files present on the infected USB stick. The smaller of the two would run first and hook various functions related to viewing files so as to hide the LNK and TMP files.

While this was happening would it not raise suspicions? Someone would view the USB stick, see the six files and then they would just disappear?