translate_user_role example


function wp_dropdown_roles( $selected = '' ) {
    $r = '';

    $editable_roles = array_reverse( get_editable_roles() );

    foreach ( $editable_roles as $role => $details ) {
        $name = translate_user_role( $details['name'] );
        // Preselect specified role.         if ( $selected === $role ) {
            $r .= "\n\t<option selected='selected' value='" . esc_attr( $role ) . "'>$name</option>";
        } else {
            $r .= "\n\t<option value='" . esc_attr( $role ) . "'>$name</option>";
        }
    }

    echo $r;
}

'Hi, You\'ve been invited to join \'%1$s\' at %2$s with the role of %3$s. If you do not want to join this site please ignore this email. This invitation will expire in a few days. Please click the following link to activate your user account: %%s'
        ),
        $site_title,
        home_url(),
        wp_specialchars_decode( translate_user_role( $role['name'] ) )
    );
}

/** * Checks if the Authorize Application Password request is valid. * * @since 5.6.0 * @since 6.2.0 Allow insecure HTTP connections for the local environment. * * @param array $request { * The array of request data. All arguments are optional and may be empty. * * @type string $app_name The suggested name of the application. * @type string $app_id A UUID provided by the application to uniquely identify it. * @type string $success_url The URL the user will be redirected to after approving the application. * @type string $reject_url The URL the user will be redirected to after rejecting the application. * } * @param WP_User $user The user authorizing the application. * @return true|WP_Error True if the request is valid, a WP_Error object contains errors if not. */
$role_links['all'] = array(
            'url'     => $url,
            'label'   => $all_text,
            'current' => empty( $role ),
        );

        foreach ( $wp_roles->get_names() as $this_role => $name ) {
            if ( $count_users && ! isset( $avail_roles[ $this_role ] ) ) {
                continue;
            }

            $name = translate_user_role( $name );
            if ( $count_users ) {
                $name = sprintf(
                    /* translators: 1: User role name, 2: Number of users. */
                    __( '%1$s <span class="count">(%2$s)</span>' ),
                    $name,
                    number_format_i18n( $avail_roles[ $this_role ] )
                );
            }

            $role_links[ $this_role ] = array(
                'url'     => esc_url( add_query_arg( 'role', $this_role$url ) ),
                
$new_user_email['to']      = $user_details->user_email;
            $new_user_email['subject'] = sprintf(
                /* translators: Joining confirmation notification email subject. %s: Site title. */
                __( '[%s] Joining Confirmation' ),
                $site_title
            );
            $new_user_email['message'] = sprintf(
                $message,
                get_option( 'blogname' ),
                home_url(),
                wp_specialchars_decode( translate_user_role( $role['name'] ) ),
                home_url( "/newbloguser/$newuser_key/" )
            );
            $new_user_email['headers'] = '';

            /** * Filters the contents of the email sent when an existing user is invited to join the site. * * @since 5.6.0 * * @param array $new_user_email { * Used to build wp_mail(). * * @type string $to The email address of the invited user. * @type string $subject The subject of the email. * @type string $message The content of the email. * @type string $headers Headers. * } * @param int $user_id The invited user's ID. * @param array $role Array containing role information for the invited user. * @param string $newuser_key The key of the invitation. * */
Home | Imprint | This part of the site doesn't use cookies.