How to edit the login/register popup on CoursePress plugin

I have this website, https://+++.no/courses/resiliens-robust-lederskap/ I would like to edit the PopUp information when the user press the Course login/registe button, I need this message there :

<p>Med å opprette en bruker eller logge inn godtar du vår Personvernerklæring.</p>

  • Adam Czajczyk

    Hello morfjord

    I hope you're well today!

    The content of that popup is dynamically generated by the plugin so you won't find it in any of the theme templates. However, there are action hooks that can be used to add up to that popup form with a simple bit of additional code.

    Since you are already using a child theme, you may add following piece of code to its "functions.php" file:

    add_action( 'coursepress_before_login_form', 'custom_cp_login_message' );
    function custom_cp_login_message() {
    	echo "
    		Some custom message/HTML comes here
    	";
    }

    The "Some custom message/HTML comes here" text should, of course, be replaced with the message that you want to use.

    This particular code will add your message to the "login" form in popup, between the "Login to your account" label and the form. Depending on where you want to put your message you might alter the action name in "add_action" line in the code above.

    For "login" form:

    coursepress_before_login_form
    coursepress_after_start_form_fields

    Any of these two will put a message between "Login to your account" label and form fields; the only difference is that the first one puts it above the HTML <form> tag and the second one puts it inside the HTML form (after the <form> tag).

    coursepress_before_end_form_fields
    coursepress_after_login_form

    Any of these two fill put the message below the form fields; again - the difference is the same, the first one will put it below form fields but inside the form (above closing </form> tag) and the second one will put it outside the form (below the closing </form> tag).

    For "signup" form:

    coursepress_before_signup_form
    coursepress_before_all_signup_fields

    Any of these two will put the message under the "Create new account" label, above the form; first one outside the form (above the <form> tag) and second one inside the form (below the <form> tag, still above form fields);

    coursepress_after_signup_first_name
    coursepress_after_signup_last_name
    coursepress_after_signup_username
    coursepress_after_signup_email
    coursepress_after_signup_password

    These would put the message right below a specific field of registration form; the actions' names specify below which field the message would go.

    coursepress_after_all_signup_fields

    This would put the message inside the form, below all the registration fields but above the "Submit" button.

    coursepress_after_submit
    coursepress_after_signup_form

    And these two would put the message at the end of the form; the first one would be inside the form (above closing </form> tag) and the second one outside the form (below closing </form> tag).

    For example, the code I shared above adds the message above the login form but we want to add another one below the fields of registration form but above the "submit" button. The code would then be:

    add_action( 'coursepress_after_all_signup_fields', 'custom_cp_register_message' );
    function custom_cp_register_message() {
    	echo "
    		Some custom message/HTML comes here
    	";
    }

    As you can notice, I have also used a different name for my function here, that's because since I'm adding two custom messages to popup, I need to make sure that function name is unique.

    I hope that makes sense :slight_smile: If you got any additional questions, let me know, please.

    Kind regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.