Skip to content

Commit

Permalink
fixed #35
Browse files Browse the repository at this point in the history
  • Loading branch information
amiyasahu committed Oct 16, 2015
1 parent 25bb74f commit 40ff07e
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 95 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Fixed issue in users page when default avatar is not set [issue #34](https://github.com/amiyasahu/Donut/issues/34)
* Improved back to top button
* Fixed duplicate border bottoms if the answer form does not exists
* Fixed the compatibility of official facebook login plugin [#35](https://github.com/amiyasahu/Donut/issues/35)

## Version 1.6.1 ##

Expand Down Expand Up @@ -104,7 +105,7 @@
* several bug fixes
* Improved CSS
* Improved nav bar
* Improevd navbar for mobile devices
* Improved navbar for mobile devices
* Better integration with the [Open login plugin](https://github.com/alixandru/q2a-open-login)

## Version 1.1 ##
Expand Down
192 changes: 98 additions & 94 deletions qa-theme/Donut-theme/templates/user-login-drop-down.php
Original file line number Diff line number Diff line change
@@ -1,104 +1,108 @@
<?php
$print_or = false;
?>
<ul class="nav navbar-nav navbar-right login-nav">
<li class="dropdown login-dropdown login active">
<a href="#" data-toggle="dropdown" class="navbar-login-button">
<?php //echo qa_lang_html('users/login_button'); ?>
<span class="fa fa-sign-in text-muted"></span>
</a>
<ul class="dropdown-menu" role="menu" id="login-dropdown-menu">
<?php
if ( !empty( $this->content['navigation']['user'] ) ) {
$this->output( '<li class="open-login-buttons">' );
foreach ( $this->content['navigation']['user'] as $k => $custom ) {
if ( isset( $custom ) && ( ( $k != 'login' ) && ( $k != 'register' ) ) ) {
<ul class="nav navbar-nav navbar-right login-nav">
<li class="dropdown login-dropdown login active">
<a href="#" data-toggle="dropdown" class="navbar-login-button">
<span class="fa fa-sign-in text-muted"></span>
</a>
<ul class="dropdown-menu" role="menu" id="login-dropdown-menu">
<?php
if ( !empty( $this->content['navigation']['user'] ) ) {
$this->output( '<li class="open-login-buttons">' );
foreach ( $this->content['navigation']['user'] as $k => $custom ) {
if ( ( $k != 'login' ) && ( $k != 'register' ) ) {

if ( $k == 'facebook-login' ) {
//for the default facebook login plugin
$this->output( '<div class="text-center">' );
$this->output( $custom['label'] );
$this->output( '</div>' );
continue;
}

$icon = '';
preg_match( '/class="([^"]+)"/', @$custom['label'], $class );
//support for open login plugin
$icon = '';
preg_match( '/class="([^"]+)"/', @$custom['label'], $class );

if ( $k == 'facebook' )
$icon = 'class="' . @$class[1] . ' fa fa-facebook"';
elseif ( $k == 'github' )
$icon = 'class="' . @$class[1] . ' fa fa-github"';
elseif ( $k == 'foursquare' )
$icon = 'class="' . @$class[1] . ' fa fa-foursquare"';
elseif ( $k == 'google' )
$icon = 'class="' . @$class[1] . ' fa fa-google"';
elseif ( $k == 'googleplus' )
$icon = 'class="' . @$class[1] . ' fa fa-google-plus"';
elseif ( $k == 'live' )
$icon = 'class="' . @$class[1] . ' fa fa-windows"';
elseif ( $k == 'tumblr' )
$icon = 'class="' . @$class[1] . ' fa fa-tumblr"';
elseif ( $k == 'yahoo' )
$icon = 'class="' . @$class[1] . ' fa fa-yahoo"';
elseif ( $k == 'twitter' )
$icon = 'class="' . @$class[1] . ' fa fa-twitter"';
elseif ( $k == 'linkedin' )
$icon = 'class="' . @$class[1] . ' fa fa-linkedin"';
elseif ( $k == 'vk' )
$icon = 'class="' . @$class[1] . ' fa fa-vk"';
if ( $k == 'facebook' )
$icon = 'class="' . @$class[1] . ' fa fa-facebook"';
elseif ( $k == 'github' )
$icon = 'class="' . @$class[1] . ' fa fa-github"';
elseif ( $k == 'foursquare' )
$icon = 'class="' . @$class[1] . ' fa fa-foursquare"';
elseif ( $k == 'google' )
$icon = 'class="' . @$class[1] . ' fa fa-google"';
elseif ( $k == 'googleplus' )
$icon = 'class="' . @$class[1] . ' fa fa-google-plus"';
elseif ( $k == 'live' )
$icon = 'class="' . @$class[1] . ' fa fa-windows"';
elseif ( $k == 'tumblr' )
$icon = 'class="' . @$class[1] . ' fa fa-tumblr"';
elseif ( $k == 'yahoo' )
$icon = 'class="' . @$class[1] . ' fa fa-yahoo"';
elseif ( $k == 'twitter' )
$icon = 'class="' . @$class[1] . ' fa fa-twitter"';
elseif ( $k == 'linkedin' )
$icon = 'class="' . @$class[1] . ' fa fa-linkedin"';
elseif ( $k == 'vk' )
$icon = 'class="' . @$class[1] . ' fa fa-vk"';

$pattern = "/_(?=[^>]*<)/";
$pattern = "/_(?=[^>]*<)/";

$custom['label'] = preg_replace( $pattern, $icon, $custom['label'] );
$this->output( str_replace( @$class[0], @$icon, @$custom['label'] ) );
$print_or = true;
}
$custom['label'] = preg_replace( $pattern, $icon, $custom['label'] );
$this->output( str_replace( @$class[0], @$icon, @$custom['label'] ) );
}
$this->output( '</li>' );
}
?>
<?php if ( $print_or ): ?>
<li>
<div class="login-or">
<hr class="hr-or colorgraph">
<span class="span-or">or</span>
</div>
</li>
<?php endif ?>
<form role="form" action="<?php echo $this->content['navigation']['user']['login']['url']; ?>"
method="post">
<li>
<label>
<?php echo trim( qa_lang_html( 'users/email_handle_label' ), ':' ); ?>
</label>
<input type="text" class="form-control" id="qa-userid" name="emailhandle"
placeholder="<?php echo trim( qa_lang_html( 'users/email_handle_label' ), ':' ); ?>"/>
</li>
$this->output( '</li>' );
}
?>
<?php if ( isset( $this->content['navigation']['user'] ) && count( $this->content['navigation']['user'] ) > 2 ): ?>
<li>
<div class="login-or">
<hr class="hr-or colorgraph">
<span class="span-or">or</span>
</div>
</li>
<?php endif ?>
<form role="form" action="<?php echo $this->content['navigation']['user']['login']['url']; ?>"
method="post">
<li>
<label>
<?php echo trim( qa_lang_html( 'users/email_handle_label' ), ':' ); ?>
</label>
<input type="text" class="form-control" id="qa-userid" name="emailhandle"
placeholder="<?php echo trim( qa_lang_html( 'users/email_handle_label' ), ':' ); ?>"/>
</li>

<li>
<label>
<?php echo trim( qa_lang_html( 'users/password_label' ), ':' ); ?>
</label>
<input type="password" class="form-control" id="qa-password" name="password"
placeholder="<?php echo trim( qa_lang_html( 'users/password_label' ), ':' ); ?>"/>
</li>
<li>
<label class="checkbox inline">
<input type="checkbox" name="remember" id="qa-rememberme"
value="1"> <?php echo qa_lang_html( 'users/remember' ); ?>
</label>
</li>
<li class="hidden">
<input type="hidden" name="code"
value="<?php echo qa_html( qa_get_form_security_code( 'login' ) ); ?>"/>
</li>
<li>
<button type="submit" value="" id="qa-login" name="dologin" class="btn btn-primary btn-block">
<?php echo $this->content['navigation']['user']['login']['label']; ?>
</button>
</li>
<li class="forgot-password">
<a href="<?php echo qa_path_html( 'register' ); ?>"><?php echo qa_lang_html( 'users/register_button' ); ?></a>
|
<a href="<?php echo qa_path_html( 'forgot' ); ?>"><?php echo qa_lang_html( 'users/forgot_link' ) ?></a>
</li>
</form>
</ul>
</li>
</ul>
<li>
<label>
<?php echo trim( qa_lang_html( 'users/password_label' ), ':' ); ?>
</label>
<input type="password" class="form-control" id="qa-password" name="password"
placeholder="<?php echo trim( qa_lang_html( 'users/password_label' ), ':' ); ?>"/>
</li>
<li>
<label class="checkbox inline">
<input type="checkbox" name="remember" id="qa-rememberme"
value="1"> <?php echo qa_lang_html( 'users/remember' ); ?>
</label>
</li>
<li class="hidden">
<input type="hidden" name="code"
value="<?php echo qa_html( qa_get_form_security_code( 'login' ) ); ?>"/>
</li>
<li>
<button type="submit" value="" id="qa-login" name="dologin" class="btn btn-primary btn-block">
<?php echo $this->content['navigation']['user']['login']['label']; ?>
</button>
</li>
<li class="forgot-password">
<a href="<?php echo qa_path_html( 'register' ); ?>"><?php echo qa_lang_html( 'users/register_button' ); ?></a>
|
<a href="<?php echo qa_path_html( 'forgot' ); ?>"><?php echo qa_lang_html( 'users/forgot_link' ) ?></a>
</li>
</form>
</ul>
</li>
</ul>
<?php
unset( $this->content['navigation']['user']['login'] );
unset( $this->content['navigation']['user']['register'] );

0 comments on commit 40ff07e

Please sign in to comment.