本文整理汇总了PHP中wp_login_form函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_login_form函数的具体用法?PHP wp_login_form怎么用?PHP wp_login_form使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_login_form函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: draw_modal
/**
*
* Return a modal for logging in
*
* @since 1.0
*/
function draw_modal()
{
if (!is_user_logged_in()) {
?>
<div class="modal fade modal--login modal--centered" id="modal--login" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="gridSystemModalLabel">Login</h4>
</div>
<div class="modal-body">
<?php
wp_login_form();
?>
</div>
<div class="modal-footer">
<p class="modal--terms">Forgot password? Click <a href="<?php
echo site_url('wp-login.php?action=lostpassword');
?>
">here</a> to reset it.</p>
</div>
</div>
</div>
</div>
<?php
}
}
示例2: widget
/**
* Outputs the content of the widget
*
* @param array $args
* @param array $instance
*/
public function widget($args, $instance) {
$title = apply_filters('widget_title', $instance['title']);
echo $args['before_widget'];
echo '<div class="event-widget">';
if (is_user_logged_in()) {
if (!empty($instance['title'])) {
echo $args['before_title'] . __('Profile Links') . $args['after_title'];
}
$user_ID = get_current_user_id();
$profile_id = get_user_meta($user_ID, 'uiu_profile', TRUE);
$profile_link = !empty($profile_id) ? get_permalink($profile_id) : get_dashboard_url($user_ID);
?>
<ul class="menu user-menu">
<li class="menu-item"><a href="<?php echo $profile_link; ?>">My Profile</a> </li>
<li class="menu-item"><a href="<?php echo wp_logout_url(site_url()); ?>">Logout</a> </li>
</ul>
<?php
} else {
if (!empty($instance['title'])) {
echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
}
wp_login_form($args);
}
echo $args['after_widget'];
}
示例3: do_membershiplogin_shortcode
function do_membershiplogin_shortcode($atts)
{
if (is_user_logged_in()) {
return '';
}
extract(shortcode_atts(array("holder" => apply_filters('membership_short_login_form_holder', ''), "holderclass" => apply_filters('membership_short_login_form_holderclass', ''), "item" => apply_filters('membership_short_login_form_item', ''), "itemclass" => apply_filters('membership_short_login_form_itemclass', ''), "postfix" => apply_filters('membership_short_login_form_postfix', ''), "prefix" => apply_filters('membership_short_login_form_prefix', ''), "wrapwith" => apply_filters('membership_short_login_form_wrapwith', ''), "wrapwithclass" => apply_filters('membership_short_login_form_wrapwithclass', ''), "redirect" => apply_filters('membership_short_login_form_redirect', filter_input(INPUT_GET, 'redirect_to', FILTER_VALIDATE_URL)), "lostpass" => apply_filters('membership_short_login_form_lostpassword', '')), $atts));
$html = '';
if (!empty($holder)) {
$html .= "<{$holder} class='{$holderclass}'>";
}
if (!empty($item)) {
$html .= "<{$item} class='{$itemclass}'>";
}
$html .= $prefix;
// The title
if (!empty($wrapwith)) {
$html .= "<{$wrapwith} class='{$wrapwithclass}'>";
}
$html .= wp_login_form(array('echo' => false, 'redirect' => !empty($redirect) ? $redirect : home_url($_SERVER['REQUEST_URI'])));
if (!empty($lostpass)) {
$html .= sprintf('<a href="%s">%s</a>', esc_url($lostpass), __('Lost password?', 'membership'));
}
if (!empty($wrapwith)) {
$html .= "</{$wrapwith}>";
}
$html .= $postfix;
if (!empty($item)) {
$html .= "</{$item}>";
}
if (!empty($holder)) {
$html .= "</{$holder}>";
}
return $html;
}
示例4: msd_inline_login
function msd_inline_login($atts)
{
extract(shortcode_atts(array('name' => 'partner', 'echo' => false, 'redirect' => site_url($_SERVER['REQUEST_URI']), 'form_id' => 'loginform', 'label_username' => __('Agency Ref'), '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' => true, 'value_username' => NULL, 'value_remember' => false), $atts));
$args = array('echo' => $echo, 'redirect' => $redirect, 'form_id' => $form_id, 'label_username' => $label_username, 'label_password' => $label_password, 'label_remember' => $label_remember, 'label_log_in' => $label_log_in, 'id_username' => $id_username, 'id_password' => $id_password, 'id_remember' => $id_remember, 'id_submit' => $id_submit, 'remember' => $remember, 'value_username' => $value_username, 'value_remember' => $value_remember);
global $current_user;
if (is_user_logged_in()) {
if ($name == 'partner') {
$ret = '<div class="partner-links">
<p>
<a href="https://dtc.daretocare.org/PrimariusWW/login.aspx" target="_blank" id="agency-button-2" class="button agency-button">Click to Proceed to PWW</a>
</p>
<p>
<a href="/partner-agencies/agency-info/" id="agency-button-2" class="button agency-button">Agency Info</a>
</p>
</div>';
} elseif ($name == 'kitchen') {
$ret = '<div class="kitchen-links">
<p>
<a href="/partner-agencies/community-kitchen-partner-info/" id="agency-button-3" class="button agency-button">Community Kitchen Info</a>
</p>
</div>';
$ret = '<div class="kitchen-form">' . wp_login_form($args) . '</div>';
}
} else {
if ($name == 'partner') {
$ret = '<div class="partner-form">' . wp_login_form($args) . '</div>';
} elseif ($name == 'kitchen') {
$ret = '<div class="kitchen-form">' . wp_login_form($args) . '</div>';
}
}
return $ret;
}
示例5: endpoints
function endpoints()
{
$params = array_merge(array('wordcampers_internal_api' => '0', 'action' => ''), $_GET);
if ($params['wordcampers_internal_api'] === '1') {
header('Content-Type: application/json');
$data = array();
if ($params['action'] === 'login_form') {
$args = array('echo' => true, 'redirect' => home_url('/wp-admin/'), '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' => true, 'value_username' => NULL, 'value_remember' => true);
ob_start();
wp_login_form($args);
$data['login_form'] = ob_get_clean();
} else {
if ($params['action'] === 'logout_form') {
ob_start();
?>
<div class="aa_logout">
Hello,
<div class="aa_logout_user">
$user_login, You are already logged in.
</div>
<a id="wp-submit" href="<?php
echo wp_logout_url();
?>
" title="Logout">
Logout
</a>
</div>
<?php
$data['logout_form'] = ob_get_clean();
}
}
echo json_encode($data);
die;
}
}
示例6: vcex_login_form_shortcode
function vcex_login_form_shortcode($atts, $content = NULL)
{
// Shortcode params
extract(shortcode_atts(array('unique_id' => '', 'redirect' => ''), $atts));
// If user is logged return text
if (is_user_logged_in()) {
return $content;
}
if ($redirect == '') {
$redirect = site_url($_SERVER['REQUEST_URI']);
}
// Form args
$args = array('echo' => true, 'redirect' => $redirect, 'form_id' => 'vcex-loginform', 'label_username' => __('Username', 'vcex'), 'label_password' => __('Password', 'vcex'), 'label_remember' => __('Remember Me', 'vcex'), 'label_log_in' => __('Log In', 'vcex'), 'remember' => true, 'value_username' => NULL, 'value_remember' => false);
// Ouput form
ob_start();
?>
<div class="vcex-login-form clr">
<?php
wp_login_form($args);
?>
</div><!-- .vcex-login-form -->
<?php
echo ob_get_clean();
}
示例7: top_login_form_shortcode
function top_login_form_shortcode()
{
if (is_user_logged_in()) {
return '';
}
return wp_login_form(array('echo' => false));
}
示例8: atcf_shortcode_login_form
/**
* Login form
*
* @since Astoundify Crowdfunding 1.0
*
* @return $form
*/
function atcf_shortcode_login_form()
{
global $edd_options;
$redirect = isset($_GET['redirect_to']) ? $_GET['redirect_to'] : home_url('/');
//atcf_get_current_url() //bumbum: changed default 'current_url' for the 'home_url'... ;
wp_login_form(apply_filters('atcf_shortcode_login_form_args', array('redirect' => esc_url($redirect))));
}
示例9: widget
function widget($args, $instance)
{
extract($args);
/* User-selected settings. */
//$title = isset( $instance['title'] ) ? apply_filters('widget_title', $instance['title'] ) : "" ;
$title = isset($instance['title']) ? apply_filters('widget_title', $instance['title']) : "";
$notregistered = isset($instance['notreg']) ? $instance['notreg'] : "";
$notmember = isset($instance['notmember']) ? $instance['notmember'] : "";
$member = isset($instance['member']) ? $instance['member'] : "";
$welcome = isset($instance['welcome']) ? $instance['welcome'] : "";
$show_form = isset($instance['show_form']) ? $instance['show_form'] : "";
$jmm_options = get_option('helfjmm_options');
global $current_user, $blog_id, $user_login;
/* Before widget (defined by themes). */
echo $before_widget;
/* Title of widget (before and after defined by themes). */
if ($title) {
echo $before_title . $title . $after_title;
}
if (isset($_POST['jmm-join-site']) || isset($_POST['join-site'])) {
// This is the magic sauce.
do_action('jmm_joinsite', array('JMM', 'join_site'));
echo '<p>' . $welcome . '</p>';
} else {
if (!is_user_logged_in()) {
if (get_option('users_can_register') == 1) {
// If user isn't logged in but we allow for registration....
// IF we have a custom URL, use it, else send to /wp-signup.php for this site (becuase join my SITE, not network)
if (!is_null($jmm_options['perpage']) && $jmm_options['perpage'] != "XXXXXX") {
$goto = get_permalink($jmm_options['perpage']);
} else {
$goto = '/wp-signup.php';
}
// Here is our form
echo '<form action="' . $goto . '" method="post" id="notmember">';
echo '<input type="hidden" name="action" value="jmm-join-site">';
echo '<input type="submit" value="' . $notregistered . '" name="join-site" id="join-site" class="button">';
echo '</form>';
// Do we show the inline login form?
if ($show_form == 'on') {
echo '<br /><h3 class="widget-title">' . __("Log in") . '</h3>';
wp_login_form(array('value_remember' => 1));
}
}
// If we don't allow registration, we show nothing. On to the next one!
} elseif (!is_user_member_of_blog()) {
// If user IS logged in, then let's invite them to play.
echo '<form action="?jmm-join-site" method="post" id="notmember">';
echo '<input type="hidden" name="action" value="jmm-join-site">';
echo '<input type="submit" value="' . $notmember . '" name="join-site" id="join-site" class="button">';
echo '</form>';
} else {
// Otherwise we're already a member, hello, mum!
echo '<p>' . $member . '</p>';
}
}
/* After widget (defined by themes). */
echo $after_widget;
}
示例10: shrtcode_lthemer
function shrtcode_lthemer($atts)
{
ob_start();
wp_login_form();
$output_lthemer = ob_get_contents();
ob_end_clean();
return $output_lthemer;
}
示例11: videotube_login
function videotube_login($attr, $content)
{
global $videotube;
if (get_current_user_id()) {
$content .= '<div class="alert alert-success alert-dismissable ">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>' . __('You are already logged in.', 'mars') . '</div>';
} else {
$args = array('echo' => false, 'redirect' => isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : home_url(), 'form_id' => 'vt_loginform', 'label_username' => __('Username', 'mars'), 'label_password' => __('Password', 'mars'), 'label_remember' => __('Remember Me', 'mars'), 'label_log_in' => __('Log In', 'mars'), 'id_username' => 'user_login', 'id_password' => 'user_pass', 'id_remember' => 'rememberme', 'id_submit' => 'wp-submit', 'remember' => true, 'value_username' => NULL, 'value_remember' => false);
$content .= '<div class="alert alert-danger" style="display:none;"></div>';
$content .= '<div class="row">';
$content .= '<div class="col-md-6">';
$content .= '<h2>' . __('Login', 'mars') . '</h2>';
$content .= wp_login_form($args);
$content .= '</div>';
if (get_option('users_can_register')) {
$content .= '<div class="col-md-6">';
$content .= '
<h2>' . __('Register your Account', 'mars') . '</h2>
<form name="registerform" id="registerform" action="' . esc_url(site_url('wp-login.php?action=register', 'login_post')) . '" method="post">
<p>
<label for="user_login">' . __('Username', 'mars') . '</label>
<input type="text" name="user_login" id="user_login" class="input form-control" />
</p>
<p>
<label for="user_email">' . __('Email', 'mars') . '</label>
<input type="text" name="user_email" id="user_email" class="input form-control"/>
</p>
<p>
<label for="user_pass1">' . __('Password', 'mars') . '</label>
<input type="password" name="user_pass1" id="user_pass1" class="input form-control"/>
</p>
<p>
<label for="user_pass2">' . __('Confirm Password', 'mars') . '</label>
<input type="password" name="user_pass2" id="user_pass2" class="input form-control"/>
</p>';
$content .= do_action('register_form');
$error = null;
if (isset($videotube['login_register_captcha']) && $videotube['login_register_captcha'] == 1 && $videotube['public_key']) {
if (function_exists('recaptcha_get_html')) {
$content .= '<p>';
$content .= recaptcha_get_html($videotube['public_key'], $error);
$content .= '</p>';
}
}
$content .= '<input type="submit" value="' . __('Register', 'mars') . '" id="register" />';
$content .= '<input type="hidden" name="action" value="vt_ajax_register"><input type="hidden" name="button_label" value="' . __('Register', 'mars') . '">';
if (isset($_GET['redirect_to'])) {
$content .= '<input type="hidden" name="redirect_to" value="' . $_GET['redirect_to'] . '">';
}
$content .= '
</form>
';
$content .= '</div>';
}
$content .= '</div>';
}
return $content;
}
示例12: widget
function widget($args, $instance)
{
global $user_login;
if (!isset($args['widget_id'])) {
$args['widget_id'] = null;
}
extract($args, EXTR_SKIP);
extract($instance);
echo $before_widget;
$title = apply_filters('widget_title', $title, $instance, $this->id_base);
if (is_user_logged_in()) {
$user = get_user_by('login', $user_login);
$title = __('Welcome', 'mfn-opts') . ' ' . $user->data->display_name;
}
echo '<div class="mfn-login">';
if ($title) {
echo $before_title . $title . $after_title;
}
// validation
if (isset($_GET['login']) && $_GET['login'] == 'failed') {
$errcode = $_GET['errcode'];
if ($errcode == "empty_username" || $errcode == "empty_password") {
$error = __('Please enter Username and Password', 'mfn-opts');
} elseif ($errcode == 'invalid_username') {
$error = __('Invalid Username', 'mfn-opts');
} elseif ($errcode == 'incorrect_password') {
$error = __('Incorrect Password', 'mfn-opts');
}
echo '<div class="alert alert_error">' . $error . '</div>';
}
if (is_user_logged_in()) {
echo '<div class="avatar-wrapper">' . get_avatar($user->ID, 64) . '</div>';
echo '<div class="author">';
_e('Logged in as ', 'mfn-opts');
echo '<strong>' . ucfirst(implode(', ', $user->roles)) . '</strong><br />';
echo '<a href="' . admin_url() . '">' . __('Dashboard', 'mfn-opts') . '</a>';
echo '<span class="sep">|</span>';
echo '<a href="' . admin_url() . 'profile.php">' . __('Profile', 'mfn-opts') . '</a>';
echo '<span class="sep">|</span>';
echo '<a href="' . wp_logout_url(site_url()) . '">' . __('Logout', 'mfn-opts') . '</a>';
echo '</div>';
} else {
wp_login_form(array('value_remember' => 0, 'redirect' => site_url(), 'remember' => false));
echo '<div class="links">';
if ($show_register) {
echo '<a href="' . wp_registration_url() . '">' . __('Register', 'mfn-opts') . '</a>';
}
if ($show_register && $show_forgotten_password) {
echo '<span class="sep">|</span>';
}
if ($show_forgotten_password) {
echo '<a href="' . wp_registration_url() . '">' . __('Lost your password?', 'mfn-opts') . '</a>';
}
echo '</div>';
}
echo '</div>' . "\n";
echo $after_widget;
}
示例13: simplr_profile_page
function simplr_profile_page()
{
global $current_user, $errors;
if (!class_exists('Form')) {
include_once dirname(__FILE__) . '/form.class.php';
}
if (!is_user_logged_in()) {
ini_set('display_errors', 1);
error_reporting(E_ALL);
$output = '';
ob_start();
wp_login_form();
$output = ob_get_contents();
ob_end_clean();
return $output;
} else {
$error_header = '';
if (is_array($errors)) {
foreach ($errors as $error) {
$error_header .= '<div id="simplr-message" class="error">' . @$error . "</div>\n";
}
} elseif (@$_REQUEST['updated'] == 'true') {
$error_header = '<div id="simplr-message" class="success">' . apply_filters('simplr_profile_updated_message', __('Your profile was saved', 'simplr-registration-form')) . '</div>';
}
$fields = get_transient('simplr_profile_transient');
delete_transient('simplr_profile_transient');
ob_start();
echo '<h3>' . __('User Login', 'simplr-registration-form') . ': ' . $current_user->user_login . ' / ' . __('Registered', 'simplr-registration-form') . ': ' . date_i18n(get_option('date_format'), strtotime($current_user->user_registered)) . '</h3>';
echo '<form id="simplr-form" method="post" action="" >';
SREG_Form::text(array('name' => 'user_nicename', 'label' => __('Nickname', 'simplr-registration-form'), 'required' => false), $current_user->user_nicename, 'wide');
SREG_Form::text(array('name' => 'user_email', 'label' => __('Email', 'simplr-registration-form'), 'required' => true), $current_user->user_email, 'wide');
if (!empty($fields)) {
foreach ($fields as $field) {
$key_val = get_user_meta($current_user->ID, $field['key'], true);
$args = array('name' => $field['key'], 'label' => $field['label'], 'required' => $field['required']);
//setup specific field values for date and callback
if ($field['type'] == 'callback') {
$field['options_array'][1] = array($key_val);
}
if ($field['type'] != '') {
SREG_Form::$field['type']($args, @$key_val, '', $field['options_array']);
}
}
//endforeach
}
SREG_Form::hidden(array('name' => 'user_id'), $current_user->ID, '', '');
if (!get_user_meta($current_user->ID, 'fbuser_id', true)) {
simplr_change_password();
}
wp_nonce_field('simplr-profile', '_simplr_nonce');
SREG_Form::submit(array('name' => 'simplr-profile'));
echo '</form>';
$output = ob_get_contents();
ob_end_clean();
return $error_header . $output;
}
}
示例14: widget
public function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', $instance['title']);
echo '<aside id="' . $title . '-widget" class="widget widget_categories">';
echo '<h1 class="widget-title">' . $title . '</h1>';
echo '<div class="login-widget">' . wp_login_form() . '</div>';
echo '</aside>';
}
示例15: bl_my_listings
function bl_my_listings()
{
global $wpdb, $post;
$current_url = get_permalink($post->ID);
$return_text = "";
if (!is_user_logged_in()) {
$return_text .= "<p>" . __("You need to be Logged In to see your Listings.", "bepro-listings") . "</p>";
$args = array('echo' => true, 'redirect' => $current_url, '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' => true, 'value_username' => NULL, 'value_remember' => false);
wp_login_form($args);
return;
}
$types = listing_types();
$current_user = wp_get_current_user();
$user_id = $current_user->id;
if (isset($_POST["save_bepro_listing"]) && !empty($_POST["save_bepro_listing"])) {
$success = false;
$success = bepro_listings_save();
if ($success) {
$success_message = apply_filters("bepro_form_success_message", "Listing Successfully Saved");
$message = "<span class='bl_succsss_message'>" . __($success_message, "bepro-listings") . "</span>";
} else {
$fail_message = apply_filters("bepro_form_fail_message", __("Issue saving your listing. Please contact the website administrator", "bepro-listings"));
$message = "<span class='bl_fail_message'>" . __($fail_message, "bepro-listings") . "</span>";
}
$current_user = wp_get_current_user();
$current_url = get_permalink($post->ID);
echo "<span class='classified_message'>" . $message . "</span>";
}
if (!empty($_GET["bl_manage"])) {
if (!empty($_GET["bl_id"])) {
bl_profile_update_listing_content();
} else {
bl_profile_add_listing_content();
}
} else {
$data = get_option("bepro_listings");
// get records
if (@$data["require_payment"]) {
$items = $wpdb->get_results("SELECT geo.*, orders.status as order_status, orders.expires, wp_posts.post_title, wp_posts.post_status FROM " . $wpdb->prefix . BEPRO_LISTINGS_TABLE_NAME . " as geo \n\t\t\t\tLEFT JOIN " . $wpdb->prefix . "posts as wp_posts on wp_posts.ID = geo.post_id \n\t\t\t\tLEFT JOIN " . BEPRO_LISTINGS_ORDERS_TABLE_NAME . " AS orders on orders.bl_order_id = geo.bl_order_id WHERE wp_posts.post_status != 'trash' AND wp_posts.post_author = " . $user_id);
} else {
$items = $wpdb->get_results("SELECT geo.*, wp_posts.post_title, wp_posts.post_status FROM " . $wpdb->prefix . BEPRO_LISTINGS_TABLE_NAME . " as geo \n\t\t\t\tLEFT JOIN " . $wpdb->prefix . "posts as wp_posts on wp_posts.ID = geo.post_id WHERE wp_posts.post_status != 'trash' AND wp_posts.post_author = " . $user_id);
}
$listing_url = "?bl_manage=1&bl_id=";
$add_listing_button = "<p><a href='" . $listing_url . "'>" . __("Add a Listing") . "</a></p>";
//allow addons to override create listing button
$return_text .= apply_filters("bl_change_add_listing_button", $add_listing_button, $listing_url);
//allow addons to change profile template
$bl_my_list_template = apply_filters("bl_change_my_list_template", dirname(__FILE__) . '/templates/list.php', $items);
ob_start();
if (!empty($bl_my_list_template)) {
include $bl_my_list_template;
}
$return_text .= ob_get_clean();
return $return_text;
}
}