name}-{$cap}"] ) ? $_POST['role-caps']["{$role->name}-{$cap}"] : false; /* If the role doesn't have the capability and it was selected, add it. */ if ( !$role->has_cap( $cap ) && !empty( $posted_cap ) ) $role->add_cap( $cap ); /* If the role has the capability and it wasn't selected, remove it. */ elseif ( $role->has_cap( $cap ) && empty( $posted_cap ) ) $role->remove_cap( $cap ); } // End loop through existing capabilities /* If new caps were added and are in an array, we need to add them. */ if ( !empty( $_POST['new-cap'] ) && is_array( $_POST['new-cap'] ) ) { /* Loop through each new capability from the edit roles form. */ foreach ( $_POST['new-cap'] as $new_cap ) { /* Sanitize the new capability to remove any unwanted characters. */ $new_cap = sanitize_key( $new_cap ); /* Run one more check to make sure the new capability exists. Add the cap to the role. */ if ( !empty( $new_cap ) && !$role->has_cap( $new_cap ) ) $role->add_cap( $new_cap ); } // End loop through new capabilities /* If new caps are added, we need to reset the $capabilities array. */ $capabilities = members_get_capabilities(); } // End check for new capabilities } // End check for form submission ?>
' . __( 'Role updated.', 'members' ) . '