I'm using the hook user_register
that writes to the variable $user_id
. I want to call this hook inside a function and pass the variable $pass
from the parent function to the function register_pass
. Once there, $pass
and user_id
will be sent to third party software as per their protocol.
The key goal is to get both $pass
and $user_id
into the same array to be sent out via SOAP.
function random_pass_save($pass){
add_action( 'user_register', 'regiser_pass')
function register_pass($user_id){
.
.
.
code that processes both the $user_id, AND $pass and sends it to another piece of software
.
.
.
}
}
Now I have done a bit of reading on this and I keep having people recommend using classes to pass variables around from add_action calls to parent functions and so on. In principle this makes sense; as I understand it, you can pretty much access the class everywhere (sort of like a global variable but a lot less precarious). However, I'm just not understanding how to apply the examples that I've seen to my situation. I haven't used classes before and so I was wondering if anyone would be kind enough to walk me through this particular application.