educatorplugin / ib-educator

A clean and elegant theme created to make it easy to sell online courses. Supports the Educator and the WooCommerce plugins.
GNU General Public License v2.0
6 stars 5 forks source link

User registration form when registering for a course does not output the custom user flow form #4

Closed vicskf closed 8 years ago

vicskf commented 8 years ago

I don't know if this is really an issue. I see the shortcode [ibedu_payment_page] that outputs the payment page does have an action hook in shortcode-payment.php line: 198

do_action( 'ib_educator_register_form', $errors, $post );

But I don't really know how to correctly replace the default registration form with the one used in custom user flow. Any suggestions? Thanks!

educatorplugin commented 8 years ago

This action hook allows to add a custom field to the payment form in Educator plugin. Please check this article - http://educatorplugin.com/add-custom-fields-to-the-payment-form/

vicskf commented 8 years ago

I understand with that action hook I can add custom fields to every course registration. What I really meant was to add a custom field only when trying to register for a course while not being a registered user. In other words, to add a custom field only to WordPress registration form. I know it's in Beta, but shouldn't it display the custom user flow? or should I use the 'register_form' action hook to do so?

educatorplugin commented 8 years ago

Hi, sorry for late response. If you would like to add a custom field on the course payment/registration page, you can use the documentation above. To find if the current user is registered or not you could check if the user is logged in or not. There is a WordPress function to check this: is_user_logged_in.

It's possible to do something like,

if ( is_user_logged_in() ) {
// do something if the user is logged in.
} else {
// do something else if the user is not logged in (or in other words not registered).
}

You can check the function's documentation on the WordPress website - https://developer.wordpress.org/reference/functions/is_user_logged_in/

I hope I understood the question correctly.

vicskf commented 8 years ago

Hi, Thanks for the answer. I managed to solve my problem with that approach. Anyway, I still doubt about whether it should or should not show the custom user flow when registering for a course. I'll look into it when I have time and post a new issue if I something comes up. Thanks again.