Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
in Plugins by

It's creating issues when looking a the site through https (since I'm using shared hosting)

http_site: mysite.com/
https_site: https://gator0101.hostgator.com/~username/


Error message: 


[blocked] The page at 'https_site/question_url' was loaded over HTTPS, but ran insecure content from 'http_site/qa-plugin/q2apro-on-site-notifications/styles.css': this content should also be loaded over HTTPS.


Q2A version: 1.6.3

1 Answer

0 votes
Thanks for your reply (and thanks for the plugin), yet I was still getting the errors. I changed lines 46 & 47 and these are gone (yet I'm worried about side effects). also the link in the actual notification pop-up is still taking me to my http_site
I think I got the link to work by changing line 185 in q2apro-onsitenotifications-page.php to qa_path_html('')
You mean: https://github.com/q2apro/q2apro-on-site-notifications/blob/master/q2apro-onsitenotifications-page.php#L185 ?

$activity_url = qa_path_html(qa_q_request($parent['postid'], $parent['title']), null, qa_opt('site_url'),null,$anchor);
yes, i replaced qa_opt('site_url') with qa_path_html('')
I think qa_path();  should work as well, I wonder what I'm missing :/
1. It would be very interesting to know, which value you have in database table qa_options, field site_url. And compare this to your domain.

2. What happens if you replace qa_opt('site_url') with null? In line 185 in file q2apro-onsitenotifications-page.php ?

1) I have http://respuestas.ca/ in table table qa_options
2) null seems to work fine as well :)

3) I noticed answers and comments notification were giving me the right url, yet upvotes are still using the site_url, so I might be missing replacing it somewhere else
edit: yeap, i found it in several places :/
Use qa_path(null) instead of qa_path(), otherwise you get PHP Warning:  Missing argument 1 for qa_path()
I have updated all plugin files to prevent the use of qa_opt('site_url'). Please download the latest version: https://github.com/q2apro/q2apro-on-site-notifications and tell me if it works for you (also the icons that use qa_path_absolute() now).
Thanks for putting the time and effort!. I tested the new version, yet I have reveser a few changes in q2apro-onsitenotifications-page.php (lines 187 & 199)

There I had:
$activity_url = qa_path_absolute(qa_q_request($parent['postid'], $parent['title']), null, $anchor);

and I changed it a bit to
$activity_url = qa_path(qa_q_request($parent['postid'], $parent['title']), '', $anchor);

Using qa_path_absolute was taking me to the same address defined in the site_url variable (the http_site)
I think I need to do more changes, If I'm at the admin tab and click on a notification I get and "/admin/" string added in my url (therefore Not found error).

You will probably know best, but I think using an empty string ( ' ' ) instead of null provide me a pseudo absolute path? (I mean a relative path which is always based on the site root, without including the domain name).
"click on a notification I get and "/admin/" string added in my url"
This is because you use qa_path(). Problem is: The AJAX call goes to the server, the server does not know that you are at /admin/ and assumes you are in the root. It returns the relative path "./123/question" which gets added to your *recent* URL. That's why you must use an absolute path, not relative ones. I hope this explanation makes it clear ;-)

The "https" issue is indeed a special one, and maybe you are the only one having this issue currently. My ideas:

1. Do the ajax call with https? see "var eventNotify = ..." (use the https instead http)
2. Do not use https anyways.
3. Maybe there is a way for the server to check if it is a httpS request, then you could build a workaround.

The error message you mentioned in your question, is it coming from JS or PHP? I assume JS, then see here as well: http://stackoverflow.com/q/22196927/1066234