Add TOS & custom avatars to Coursepress Pro?

I'm checking out Coursepress Pro for the first time and am liking it so far. Wondering if we can add a TOS to the sign up page (WPMU's TOS plugin didn't seem to play nice and I'd rather it be built in anyway so I can use the virtual page already supplied). Also would like to be able to add instructor and student avatars that users can upload directly in their profiles. Thanks.

  • Vinod Dalvi
    • WP Unicorn

    Hi @BionicSquid,

    I hope you are well today and thanks for posting on the forum.

    Wondering if we can add a TOS to the sign up page (WPMU's TOS plugin didn't seem to play nice and I'd rather it be built in anyway so I can use the virtual page already supplied).

    It seems WPMU's TOS plugin doesn't work well with CoursePress plugin but could you please tell me specifically what problem you are facing using it?

    There is already a feature request created for this feature on the following thread and this feature may be added in future version of plugin but We don't publish ETAs to prevent disappointment if a deadline is missed(which in plugin development quite a frequent occurrence!).

    https://premium.wpmudev.org/forums/topic/course-pro-suggestion-built-in-waivertos-functionality

    Also would like to be able to add instructor and student avatars that users can upload directly in their profiles. Thanks.

    You can achieve this by using the following plugin

    https://wordpress.org/plugins/wp-user-avatar/

    And adding the following code in the functions.php file of your child theme.

    add_filter( 'get_avatar' , 'my_custom_avatar' , 1 , 5 );
    
    function my_custom_avatar( $avatar, $id_or_email, $size, $default, $alt ) {
        $user = false;
    
        if ( is_numeric( $id_or_email ) ) {
    
            $id = (int) $id_or_email;
            $user = get_user_by( 'id' , $id );
    
            } elseif ( is_object( $id_or_email ) ) {
    
                if ( ! empty( $id_or_email->user_id ) ) {
                    $id = (int) $id_or_email->user_id;
                    $user = get_user_by( 'id' , $id );
                }
    
        } else {
            $user = get_user_by( 'email', $id_or_email );
        }
    
        if ( $user && is_object( $user ) ) {
        			global $wpdb, $blog_id;
        			$wpua_meta = get_the_author_meta($wpdb->get_blog_prefix($blog_id).'user_avatar', $email);
                          $wpua_meta = ( $wpua_meta != '') ? $wpua_meta : $avatar;
                    $avatar = "<img alt='{$alt}' src='{$wpua_meta}' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' />";
    
        }
    
        return $avatar;
    }

    Best Regards,
    Vinod Dalvi

  • BionicSquid
    • Design Lord, Child of Thor

    Thanks for the info Vinod. I'll use the avatar plugin and functions code you provided.

    Re the TOS issue, it's just that the TOS only shows up on the official wp-signup.php form where it's not very useful. I tried using the shortcode and created a signup page with Coursepress's shortcode as well but just got a blank page. Even if the shortcodes worked better I'd rather use the virtual pages as they're easier to manage.

  • Vinod Dalvi
    • WP Unicorn

    Hi @BionicSquid,

    I can see our Terms of Service plugin is working on default registration page but not on coursepress registration page.

    To make it work could you please create a custom coursepress registration page having following shortcodes in it

    [signup-tos checkbox="1"]
    
    [cp_pages page="student_signup"]

    And set the created page as coursepress Sign Up Page on the following path.

    Admin Area -> Coursepress Pro -> Settings -> General -> Sign Up Page

    Best Regards,
    Vinod Dalvi

  • Vinod Dalvi
    • WP Unicorn

    Hi @BionicSquid,

    I have tested the TOS with coursepress sign up page on my test site and got it displaying fine and not blank page but it didn't work, i think it needs some custom coding to make it work.

    This feature is already moved over to the features & feedback section on the following thread so it will get developed in the future depending on number of feature requests got for it.

    https://premium.wpmudev.org/forums/topic/course-pro-suggestion-built-in-waivertos-functionality

    Did the custom Avatar code provided by me work for you?

    Regards,
    Vinod Dalvi

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.