CoursePress Pro Questions

Frontend Student Dashboard at http://lineofduty.com/dashboard needs to be sorted by course name. I would like to control that with specificity. (What file(s) generate and control this virtual page). I mean, I need to know how I can modify that table that shows in the Student Dashboard virtual page.

Non-Virtual Page setup: When i tried setting up a specific page for the student "Dashboard" using shortcodes, the resulting page doesn't display a table or anything like what Im seeing in the virtual dashboard . (What file(s) are editable to control/modify the dashboard template when a shortcode is used in a non-virtual page?)

Regarding Certificates that CoursepressPro generates, what file(s) are editable that I can look at for customization? And can we get a shortcode to includes the student-grade in the certificate pdf?

  • Panos

    Hi Josh ,

    When i tried setting up a specific page for the student "Dashboard" using shortcodes, the resulting page doesn't display a table or anything like what Im seeing in the virtual dashboard

    This happened to me too. It displayed the courses list instead. Will report this as a bug to be checked. Thanks for reporting that!

    needs to be sorted by course name

    For changing the order you can add the following snippet in a mu-plugin :

    add_filter( 'shortcode_atts_course_page', function( $atts ){
    	$atts['orderby'] = 'post_title';
    	$atts['order'] = 'ASC';
    	return $atts;
    }, 20 );

    This should order by post title of the courses.

    If you need further customization we don't recommend editing core files as these changes need to be related on next plugins update, plus some function names may have changed. I am sure you know this but I need to mention it :slight_smile:

    Having that said, in order to modify the content of the dashboard you can check the file:
    coursepress/2.0/include/coursepress/data/shortcode/class-coursetemplate.php
    at method:
    CoursePress_Data_Shortcode_CourseTemplate::course_list()

    One other way would be to filter that list and use the same method which you could customize in a mu-plugin instead of modifying plugin's file. You can download file from here:
    https://gist.github.com/wpmudev-sls/352398e87cdc11e09cc5d2a7f703b33f

    After you download it you can upload to your wp-content/mu-plugins folder. If that folder doesn't exist you can simply create it.

    And can we get a shortcode to includes the student-grade in the certificate pdf?

    For that you can try the following in a mu-plugin:

    add_filter( 'coursepress_basic_certificate_vars', function( $vars ){
    
    	if(
    		//is_admin() ||
    		! isset( $_REQUEST['action'] ) || 'certificate' != $_REQUEST['action'] ||
    		! isset( $_REQUEST['course_id'] ) || ! isset( $_REQUEST['student_id'] )
    	 ){
    		return;
    	}
    	$replacement 	= '';
    	$course_id 		= intval( $_REQUEST['course_id'] );
    	$student_id 	= intval( $_REQUEST['student_id'] );
    
    	$student_progress = CoursePress_Data_Student::get_completion_data( $student_id, $course_id );
    	$final_grade = (int) CoursePress_Helper_Utility::get_array_val(
    		$student_progress,
    		'completion/average'
    	);
    
    	$vars['STUDENT_FINAL_GRADE'] = $final_grade . '%';
    
    	return $vars;
    
    }, 10 );

    Hope this helps :slight_smile:
    Cheers!

  • Panos

    Hi josh,

    Sorry for not being clear. You can read more hare about mu-plugins:
    https://premium.wpmudev.org/manuals/wpmu-manual-2/using-mu-plugins/

    They are php files, similar to plugins, only that they are executed without needing to be activated. It's a nice way of adding custom snippets, instead of functions.php (which may be overridden with theme updates).

    You can create a php file, for example custom-functions.php in your wp-content/mu-plugins folder. If that folder does not exist you can create it. Pnce you have that file created you can open to edit it. At the very top add the php opening tag <?php then you can add the snippets you need. I have mentioned a few to choose from above.

    Hope I was more clear this time, but let me know if I wasn't :slight_smile:

  • Panos

    Hi Josh ,

    Apologies for delay.

    You can create a test course and a test student. Once student completes course you can certify user and then check the certificate downloaded. The pdf you attached doesn't include name fields nor course name. I am wondering how this could happen.

    If you are still having trouble with this, could you please send admin and ftp access credentials so I could have a closer look? You can send that privately through our contact form: https://premium.wpmudev.org/contact/#i-have-a-different-question

    Send in:Subject: "Attn: Panos Lyrakis"

    - Admin login:
    Admin username
    Admin password
    Login url

    - FTP credentials
    host
    username
    password
    (and port if required)

    - link back to this thread for reference

    Thanks!

  • Josh

    Ill come back to CERTIFICATES another day Panos.

    We now have an issue where we increased our subscriber base to 4000 and Courspress Pro is causing the site to run out of memory and not load at all (when cp is enabled).
    Had to increase the memory on this site to 2gb today. That is unacceptable as the site is on the VPS by itself.

    Ill open a ticket , with Coursepress disabled, the site loads in 1.4 seconds and uses less than 300mb's of memory.