Home › Forum › Plugin e temi di WP › login nell’header
-
AutorePost
-
-
8 Giugno 2008 alle 13:11 #6904morfinaPartecipante
Ciao, st ocercando di inserire i form di login nell’header di wordpress. Ho trovato in rete alcuni sistemi per fare ciò. Alcuni di essi permettevano poi anche la visualizzazione di un testo tipo “logged in as ….”. E questo è perfetto per il mio caso. Il problemanasce dal fatto che ho aggiornato alla versione 2.5 e gli stessi codici sembrano non funzionare correttamente; i form di log non vengono visualizzati; se mi loggo invece con il sistema di default però poi compare la fantomatica scritta “logged in as ….” dove prima avrebbero dovuto esserci i form. Probabilmente è un problema di compatibilità con la nuova versione wordpress.
ecco il codice che utilizzo:
<?php global $user_ID, $user_identity, $user_level ?>
<?php if ( $user_ID ) : ?>
Identified as <?php echo $user_identity ?>.
<?php if ( $user_level >= 1 ) : ?>
/wp-admin/post-new.php">Write an article
<?php endif // $user_level >= 1 ?>
/wp-admin/profile.php">Profile
/wp-login.php?action=logout&redirect_to=<?php echo urlencode($_SERVER) ?>">logout
<?php elseif ( get_option('users_can_register') ) : ?>
<form action="<?php bloginfo('url') ?>/wp-login.php" method="post">
<p>
<label for="log">user: <input type="text" name="log" id="log" class="input" value="<?php echo wp_specialchars(stripslashes($user_login), 1) ?>" size="10" /></label>
<label for="pwd">password: <input type="password" name="pwd" id="pwd" class="input" size="10" /></label>
<input type="submit" value="submit" class="button" />
</p>
<input type="hidden" name="redirect_to" value="<?php echo $_SERVER; ?>"/>
</form>
/wp-login.php?action=lostpassword">recover password
<?php endif // get_option('users_can_register') ?>
-
9 Giugno 2008 alle 11:02 #54510morfinaPartecipante
Per chi fosse interessato all’argomento, ho trovato il codice funzionante:
<li id="login">
<?php
global $user_ID, $user_identity;
get_currentuserinfo();
if (!$user_ID):
?>
<h2><?php _e('Login'); ?></h2>
<form name="loginform" id="loginform" action="<?php echo get_settings('siteurl'); ?>/wp-login.php" method="post">
<div><label><?php _e('Login') ?>:
<input class="input" type="text" name="log" id="log" value="" size="20" tabindex="7" /></label><label><?php _e('Password') ?>:
<input class="input" type="password" name="pwd" id="pwd" value="" size="20" tabindex="8" /></label><label><input type="checkbox" name="rememberme" value="forever" tabindex="9" /> <?php _e("Remember me"); ?></label>
<input type="submit" class="button" name="submit" value="<?php _e('Login'); ?> »" tabindex="10" />
<?php wp_register('', ''); ?>
<input type="hidden" name="redirect_to" value="<?php echo $_SERVER; ?>"/></div>
</form>
<?php
else:
?>
<h2><?php echo $user_identity; ?></h2>
-
<?php wp_register(); ?>
- "><?php _e('Logout'); ?>
<?php
endif;
?>
-
11 Novembre 2012 alle 20:22 #98615ifdandreaPartecipante
dove inserisci questo codice?è possibile inserire un widget-login nell’header?
ciao
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.