title = __("Login", "dagsopt"); $this->pluginname = $ns->pluginname; $this->file = $ns->file; $this->ns = $ns; } function start() { add_action('init', array(&$this, 'override_reset_password_form_redirect')); add_filter("login_redirect", array(&$this, "my_login_redirect"), 10, 3); add_filter("admin_bar_menu", array(&$this, "replace_howdy"), 25); add_filter('login_headerurl', array(&$this, 'login_headerurl')); add_filter('login_headertext', array(&$this, 'login_headertext')); add_filter('login_message', array(&$this, 'login_message')); add_action('register_form', array(&$this, 'plugin_form')); if (defined("WP_SITEURL") && defined('WP_SITEURL_CDN')) { add_filter('stylesheet_directory_uri', array(&$this, 'l_stylesheet_directory_uri')); } add_action('login_head', array(&$this, 'login_head')); add_action('user_register', array(&$this, 'plugin_user_register'), 10, 3); add_action('personal_options_update', array(&$this, 'plugin_user_register'), 10, 3); add_action('admin_enqueue_scripts', function () { /* if possible try not to queue this all over the admin by adding your settings GET page val into next if( empty( $_GET['page'] ) || "my-settings-page" !== $_GET['page'] ) { return; } */ wp_enqueue_media(); }); add_filter('upload_mimes', function ($mime_types) { $mime_types['m4a'] = 'audio/m4a'; // $mime_types['m4v'] = 'video/mp4'; // $mime_types['svg'] = 'image/svg+xml'; // Adding .svg extension $mime_types['json'] = 'application/json'; // Adding .json extension // unset( $mime_types['xls'] ); // Remove .xls extension // unset( $mime_types['xlsx'] ); // Remove .xlsx extension return $mime_types; }, 1, 1); add_action('register_post', array(&$this, 'register_post'), 10, 3); add_action('edit_user_profile', array(&$this, 'plugin_show_user_profile'), 10, 3); add_action('admin_footer', array(&$this, 'admin_footer'), 10, 3); } //add_action('show_user_profile', 'plugin_show_user_profile'); function admin_footer() { /* if possible try not to queue this all over the admin by adding your settings GET page val into next if( empty( $_GET['page'] ) || "my-settings-page" !== $_GET['page'] ) { return; } */ ?>

Proselect; ?>
get_node('my-account'); $newtitle = str_replace('Hejsa,', 'Velkommen,', $my_account->title); $wp_admin_bar->add_node(array( 'id' => 'my-account', 'title' => $newtitle, )); } function my_login_redirect($redirect_to, $request) { $redirect_url = WP_SITEURL; return $redirect_url; } function override_reset_password_form_redirect() { $action = isset($_GET['action']) ? $_GET['action'] : ''; $key = isset($_GET['key']) ? $_GET['key'] : ''; $login = isset($_GET['login']) ? $_GET['login'] : ''; if ('wp-login.php' === $GLOBALS['pagenow'] && ('resetpass' == $action)) { if (isset($_POST['wp-submit']) && $_POST['wp-submit'] == "Reset Password") { foreach ($_COOKIE as $key => $value) { if (stristr($key, "wp-resetpass")) { $v = explode(":", $value); $login = array_shift($v); } # code... } //print_r($GLOBALS); //wp_redirect(site_url('/wp-login.php') . '?action=welcome&user_login=' . $login); //exit; } } } function get_page_by_name($post_name, $output = OBJECT) { global $wpdb; $post = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_name = %s AND post_type='page'", $post_name)); if ($post) { return get_post($post, $output); } return null; } function l_stylesheet_directory_uri($t) { return str_replace(WP_SITEURL, WP_SITEURL_CDN, $t); } function login_headerurl($t) { return "/"; } function login_headertext($t) { return "Til forsiden"; } function login_message($t) { $login = ""; foreach ($_COOKIE as $key => $value) { if (stristr($key, "wp-resetpass")) { $v = explode(":", $value); $login = array_shift($v); } } $str = '

'; if (isset($_GET['action'])) { $type = isset($_GET['type']) ? $_GET['type'] : 'default'; if ($type !== "default") { //print_r($args); $page = $this->get_page_by_name($type); if ($page) { $str .= apply_filters('the_content', $page->post_content); } else { $str .= stripslashes(get_option($this->pluginname . "_login_support_splash_" . $_GET['action'], false)); } } else { $str .= stripslashes(get_option($this->pluginname . "_login_support_splash_" . $_GET['action'], false)); } } else { $str .= stripslashes(get_option($this->pluginname . "_login_support_splash", false)); } $str .= '

'; return $str; } function plugin_user_register($id) { $user_info = get_userdata($id); update_user_meta($id, 'Proselect', $_POST['r_proselect']); update_user_meta($id, 'Navn', $_POST['r_navn']); update_user_meta($id, 'Gruppe', $_POST['r_membership']); // update_usermeta($id, 'Institution' , $_POST['r_institution'] ); // update_usermeta($id, 'Fag' , $_POST['r_fag'] ); // update_usermeta($id, 'Fødselsår' , $_POST['r_alder'] ); } function register_post($login, $email, $errors) { if (empty($_POST['r_proselect'])) { $_POST['r_proselect'] = "Perspektiv"; } if (empty($_POST['r_navn'])) { $errors->add('demo_error', __('Du skal udfylde Navn')); } ; if (empty($_POST['r_membership']) || $_POST['r_membership'] === "Vælg gruppe") { $errors->add('demo_error', __('Du skal udfylde Gruppe')); } ; /* if(empty($_POST['r_fag'])){ $errors->add('demo_error',__('Du skal udfylde Fag')); }; if(empty($_POST['r_alder'])){ $errors->add('demo_error',__('Du skal udfylde Alder')); }else{ $alder = intval($_POST['r_alder']); if($alder < 1900 || $alder > 2005){ $errors->add('demo_error',__('hmmm.. din alder virker mystisk')); }; }; */ } function help() { ?>

'; echo $html; } function Option($pre) { update_option($pre . '_support_splash', $_POST[$pre . '_support_splash']); update_option($pre . '_support_splash_rp', $_POST[$pre . '_support_splash_rp']); update_option($pre . '_support_splash_welcome', $_POST[$pre . '_support_splash_welcome']); update_option($pre . '_support_splash_resetpass', $_POST[$pre . '_support_splash_resetpass']); update_option($pre . '_support_splash_register', $_POST[$pre . '_support_splash_register']); update_option($pre . '_background_image', $_POST[$pre . '_background_image']); update_option($pre . '_image', $_POST[$pre . '_image']); update_option($pre . '_styles', $_POST[$pre . '_styles']); } function admin_line($pre) { ?>
">

" />
">

" />












dagsopt['plug_login'] = $plug_login; }