LLMS_Add_On::activate()

Activate an add-on


Return Return

(string|WP_Error)


Top ↑

Source Source

File: includes/models/model.llms.add-on.php

75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
public function activate() {
 
    $ret = false;
    if ( 'plugin' === $this->get( 'type' ) ) {
 
        $ret = activate_plugins( $this->get( 'update_file' ) );
 
    } elseif ( 'theme' === $this->get( 'type' ) ) {
 
        $ret = true;
        switch_theme( $this->get( 'update_file' ) );
 
    }
 
    if ( true === $ret ) {
        // Translators: %s = Add-on name.
        return sprintf( __( '%s was successfully activated.', 'lifterlms' ), $this->get( 'title' ) );
    }
 
    // Translators: %s = Add-on name.
    return new WP_Error( 'activation', sprintf( __( 'Could not activate %s.', 'lifterlms' ), $this->get( 'title' ) ) );
 
}


Top ↑

Changelog Changelog

Changelog
Version Description
3.25.0 Unknown.
3.22.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.