lifterlms_student_dashboard( array $options = array() )
Output the LifterLMS Student Dashboard
Parameters Parameters
- $options
-
(array) (Optional) Array of options.
Default value: array()
Return Return
(void)
Source Source
File: includes/functions/llms.functions.templates.dashboard.php
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | function lifterlms_student_dashboard( $options = array () ) { $options = wp_parse_args( $options , array ( 'login_redirect' => get_permalink( llms_get_page_id( 'myaccount' ) ), ) ); /** * Fires before the student dashboard output. * * @since Unknown * * @hooked lifterlms_template_student_dashboard_wrapper_open - 10 */ do_action( 'lifterlms_before_student_dashboard' ); /** * Filters whether or not to display the student dashboard * * By default, this condition will show the dashboard to a logged in user * and the login/registration forms (as well as the password recovery flow) * to logged out users. * * The `LLMS_View_Manager` class uses this filter to modify the dashboard view * conditionally based on the requested view role. * * @since 4.16.0 * * @param bool $is_user_logged-in Whether or not the user is logged in. */ $display_dashboard = apply_filters( 'llms_display_student_dashboard' , is_user_logged_in() ); // Not displaying the dashboard (the user is not logged in), we'll show login/registration forms. if ( ! $display_dashboard ) { /** * Allow adding a notice message to be displayed in the student dashboard where `llms_print_notices()` will be invoked. * * @since unknown * * @param string $message The notice message to be displayed in the student dashboard. Default empty string. */ $message = apply_filters( 'lifterlms_my_account_message' , '' ); if ( ! empty ( $message ) ) { llms_add_notice( $message ); } global $wp ; if ( isset( $wp ->query_vars[ 'lost-password' ] ) ) { $args = array (); if ( llms_filter_input( INPUT_GET, 'reset-pass' , FILTER_SANITIZE_NUMBER_INT ) ) { $args [ 'form' ] = 'reset_password' ; $cookie = llms_parse_password_reset_cookie(); $key = '' ; $login = '' ; $fields = array (); if ( is_wp_error( $cookie ) ) { llms_add_notice( $cookie ->get_error_message(), 'error' ); } else { $fields = LLMS_Person_Handler::get_password_reset_fields( $cookie [ 'key' ], $cookie [ 'login' ] ); } $args [ 'fields' ] = $fields ; } else { $args [ 'form' ] = 'lost_password' ; $args [ 'fields' ] = LLMS_Person_Handler::get_lost_password_fields(); } llms_get_template( 'myaccount/form-lost-password.php' , $args ); } else { llms_print_notices(); llms_get_login_form( null, /** * Filter login form redirect URL * * @since unknown * * @param string $login_redirect The login redirect URL. */ apply_filters( 'llms_student_dashboard_login_redirect' , $options [ 'login_redirect' ] ) ); if ( llms_parse_bool( llms_get_open_registration_status() ) ) { llms_get_template( 'global/form-registration.php' ); } } } else { $tabs = LLMS_Student_Dashboard::get_tabs(); $current_tab = LLMS_Student_Dashboard::get_current_tab( 'slug' ); /** * Fires before the student dashboard content output. * * @since unknown * * @hooked lifterlms_template_student_dashboard_header - 10 */ do_action( 'lifterlms_before_student_dashboard_content' ); if ( isset( $tabs [ $current_tab ] ) && isset( $tabs [ $current_tab ][ 'content' ] ) && is_callable ( $tabs [ $current_tab ][ 'content' ] ) ) { call_user_func( $tabs [ $current_tab ][ 'content' ] ); } } /** * Fires after the student dashboard output. * * @since unknown * * @hooked lifterlms_template_student_dashboard_wrapper_close - 10 */ do_action( 'lifterlms_after_student_dashboard' ); } |
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
5.0.0 | During password reset, retrieve reset key and login from cookie instead of query string. Use llms_get_open_registration_status() . |
3.37.10 | Add filter llms_enable_open_registration . |
3.35.0 | unslash $_GET data. |
3.25.1 | Introduced. |