ProfilePress Start Course Integration
I’ve added a few hooks into the child theme that check which profile press form is being submitted and then do some actions based on that like registering for a course, and redirecting to the first lesson of a course after registration. I tried to think of a way to not need different form ID’s and therefore have to create duplicate/similar forms for each of the login & registration pages in each language, but I couldn’t think of how to do it since the form ID is all that’s being passed to Profilepress and that’s what hook into(See idea below). I don’t think I can do it with javascript cause those variables/browser data is not going to be accessible to php. I’m sure I could do it with heavy plugin modification using ajax, but I don’t have time or energy for that. So for now I’m just going to duplicate all the forms 2 times in all the languages, and then check which form ID is being submitted, and perform the actions based on that.
UPDATE: Instead of checking for specific form ID’s the theme now checks for the text “Start Course” anywhere in the form title, if it’s there, the it will look at which page the use is on, and get start that course for them after login or registration is complete.
IDEA: I Could possibly include a hidden field in the form and add the current course ID into it when the "start course" button is clicked, and clear it if the normal register or login button is clicked, then I could simply check if that field had data and if so start the course for the user.
Hooks used:
add_action( 'pp_before_login_redirect', 'activate_course_before_login_redirect', 10, 3 );add_action( 'pp_after_registration', 'pp_redirect_after_registration', 10, 3 );Last updated
Was this helpful?