I’m a total newbie to wp, but I have some php experience. What I’m trying to achieve is to change the recipient’s email address in contact-form-7 based on a user_id that’s provided in the initial call to index.php in the url. I set up the session in wp-config, and if I make any reference to the session variable in any of the template sites (i.e header) it works fine. However, when I’m trying to change the recipient’s address in the plugin’s source code using the session variable, it doesn’t work.
This is the mod that I added to the compose_mail function in the classes.php file:
$userinfo = get_userdata($_SESSION[‘user_id’]);
$recipient = $userinfo->user_email;
Any guidance would be much appreciated. Thank you!
PS I can’t use the form itself to capture the new recipient address, because the person submitting the form won’t know who the email goes to
- The topic ‘How to use session in plugins’ is closed to new replies.