Menu

#2753 User booking reminder mail

open
nobody
None
1
2023-05-26
2023-05-09
Dennis ET
No

Hello,

we had MRBS in use years ago and now shortly again. It has developed very positively and has good functions in addition to the beautiful layout. Many thanks for this.

I could already adapt a lot to our needs. however, I fail at one thing. I would like to have mrbs write reminder mails to cancel bookings that are no longer needed and to save costs. I have found a promising approach from 2010
Here, a cron-based PHP script is used to query the database and send a mail to the booker. But due to the use of the LDAP connection and the therefore probably empty mrbs_user or mrbs_participants databases, I can't pursue the solution any further. Is it normal that the databases remain empty with ldap query?
A possible solution would be to store the email from the ldap query and then try the cron script again. I still wanted to try this, can someone here give me a hint how i could implement it or tell me if I am going in the wrong direction?
My question therefore can you fill the databases with the ldap users or is such a reminder function planned for the future?

I am grateful for any suggestion.

Thanks a lot

Discussion

  • Campbell Morrison

    The mrbs_user table is empty when you are using LDAP because all the user data is stored on the LDAP server. However, given a username you can get the user's details by calling auth()->getUser($username). This will return a User object with an email property.

     
  • Dennis ET

    Dennis ET - 2023-05-11

    Thank you for the answer and the information. I will see what I can implement and then get back to you.

     

    Last edit: Dennis ET 2023-05-11
  • Anonymous

    Anonymous - 2023-05-25

    I've tried a few things, but somehow I still can't find the solution, which is probably quite simple. the most promising approach is to read out the details as described by you with auth()->getUser($username) or session()->getCurrentUser ($username). I would now like to fill the newly created custom field email_ldap with the content [email] from the array user in the file edit_entry.php and enter it directly in a booking. However, I do not get the transfer, can you please give me here again a hint?

    Thanks a lot, regards

     

    Last edit: Campbell Morrison 2023-05-26
  • Campbell Morrison

    session()->getCurrentUser() doesn't take a parameter: it just returns the User object for the current user. Both session()->getCurrentUser() and auth()->getUser($username) return objects rather than arrays, so you'll need to access the email address as a property rather than array. For example

    $user = auth()->getUser($username);
    $email = $user->email;