diff --git a/.github/.htaccess b/.github/.htaccess new file mode 100644 index 0000000..8d2f256 --- /dev/null +++ b/.github/.htaccess @@ -0,0 +1 @@ +deny from all diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..c55b4e3 --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,19 @@ +name: PHP Lint + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + phplint: + + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: PHP Lint + uses: michaelw90/PHP-Lint@2.1.0 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..78568eb --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.mo.php diff --git a/LICENSE b/LICENSE index 8519e70..f144cd3 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 WPUtilities +Copyright (c) 2024 WPUtilities Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 9a3d2c8..2bf64fd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # WPU Extranet +[![PHP workflow](https://github.com/WordPressUtilities/wpu_extranet/actions/workflows/php.yml/badge.svg 'PHP workflow')](https://github.com/WordPressUtilities/wpu_extranet/actions) + Simple toolbox to create an extranet or a customer account. ## Todo diff --git a/inc/index.php b/inc/index.php new file mode 100644 index 0000000..194cdb1 --- /dev/null +++ b/inc/index.php @@ -0,0 +1 @@ + $user_id, + 'user_email' => $new_email + )); + $html_return = '

' . __('Email successfully updated!', 'wpu_extranet') . '

'; + } else { + $html_return = '

' . implode('
', $errors) . '

'; + } + + return $html_return; +} + +/* HTML Form +-------------------------- */ + + +function wpu_extranet_change_email__form($args = array()) { + if (!is_array($args)) { + $args = array(); + } + if (!isset($args['before_fields'])) { + $args['before_fields'] = ''; + } + $html = ''; + + $userdata = get_userdata(get_current_user_id()); + + $settings = wpu_extranet_get_skin_settings(); + + $html .= '
'; + $html .= '

' . __('Change email', 'wpu_extranet') . '

'; + $html .= '
'; + $html .= $args['before_fields']; + $html .= ''; + $html .= '
'; + $html .= '
'; + + return $html; +} + +/* ---------------------------------------------------------- + Example code +---------------------------------------------------------- */ + +/* +$html_return_email = wpu_extranet_change_email__action(); +get_header(); +echo '

' . get_the_title() . '

'; +echo wpu_extranet_change_email__form(array( + 'before_fields' => $html_return_email +)); +get_footer(); +*/ diff --git a/inc/modules/change-password.php b/inc/modules/change-password.php index 6a3e379..d5ae31e 100644 --- a/inc/modules/change-password.php +++ b/inc/modules/change-password.php @@ -1,4 +1,5 @@ NULL,'plural-forms'=>NULL,'messages'=>['All fields are required.'=>'Tous les champs sont requis.','Invalid email.'=>'E-mail invalide.','New email is the same as the current email.'=>'Le nouvel e-mail est le même que l’e-mail actuel.','Emails do not match.'=>'Les e-mails ne sont pas identiques.','Email is already in use.'=>'L’e-mail est déjà utilisé.','Email successfully updated!'=>'L’e-mail a été mis à jour avec succès !','Change email'=>'Changer d\'adresse e-mail','Your current email'=>'Votre adresse e-mail actuelle','New email'=>'Nouvel e-mail','Confirm new email'=>'Confirmez votre nouvel e-mail','Current password is incorrect.'=>'Le mot de passe actuel est incorrect.','Passwords do not match.'=>'Les mots de passe ne correspondent pas.','Password is too short, minimum of 6 characters.'=>'Le mot de passe est trop court, minimum de 6 caractères.','Password successfully changed!'=>'Mot de passe changé avec succès !','Error:'=>'Erreur :','Change password'=>'Changer le mot de passe','Enter your current password'=>'Veuillez saisir votre mot de passe actuel','New password'=>'Nouveau mot de passe','Confirm new password'=>'Confirmer le nouveau mot de passe','Profile successfully updated!'=>'Profil mis à jour avec succès!','Infos'=>'Infos','The current avatar is generated by %s.'=>'L’avatar actuel est généré par %s.','Delete this avatar'=>'Supprimer cet avatar','Avatar'=>'Avatar','Username'=>'Nom d\'utilisateur','Email'=>'E-mail','Edit my infos'=>'Modifier mes infos','Check your email for the confirmation link.'=>'Vérifiez vos courriels pour y trouver le lien de confirmation.','Your account could not be found.'=>'Votre compte est introuvable.','Reset password failed.'=>'Échec de la réinitialisation du mot de passe.','Username or Email Address'=>'Identifiant ou adresse email','Get New Password'=>'Obtenir un nouveau mot de passe','Registration confirmation will be emailed to you.'=>'La confirmation d’inscription vous sera envoyée par courriel.','This username already exists.'=>'Ce nom d’utilisateur existe déjà.','This email is already registered.'=>'Cet e-mail est déjà enregistré.','This username contains invalid characters.'=>'Ce nom d’utilisateur contient des caractères non valides.','Registration failed.'=>'Échec de l’inscription.','Password'=>'Mot de passe','Register'=>'S\'inscrire','Log out'=>'Se déconnecter','First name'=>'Prénom','Last name'=>'Nom'],'language'=>'fr_FR','x-generator'=>'Poedit 3.4.4']; \ No newline at end of file diff --git a/lang/wpu_extranet-fr_FR.mo b/lang/wpu_extranet-fr_FR.mo index ad9f227..cab2bbb 100644 Binary files a/lang/wpu_extranet-fr_FR.mo and b/lang/wpu_extranet-fr_FR.mo differ diff --git a/lang/wpu_extranet-fr_FR.po b/lang/wpu_extranet-fr_FR.po index 93522f1..c9bc8e9 100644 --- a/lang/wpu_extranet-fr_FR.po +++ b/lang/wpu_extranet-fr_FR.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: WPU Extranet\n" -"POT-Creation-Date: 2022-08-04 13:54+0200\n" +"POT-Creation-Date: 2024-08-08 12:06+0200\n" "PO-Revision-Date: \n" "Last-Translator: Darklg \n" "Language-Team: \n" @@ -9,16 +9,52 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 3.1.1\n" +"X-Generator: Poedit 3.4.4\n" "X-Poedit-SourceCharset: UTF-8\n" "X-Poedit-Basepath: .\n" "X-Poedit-KeywordsList: __;_e\n" "X-Poedit-SearchPath-0: ../.\n" -#: .././inc/modules/change-password.php:40 +#: .././inc/modules/change-email.php:40 .././inc/modules/change-password.php:40 msgid "All fields are required." msgstr "Tous les champs sont requis." +#: .././inc/modules/change-email.php:45 +msgid "Invalid email." +msgstr "E-mail invalide." + +#: .././inc/modules/change-email.php:50 +msgid "New email is the same as the current email." +msgstr "Le nouvel e-mail est le même que l’e-mail actuel." + +#: .././inc/modules/change-email.php:55 +msgid "Emails do not match." +msgstr "Les e-mails ne sont pas identiques." + +#: .././inc/modules/change-email.php:60 +msgid "Email is already in use." +msgstr "L’e-mail est déjà utilisé." + +#: .././inc/modules/change-email.php:72 +msgid "Email successfully updated!" +msgstr "L’e-mail a été mis à jour avec succès !" + +#: .././inc/modules/change-email.php:98 .././inc/modules/change-email.php:120 +msgid "Change email" +msgstr "Changer d'adresse e-mail" + +#: .././inc/modules/change-email.php:105 +msgid "Your current email" +msgstr "Votre adresse e-mail actuelle" + +#: .././inc/modules/change-email.php:111 +msgid "New email" +msgstr "Nouvel e-mail" + +#: .././inc/modules/change-email.php:116 +msgid "Confirm new email" +msgstr "Confirmez votre nouvel e-mail" + #: .././inc/modules/change-password.php:45 msgid "Current password is incorrect." msgstr "Le mot de passe actuel est incorrect." @@ -61,32 +97,32 @@ msgstr "Confirmer le nouveau mot de passe" msgid "Profile successfully updated!" msgstr "Profil mis à jour avec succès!" -#: .././inc/modules/edit-metas.php:111 +#: .././inc/modules/edit-metas.php:115 msgid "Infos" msgstr "Infos" -#: .././inc/modules/edit-metas.php:118 +#: .././inc/modules/edit-metas.php:138 #, php-format msgid "The current avatar is generated by %s." msgstr "L’avatar actuel est généré par %s." -#: .././inc/modules/edit-metas.php:121 +#: .././inc/modules/edit-metas.php:141 msgid "Delete this avatar" msgstr "Supprimer cet avatar" -#: .././inc/modules/edit-metas.php:124 +#: .././inc/modules/edit-metas.php:144 msgid "Avatar" msgstr "Avatar" -#: .././inc/modules/edit-metas.php:133 .././inc/modules/register.php:140 +#: .././inc/modules/edit-metas.php:154 .././inc/modules/register.php:140 msgid "Username" msgstr "Nom d'utilisateur" -#: .././inc/modules/edit-metas.php:138 .././inc/modules/register.php:146 +#: .././inc/modules/edit-metas.php:159 .././inc/modules/register.php:146 msgid "Email" msgstr "E-mail" -#: .././inc/modules/edit-metas.php:151 +#: .././inc/modules/edit-metas.php:175 msgid "Edit my infos" msgstr "Modifier mes infos" diff --git a/wpu_extranet.php b/wpu_extranet.php index a9ae30b..eaa2369 100644 --- a/wpu_extranet.php +++ b/wpu_extranet.php @@ -1,33 +1,41 @@