Cagatay Belgen
asked 7 years ago

Hello,

I want to put social login buttons instead of classic DW Q&A "Login to ask question button"

I managed to integrate everything except this last issue.

Here’s a screenshot
Screenshot

Where should I put the code below?

 <?php do_action( 'wordpress_social_login' ); ?> 

btw, I managed to arrange the login as I wish on single question page by editing answers.php
here’s my single question page where everything is allright https://www.seoprix.com/seo-sorusu/alan-adi-degisimi-seoya-zarar-verirmi/ (see below)

here’s my main Q&A page where I want to change login button with social icons https://www.seoprix.com/seo-sorulari/

3 Answers
DominicStaff
answered 7 years ago

To resolve this issue, you can add the following code to the style.css file:

.dwqa-list-question .filter {  clear: left;}
.wp-social-login-widget {
  float: right;
  width: 188px;
}
.wp-social-login-connect-with {
  font-size: 18px;
  background-color: #5cb85c;
  color: #fff;
  border-radius: 7px;
  border: 1px solid #5cb85c;
  text-align: center;
}
.wp-social-login-provider-list a {
  margin-right: 23px;
}
.dwqa-list-question .filter-bar .dwqa-btn, .dwqa-list-question .archive-question-footer .dwqa-btn {
  display: none;
}

After adding code, you can open the \plugins\dw-question-answer\inc\template-functions.php file. Find the line 503.

Replace the following code:
$submit_question_link = wp_login_url( $submit_question_link );

With new code:
$submit_question_link = do_action( 'wordpress_social_login' );
Hope this helps !

cagatay
replied 7 years ago

worked perfect! thank you. One last question (dont want to open a new question) the dates are displayed in English ( 25 July 2015 instead of 25 Temmuz 2015) What could be the issue?

Cagatay Belgen
answered 7 years ago

Ok now I discovered an issue;

The login buttons at the top of the question list are not clickable, but the buttons below questions work fine.

Here’s a screenshot
![Screenshot](http://i57.tinypic.com/5fg9qh.jpg "Screenshot")

another little issue which is, the dates are displayed in English ( 25 July 2015 instead of 25 Temmuz 2015) What could be the issue?

Those 2 are my last issues.

Thank you in advance.

cagatay
replied 7 years ago

update: when user login, "ask a question" button doesn’t appear.

DominicStaff
answered 7 years ago

Hi,
Issue1: To resolve this issue, you can open the \plugins\dw-question-answer\inc\template-functions.php file. Find the line 499.
Replace the following code:

if ( dwqa_current_user_can( 'post_question' ) ) {
            $label = $label ? $label : __( 'Ask a question', 'dwqa' );
        } elseif ( ! is_user_logged_in() ) {
            $label = $label ? $label : __( 'Login to ask a question', 'dwqa' );
            $submit_question_link = wp_login_url( $submit_question_link );
        } else {
            return false;
        }

With new code:

if ( dwqa_current_user_can( 'post_question' ) ) {
            $label = $label ? $label : __( 'Ask a question', 'dwqa' );
            $submit_question_link = wp_login_url( $submit_question_link );
        } elseif ( ! is_user_logged_in() ) {
            $label = $label ? $label : __( 'Login to ask a question', 'dwqa' );
            $submit_question_link = do_action( 'wordpress_social_login' );            
        } else {
            return false;
        }

Then add the following code to the style.css file:

.wp-social-login-widget {
    width: 188px;
    position: absolute;
    right: 15px;
    z-index: 1;
    margin-top: 6px;
}
.wp-social-login-widget {
  float: right;
  width: 188px;
}
.wp-social-login-connect-with {
  font-size: 18px;
  background-color: #5cb85c;
  color: #fff;
  border-radius: 7px;
  border: 1px solid #5cb85c;
  text-align: center;
}
.wp-social-login-provider-list a {
  margin-right: 23px;
}
.dwqa-list-question .filter-bar .dwqa-btn, .dwqa-list-question .archive-question-footer .dwqa-btn {
  display: none;
}
.dwqa-list-question .filter {
    padding: 32px 20px;
  }

Note: Remove all the codes line that I have provided in the previous answer.

Issue2: About the date section, you can open the \wp-content\plugins\dw-question-answer\dw-question-answer.php file. Find the line 371.

In the line 406:

Replace the following code:
return date( $format, $from );

With new code:
return date_i18n( get_option( 'date_format' ), $from );

Hope this helps !

Powered by DW Question & Answer Pro