marvinlabs / customer-area

A WordPress plugin to offer private content to your users -- MOVED TO https://gitlab.com/wp-customerarea/plugins/customer-area
https://wp-customerarea.com
GNU General Public License v2.0
32 stars 17 forks source link

Existing owner is changed on update #321

Open vpratfr opened 5 years ago

vpratfr commented 5 years ago

When user without permission to set ownership of content is updating document using front office add-on, the owner is reset to default set in options.

Instead, if an existing owner is detected, it should not be changed.

vpratfr commented 5 years ago

Endroit à modifier : src\php\core-classes\addon-edit-content-page.class.php

Ligne 179 environ

    public function get_default_owners()
    {
        $legacy_owner_type = $this->plugin->get_option($this->get_edit_slug_for_options() . self::$OPTION_DEFAULT_OWNER_TYPE);
        $owners = $this->plugin->get_option($this->get_edit_slug_for_options() . self::$OPTION_DEFAULT_OWNER);

        // Handle old style option
        if (!empty($legacy_owner_type)) {
            $owners = array($legacy_owner_type => $owners);
        }

        return $owners;
    }

Il faut que cette fonction retourne le propriétaire actuel du post actuellement modifié. Et si aucun propriétaire, elle retourne comme actuellement, le propriétaire par défaut.