ajustements pour la création auto d'un slug à l'installation d'un plugin

This commit is contained in:
cy_altern 2021-04-24 01:46:05 +02:00
parent 26a5b2252b
commit 44bc7bdc5b
2 changed files with 9 additions and 8 deletions

View file

@ -27,19 +27,20 @@ function action_creer_slug_dist($slug = null, $opt = []){
'sujet' => 'Le sujet du mail',
'texte' => 'Le texte du mail',
'statut' => 'publie',
'editable' => '',
];
if ($id_slug = objet_inserer('gamumail', null, $set)) {
$set = ['slug' => 'slug_'.$id_slug];
if (
$slug !== null
and !sql_countsel('slug', 'spip_gamumails', 'slug!='.sql_quote($slug))
and !sql_countsel('slug', 'spip_gamumails', 'slug='.sql_quote($slug))
) {
$set['slug'] = $slug;
}
if (is_array($opt) and count($opt)) {
$set = array_merge($set, $opt);
$set['editable'] = '';
//$set['editable'] = '';
}
sql_updateq('spip_gamumails', $set, 'id_gamumail = '.$id_slug);
}

View file

@ -51,7 +51,7 @@ function autoriser_gamumail_modifier_nom_slug_dist($faire, $type, $id, $qui, $op
if (
intval($id)
and $editable = sql_getfetsel('editable', 'spip_gamumails', 'id_gamumail='.intval($id))
and $editable === 'oui'
and $editable !== 'non'
) {
return
autoriser('webmestre')