llms_update_303_update_students_role()
Fix students with the bugged role “students”
Contents
Return Return
(void)
Source Source
File: includes/functions/updates/llms-functions-updates-303.php
function llms_update_303_update_students_role() { // Add the bugged role so we can remove it. // We delete it at the conclusion of the function. if ( ! get_role( 'studnet' ) ) { add_role( 'studnet', __( 'Student', 'lifterlms' ), array( 'read' => true, ) ); } $users = new WP_User_Query( array( 'number' => -1, 'role__in' => array( 'studnet' ), ) ); if ( $users->get_results() ) { foreach ( $users->get_results() as $user ) { $user->remove_role( 'studnet' ); $user->add_role( 'student' ); } } // Remove the bugged role when finished. remove_role( 'studnet' ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.0.3 | Introduced. |