Come visualizzare il modulo di registrazione utente di WordPress nella parte anteriore del sito Web?
-
-
Lamigliore soluzione che hotrovato è [Theme My Loginplugin] (http://wordpress.org/extend/plugins/theme-my-login/).Best solution i found is [Theme My Login plugin](http://wordpress.org/extend/plugins/theme-my-login/).
- 0
- 2011-02-24
- wyrfel
-
questo [articolo] (http://digwp.com/2010/12/login-register-password-code/)fornisce un ottimotutorial su come crearei proprimoduli di registrazione/login/ripristinopasswordfrontend.o se stai cercando unplugin,li hogià usatie posso consigliarli: - [Ajax Login/Register] (http://wordpress.org/extend/plugins/ajax-loginregister/) - [Login With Ajax] (http://wordpress.org/extend/plugins/login-with-ajax/)this [Article](http://digwp.com/2010/12/login-register-password-code/) provides a greate tutorial on how to create you own frontend register/login/restore password forms. or if you are looking for a plugin then i've used these before and can recomend them: - [Ajax Login/Register](http://wordpress.org/extend/plugins/ajax-loginregister/) - [Login With Ajax](http://wordpress.org/extend/plugins/login-with-ajax/)
- 0
- 2011-02-24
- Bainternet
-
Cristian di Cosmolabs hapubblicato un ottimo [tutorial] (http://www.cozmoslabs.com/2010/05/31/wordpress-user-registration-template-and-custom-user-profile-fields/) confile sorgente cheti danno lapossibilità di creare unprofilo utentefront-end,modelli di accessoe registrazione.Cristian from Cosmolabs have post a great [tutorial](http://www.cozmoslabs.com/2010/05/31/wordpress-user-registration-template-and-custom-user-profile-fields/) with source files that give you the ability to build a front-end User Profile, Login and Register templates.
- 0
- 2011-02-24
- Philip
-
5 risposta
- voti
-
- 2012-01-30
TLDR; Inserisciil seguentemoduloneltuotema,gli attributi
name
eid
sonoimportanti:& lt;form action="& lt;?phpecho site_url ('wp-login.php? action=register','login_post')? >"metodo="post" > & lt;inputtype="text"name="user_login" value="Username"id="user_login" class="input"/> & lt;inputtype="text"name="user_email" value="E-Mail"id="user_email" class="input"/> & lt;?php do_action ('register_form');? > & lt;inputtype="submit" value="Register"id="register"/> & lt;/form >
Hotrovato uneccellente articolo di Tutsplus su Creare unbelmodulo di registrazione Wordpress da zero . Questo spende unbelpo 'del suotemponello stile delmodulo,ma ha la seguente sezione abbastanza semplice sul codice wordpress richiesto:
Passaggio 4. WordPress
Non c'èniente di speciale qui; abbiamo solobisogno di due snippet di WordPress, nascostonelfile wp-login.php.
Ilprimo snippet:
& lt;?phpecho site_url ('wp-login.php? action=register','login_post')? >
E:
& lt;?php do_action ('register_form');? >
Modifica: ho aggiunto lapartefinale dell'articoloper spiegare doveinseriregli snippet di codice sopra: è solo unmoduloin modo chepossaessereinseritoin qualsiasimodello dipagina obarra laterale o creare un shortcodefuori daesso. La sezioneimportante èil
form
che contienegli snippet soprae i campi obbligatoriimportanti.Il codicefinale dovrebbeessere così:
& lt; div style="display:none" > & lt;! - Registrazione - > & lt; divid="register-form" > & lt; div class="title" > & lt; h1 > Registrailtuo account & lt;/h1 > & lt; span > Registrati connoie divertiti! & lt;/span > & lt;/div > & lt;form action="& lt;?phpecho site_url ('wp-login.php? action=register','login_post')? >"metodo="post" > & lt;inputtype="text"name="user_login" value="Username"id="user_login" class="input"/> & lt;inputtype="text"name="user_email" value="E-Mail"id="user_email" class="input"/> & lt;?php do_action ('register_form');? > & lt;inputtype="submit" value="Register"id="register"/> & lt; hr/> & lt;p class="statement" > Ti verràinviata unapasswordtramitepostaelettronica. & lt;/p > & lt;/form > & lt;/div > & lt;/div > & lt;! -/Registrazione - >
Tienipresente che è moltoimportante e necessario avere
user_login
comename
e comeid
attributoneltuoinput ditesto; lo stesso valeper l'inpute-mail. Altrimenti,nonfunzionerà.E con questo,abbiamofinito!
TLDR; Put the following form into your theme, the
name
andid
attributes are important:<form action="<?php echo site_url('wp-login.php?action=register', 'login_post') ?>" method="post"> <input type="text" name="user_login" value="Username" id="user_login" class="input" /> <input type="text" name="user_email" value="E-Mail" id="user_email" class="input" /> <?php do_action('register_form'); ?> <input type="submit" value="Register" id="register" /> </form>
I found an excellent Tutsplus article on Making a fancy Wordpress Register Form from scratch. This spends quite a lot of its time on styling the form, but has the following fairly simple section on the required wordpress code:
Step 4. WordPress
There is nothing fancy here; we only require two WordPress snippets, hidden within the wp-login.php file.
The first snippet:
<?php echo site_url('wp-login.php?action=register', 'login_post') ?>
And:
<?php do_action('register_form'); ?>
Edit: I've added the extra final bit from the article to explain where to put the above code snippets - its just a form so it can go in any page template or sidebar or make a shortcode out of it. The important section is the
form
which contains the above snippets and the important required fields.The final code should look like so:
<div style="display:none"> <!-- Registration --> <div id="register-form"> <div class="title"> <h1>Register your Account</h1> <span>Sign Up with us and Enjoy!</span> </div> <form action="<?php echo site_url('wp-login.php?action=register', 'login_post') ?>" method="post"> <input type="text" name="user_login" value="Username" id="user_login" class="input" /> <input type="text" name="user_email" value="E-Mail" id="user_email" class="input" /> <?php do_action('register_form'); ?> <input type="submit" value="Register" id="register" /> <hr /> <p class="statement">A password will be e-mailed to you.</p> </form> </div> </div><!-- /Registration -->
Please note that it's really important, and necessary, to have
user_login
as aname
and as anid
attribute in your text input; the same is true for the email input. Otherwise, it won't work.And with that, we're done!
-
Ottima soluzione!Sempliceedefficiente.Ma dovemetti quegli snippet?In unabarra laterale?Questo suggerimento sembrafunzionare solo con unmodulo di registrazione ajax.Great solution ! Simple and efficient. But where do you put those snippets ? In a sidebar ? This tip seams to only work with an ajax registration form.
- 0
- 2014-03-17
- Fabien Quatravaux
-
Grazie @FabienQuatravaux,ho aggiornato la rispostaperincludere l'ultima sezione dell'articolo.Non dovrebbeesserenecessario unmodulo AJAX - è solo unmodulo POST che vieneinviato allapagina `wp-login.php? Action=register`Thanks @FabienQuatravaux, I've updated the answer to include the last section of the article. There should be no need for an AJAX form - its just a POST form that submits to the `wp-login.php?action=register` page
- 1
- 2014-03-18
- icc97
-
- 2011-02-24
questo articolo fornisce un ottimotutorial su come creareilpropriofrontend registro/accesso/ripristinai moduli dellapassword.
o se stai cercando unplugin,li hogià usatie posso consigliarli:
this Article provides a greate tutorial on how to create you own frontend register/login/restore password forms.
or if you are looking for a plugin then i've used these before and can recomend them:
-
- 2014-03-12
Qualchetempofa ho creato un sito web chemostrava unmodulo di registrazionepersonalizzato sul lato anteriore. Questo sito webnon èpiù live,maecco alcuni screenshot.
Eccoi passaggi che ho seguito:
1) Attiva lapossibilitàpertuttii visitatori di richiedere unnuovo accounttramite Impostazioni> Generali> opzione diiscrizione. Lapagina di registrazione ora appare all'URL/wp-login.php?action=register
2) Personalizzailmodulo di registrazionein modo che assomigli alfront-end deltuo sito. Questo èpiù complicatoe dipende daltema che stai utilizzando.
Ecco unesempio con ventitre:
// include theme scripts and styles on the login/registration page add_action('login_enqueue_scripts', 'twentythirteen_scripts_styles'); // remove admin style on the login/registration page add_filter( 'style_loader_tag', 'user16975_remove_admin_css', 10, 2); function user16975_remove_admin_css($tag, $handle){ if ( did_action('login_init') && ($handle == 'wp-admin' || $handle == 'buttons' || $handle == 'colors-fresh')) return ""; else return $tag; } // display front-end header and footer on the login/registration page add_action('login_footer', 'user16975_integrate_login'); function user16975_integrate_login(){ ?><div id="page" class="hfeed site"> <header id="masthead" class="site-header" role="banner"> <a class="home-link" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"> <h1 class="site-title"><?php bloginfo( 'name' ); ?></h1> <h2 class="site-description"><?php bloginfo( 'description' ); ?></h2> </a> <div id="navbar" class="navbar"> <nav id="site-navigation" class="navigation main-navigation" role="navigation"> <h3 class="menu-toggle"><?php _e( 'Menu', 'twentythirteen' ); ?></h3> <a class="screen-reader-text skip-link" href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentythirteen' ); ?>"><?php _e( 'Skip to content', 'twentythirteen' ); ?></a> <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?> <?php get_search_form(); ?> </nav><!-- #site-navigation --> </div><!-- #navbar --> </header><!-- #masthead --> <div id="main" class="site-main"> <?php get_footer(); ?> <script> // move the login form into the page main content area jQuery('#main').append(jQuery('#login')); </script> <?php }
Quindimodificailfoglio di stile deltemaperfar apparireilmodulo come desideri.
3) Puoimodificare ulteriormenteilmodulomodificandoi messaggi visualizzati:
add_filter('login_message', 'user16975_login_message'); function user16975_login_message($message){ if(strpos($message, 'register') !== false){ $message = 'custom register message'; } else { $message = 'custom login message'; } return $message; } add_action('login_form', 'user16975_login_message2'); function user16975_login_message2(){ echo 'another custom login message'; } add_action('register_form', 'user16975_tweak_form'); function user16975_tweak_form(){ echo 'another custom register message'; }
4) Se haibisogno di unmodulo di registrazionefront-end,probabilmentenon vorrai chegli utenti registrati vedanoilbackend quando accedono.
add_filter('user_has_cap', 'user16975_refine_role', 10, 3); function user16975_refine_role($allcaps, $cap, $args){ global $pagenow; $user = wp_get_current_user(); if($user->ID != 0 && $user->roles[0] == 'subscriber' && is_admin()){ // deny access to WP backend $allcaps['read'] = false; } return $allcaps; } add_action('admin_page_access_denied', 'user16975_redirect_dashbord'); function user16975_redirect_dashbord(){ wp_redirect(home_url()); die(); }
Ci sonomoltipassaggi,mail risultato è qui!
I made a website some time ago that was displaying a customized registration form on the front end side. This website is not live anymore but here are some screenshots.
Here are the steps I have followed:
1) Activate the possibility for all visitors to request a new account via Settings > General > Membership option. The registration page now appears at the URL /wp-login.php?action=register
2) Customize the registration form so that it looks like your site front-end. This is more tricky and depends on the theme you are using.
Here is an example with twentythirteen :
// include theme scripts and styles on the login/registration page add_action('login_enqueue_scripts', 'twentythirteen_scripts_styles'); // remove admin style on the login/registration page add_filter( 'style_loader_tag', 'user16975_remove_admin_css', 10, 2); function user16975_remove_admin_css($tag, $handle){ if ( did_action('login_init') && ($handle == 'wp-admin' || $handle == 'buttons' || $handle == 'colors-fresh')) return ""; else return $tag; } // display front-end header and footer on the login/registration page add_action('login_footer', 'user16975_integrate_login'); function user16975_integrate_login(){ ?><div id="page" class="hfeed site"> <header id="masthead" class="site-header" role="banner"> <a class="home-link" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"> <h1 class="site-title"><?php bloginfo( 'name' ); ?></h1> <h2 class="site-description"><?php bloginfo( 'description' ); ?></h2> </a> <div id="navbar" class="navbar"> <nav id="site-navigation" class="navigation main-navigation" role="navigation"> <h3 class="menu-toggle"><?php _e( 'Menu', 'twentythirteen' ); ?></h3> <a class="screen-reader-text skip-link" href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentythirteen' ); ?>"><?php _e( 'Skip to content', 'twentythirteen' ); ?></a> <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?> <?php get_search_form(); ?> </nav><!-- #site-navigation --> </div><!-- #navbar --> </header><!-- #masthead --> <div id="main" class="site-main"> <?php get_footer(); ?> <script> // move the login form into the page main content area jQuery('#main').append(jQuery('#login')); </script> <?php }
Then modify the theme stylesheet to make the form appear as you want.
3) You can further modify the form by tweaking the displayed messages :
add_filter('login_message', 'user16975_login_message'); function user16975_login_message($message){ if(strpos($message, 'register') !== false){ $message = 'custom register message'; } else { $message = 'custom login message'; } return $message; } add_action('login_form', 'user16975_login_message2'); function user16975_login_message2(){ echo 'another custom login message'; } add_action('register_form', 'user16975_tweak_form'); function user16975_tweak_form(){ echo 'another custom register message'; }
4) If you need a front-end registration form, you will probably don't want that registered users see the backend when they log-in.
add_filter('user_has_cap', 'user16975_refine_role', 10, 3); function user16975_refine_role($allcaps, $cap, $args){ global $pagenow; $user = wp_get_current_user(); if($user->ID != 0 && $user->roles[0] == 'subscriber' && is_admin()){ // deny access to WP backend $allcaps['read'] = false; } return $allcaps; } add_action('admin_page_access_denied', 'user16975_redirect_dashbord'); function user16975_redirect_dashbord(){ wp_redirect(home_url()); die(); }
There are lots of steps, but the result is here !
-
- 2014-08-26
Moltopiù semplice: usa unafunzione di WordPress chiamata
wp_login_form()
(pagina del Codex qui ).Puoi creareiltuopluginin modo dapoter utilizzare uno shortcodenelletuepagine:
<?php /* Plugin Name: WP Login Form Shortcode Description: Use <code>[wp_login_form]</code> to show WordPress' login form. Version: 1.0 Author: WP-Buddy Author URI: http://wp-buddy.com License: GPLv2 or later */ add_action( 'init', 'wplfsc_add_shortcodes' ); function wplfsc_add_shortcodes() { add_shortcode( 'wp_login_form', 'wplfsc_shortcode' ); } function wplfsc_shortcode( $atts, $content, $name ) { $atts = shortcode_atts( array( 'redirect' => site_url( $_SERVER['REQUEST_URI'] ), 'form_id' => 'loginform', 'label_username' => __( 'Username' ), 'label_password' => __( 'Password' ), 'label_remember' => __( 'Remember Me' ), 'label_log_in' => __( 'Log In' ), 'id_username' => 'user_login', 'id_password' => 'user_pass', 'id_remember' => 'rememberme', 'id_submit' => 'wp-submit', 'remember' => false, 'value_username' => NULL, 'value_remember' => false ), $atts, $name ); // echo is always false $atts['echo'] = false; // make real boolean values $atts['remember'] = filter_var( $atts['remember'], FILTER_VALIDATE_BOOLEAN ); $atts['value_remember'] = filter_var( $atts['value_remember'], FILTER_VALIDATE_BOOLEAN ); return '<div class="cct-login-form">' . wp_login_form( $atts ) . '</div>'; }
Tutto quello che devifare èmodellareiltuomodulo sulfrontend.
Way easier: use a WordPress function called
wp_login_form()
(Codex page here).You can make your own plugin so that you can use a shortcode in on of your pages:
<?php /* Plugin Name: WP Login Form Shortcode Description: Use <code>[wp_login_form]</code> to show WordPress' login form. Version: 1.0 Author: WP-Buddy Author URI: http://wp-buddy.com License: GPLv2 or later */ add_action( 'init', 'wplfsc_add_shortcodes' ); function wplfsc_add_shortcodes() { add_shortcode( 'wp_login_form', 'wplfsc_shortcode' ); } function wplfsc_shortcode( $atts, $content, $name ) { $atts = shortcode_atts( array( 'redirect' => site_url( $_SERVER['REQUEST_URI'] ), 'form_id' => 'loginform', 'label_username' => __( 'Username' ), 'label_password' => __( 'Password' ), 'label_remember' => __( 'Remember Me' ), 'label_log_in' => __( 'Log In' ), 'id_username' => 'user_login', 'id_password' => 'user_pass', 'id_remember' => 'rememberme', 'id_submit' => 'wp-submit', 'remember' => false, 'value_username' => NULL, 'value_remember' => false ), $atts, $name ); // echo is always false $atts['echo'] = false; // make real boolean values $atts['remember'] = filter_var( $atts['remember'], FILTER_VALIDATE_BOOLEAN ); $atts['value_remember'] = filter_var( $atts['value_remember'], FILTER_VALIDATE_BOOLEAN ); return '<div class="cct-login-form">' . wp_login_form( $atts ) . '</div>'; }
All you have to do is to style your form on the frontend.
-
- 2014-03-18
Se sei aperto all'uso deiplugin,hogià utilizzatoil componente aggiuntivo Registrazione utenteper Gravity Forms,hafunzionatomoltobene:
http://www.gravityforms.com/add-ons/user-registration/
Modifica:mi rendo conto che questanon è una soluzionemolto dettagliata,mafaesattamente ciò di cui haibisognoed è unabuona soluzione.
Modifica:perespandere ulteriormente lamia risposta,il componente aggiuntivo Registrazione utenteperi moduli digravitàti consente dimappare qualsiasi campoin unmodulo creato utilizzando Gravity Forms,a campi specifici dell'utente. Adesempio,puoi creare unmodulo con Nome,Cognome,Email,Sito web,Password. Almomento dell'invio,il componente aggiuntivomapperàtaliinput ai campi utentepertinenti.
Un'altra cosagrandiosa è chepuoi aggiungere qualsiasi utente registratoin una coda di approvazione. I loro account utente verranno creati solo una volta approvatinelback-end da un amministratore.
Seil collegamentoprecedente siinterrompe,è sufficiente "Aggiunta registrazione utente di Googleper Gravity Forms"
If you're open to the use of plugins, I've used the User Registration add-on for Gravity Forms before, it worked very well:
http://www.gravityforms.com/add-ons/user-registration/
Edit: I realise this isn't a very detailed solution, but it does exactly what you need and is a good solution.
Edit: To expand on my answer further, the User Registration add-on for gravity forms allows you to map any fields in a form created using Gravity Forms, to user-specific fields. For example, you can create a form with First Name, Last Name, Email, Website, Password. Upon submission, the add-on will map those inputs to the relevant user fields.
Another great thing about it, is you can add any registered users into an approval queue. Their user accounts would only be created once approved in the backend by an admin.
If the above link breaks, just Google "User Registration add on for Gravity Forms"
-
Hai letto lenote che @kaiser ha aggiunto alla domanda (lamiain grassetto): * "Stiamo cercando ** risposte lunghe cheforniscano spiegazionie contesto **. Non limitarti afornire una risposta di una riga; spiegaperché latua rispostaègiusto,idealmente con le citazioni. Le risposte chenonincludono spiegazionipotrebberoessere rimosse "*Have you read notes @kaiser added to the question (bold mine): *"We're looking for **long answers that provide some explanation and context**. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed"*
- 2
- 2014-03-18
- gmazzap
-
L'hofatto,ma ho sentito che vale ancora lapenamenzionare l'add-on,poiché l'OPnonmenziona lanecessità di codificarlopersonalizzato.Felice di spostarloin un commento se lo ritieninecessarioI have, but I felt the add-on is still worth mentioning, as the OP doesn't mention a need to custom code it. Happy to move it to a comment if you feel it's necessary
- 0
- 2014-03-18
- James Kemp
-
Non sono unmod,quindinonpossomuovermiper commentare latua risposta.Posso solo votare contro,manon l'hofattoperchépenso cheiltuo link contengainformazioni utili,tuttavia,la risposta solo linknon è utile,ancheperché quel linkpuòesserefacilmentemodificatoe quindi latua rispostaporta a un 404.Prova a riportare quiil codicepertinentee spiega cosafa quel codice,quindi latua risposta vabene,immagino.I'm not a mod, so I can't move to comment your answer. I can only vote down, but I haven't do that because I think that your link contain useful info, however, link-only answer is not useful, even because that link can be easily change and so your answer bring to a 404. Try to report here relevant code and explain waht that code does, then your answer is fine, I guess.
- 0
- 2014-03-18
- gmazzap
-
James,ho assegnato lataglia a una risposta _real_ cheincludeil codice.Se desideri unataglia aggiuntiva,separailplug-ine mostraciesattamente cosa stafacendo.Grazie.James, I awarded the bounty to a _real_ answer that includes code. If you want an additional bounty, please tear the plugin apart and show us exactly what it's doing. Thanks.
- 0
- 2014-03-18
- kaiser
-
Ciao Kaiser,non sto cercando lataglia,volevo solo condividere lamia conoscenza delplugin!Hi Kaiser, I'm not after the bounty, just wanted to share my knowledge of the plugin!
- 0
- 2014-03-19
- James Kemp
Come visualizzareilmodulo di registrazione utente di WordPress (ilmodulo che apparenellapagina "www.mywebsite.com/wp-register.php")nelfront-end delmioblog?
Hopersonalizzatoilmodulo di registrazione.Manon so come chiamare quelmodulonellapagina difront-end.Qualsiasi supporto sarà davvero digrande aiuto.
Graziein anticipo.:)