TruthMerchant
Forum Replies Created
-
Forum: Plugins
In reply to: [Simple Custom CSS and JS] Can’t change padding on site headerThat doesn’t seem to work either….
In addition, I assert “.mc1-rate-before” via a filter on <body> so that I can selectively apply the css rules I want. The only thing that seems to work is to use the “#masthead” selector, but as soon as I add “.mc1-rate-before” it stops working. I though that a header style sheet overrules a linked file. But that seems a bogus claim.
Forum: Plugins
In reply to: [Simple Rating] SSL causes failureMy updates are an appropriate address of the actual problem in that they “get around” THE actual bug in WordPress core and nothing more or less. I always wanted to use “FORCE_SSL_ADMIN” since I started using a “real” ssl cert as opposed to “self signed”. This “admin only” functionality has not been deprecated. It was simply breaking “Simple Rating” and other rating plugins. That is why I used “FORCE_SSL_LOGIN”.
I will assume that any further releases of “Simple Rating” will address this core bug with my suggested changes or in some other way. And I would ask that you mark this issue resolved.
Use
$scheme = is_ssl() ? 'https' : 'http';
and then assert the proper $scheme on he admin_url function call.
Maybe there should be an “load_ajax_object” function that does all of the necessary formulation and loading of the ajax object. e.g. you can’t have an ajax object without an ajax back request to the server and that back request would normally be the same protocol as the current page regardless of “force_ssl_admin”.
Forum: Plugins
In reply to: [Simple Rating] SSL causes failureForcing all traffic to ssl is not (for me) a good “workaround”. But after a few more days of rummaging around in WordPress core and such I found that the protocol on the request back to the server (used to facilitate AJAX) is defined wrongly by the “admin_url” function.
On further investigation I found that the problem came about in WordPress 4.0 when “FORCE_SSL_LOGIN” was deprecated. As of 4.0 it is both “ADMIN” and “LOGIN” or neither because the function “force_ssl_admin” returns “true” if either of the aforesaid globals are defined “true”. That means that the “default” protocol returned by “admin_url” will always be ‘https’. And that causes the browser to see the AJAX request as “cross domain” and to NOT send the “COOKIES”.
SOLUTION:
Update “rating.php” in the “simple_rating” directory as follows:
Using your favorite text editor, insert immediately ahead of
if (is_user_logged_in()==1)
at line 210, a new line of code as
$scheme = is_ssl() ? 'https': 'http';
Then use the search and replace function of your editor to replace all instances of
=>admin_url('admin-ajax.php'
with
=>admin_url(‘admin-ajax.php’,$scheme`This should make the plugin function properly REGARDLESS of what you do with SSL. All ssl, no ssl, login ssl admin ssl, or per page ssl or whatever.
Forum: Fixing WordPress
In reply to: FORCE_SSL_ADMIN and admin-ajax.php problemWhen 4.0 deprecated “FORCE_SSL_LOGIN” it broke a lot of public facing plugins that use AJAX. If the plugin is using
“admin_url(‘admin-ajax.php), relying on this function to properly define the protocol. then the ‘https” protocol will be asserted causing the AJAX to fail to send COOKIES (authorizations). It fails because the page that sent the AJAX object was operating as “http” and the browser sees the ‘https’ AJAX request back to the page as being “cross domain”.For now…..
so… in the plugin:
use
$scheme = is_ssl() ? 'https' : 'http';
//define proper protocol,and
admin_url(admin-ajax.php,$scheme)
, // specify the protocolIMHO there should probably be a core function named “ajax_url(…)” that handles this problem and also uses a “nonce” with the time being part of the arguments.
Forum: Plugins
In reply to: [Simple Rating] Request control of user/visitor ratings per post typeThe short answer to your question is “yes”.
If I had my real wish, the tables would contain a rating for both types of interaction. But there is also the possibility that a visitor rating can be distinguished from a member rating by observing the actual data in spr_votes.user_id.
Display of a post of whatever type could optionally show two ratings on each post side by side: The member rating, and the visitor (facebook, oe whatever) rating (if applicable). But I know not how to “compartmentalize” the current javascript so I can load it twice per post and have it work. That, for me, is a pretty tall order. For the present I am hoping for an upgrade to “simple Rating” that would allow the selection of whether rating for members only, or for everyone, to be a per post type decision.
The Simple Rating plugin is active at Assembly Tacoma with no alterations of any kind. But I have created a “ballots” plugin to manipulate the spr_votes and spr_rating tables as is demonstrated under the “Articles” menu item. Folks can log in as “demo” with password “demo” to see how this plugin allows members to change their rating or remove it. The plugin also allows folks to see the actual ballot box. I am considering getting rid of my plugin, adopting yours, and extending it, I just do not have time to learn javascript.
Forum: Plugins
In reply to: [Simple Rating] HELLPAll debugging stuff removed and the plugin works just fine. There is still something wrong on this server in how the hosting service handles “error_log”, but that is not any problem with the plugin. Thanx for helping me figure this out!!! This deal is RESOLVED.
Forum: Plugins
In reply to: [Simple Rating] HELLPI put some debug stuff (calls to error_log) in function spr_rate with the following results showing up in the system logs but not in my error log file:
[14-May-2014 01:59:31 UTC] entry into ‘spr_rate’
[14-May-2014 01:59:31 UTC] spr_rate – User is logged in
[14-May-2014 01:59:31 UTC] spr_rate – post exists
[14-May-2014 01:59:31 UTC] spr_rate – user hasn’t voted yet
[14-May-2014 01:59:31 UTC] spr_rate – making new spr_raing entry
[14-May-2014 01:59:31 UTC] spr_rate – responding through jason
with new rating and show_votedThat last output is right before line of code that says:
$response=json_encode(array('status'=>1, 'html'=>$html))
should have sent the good stuff to the browser and the browser should have acted on it I think.
Forum: Plugins
In reply to: [Simple Rating] HELLPMajor progress has been made!!! I know not why my php.ini settings for redirecting error output to public_html/error_log are not operating in the case of the admin-ajax.php file, but they aren’t. As you said, THE system logs show the proper contents for $_POST and $_REQUEST now and I am doing a happy dance about being able to see stuff. I should be able to find the problem from this point. I appreciate your help on this and I will post more when I find out more.
Current condition is that the database is updated but the on-screen display shows no indication of the rating being updated. When I do a refresh, I see the vote as tallied and I am unable to vote again. I assume we are returning some sort of error in the “jason” stuff. I will check it out and report back.
Forum: Plugins
In reply to: [Simple Rating] HELLPWow!! Thanx for the fast response… The code I had in admin ajax was:
function my_error_dump ($name, $var) {
ob_start();
var_dump($var);
$result = “$name ” . ob_get_clean();
error_log($result);
}
my_error_dump(“POST = “, $_POST);
my_error_dump(“REQUEST = “, $_REQUEST);echo “Hello World”;
var_dump($_SERVER);I have removed the last 2 lines so no more output to browser. I am not conversant with jquery and javascript and so cannot debug in the browser. I really want this plugin to work, but I can’t seem to figure out why it doesn’t. From what you say the admin ajax code is being entered (you get the hello world in the browser) yet I see no output in the error log. Weird.
Table spr_votes is still empty so it would appear that admin ajax is not connecting with “function spr_rate()”. I am surprised that you got the “Hello World”. That says that the browser is, in fact, issuing something to the server.
Forum: Plugins
In reply to: [Easy] Very confused about metaI appreciate your indulgence and your willingness to take further improvements under advisement. I will consider this topic closed and will open a new topic should I find some “slick” way to do what I need to do with the easy plug-in. What is already there is really very good ?? Thank you.
Forum: Plugins
In reply to: [Easy] Very confused about metaI understand about the “meta” brick and how to use it and even how to “AND” it with another “meta” brick (I think). What I don’t understand is how to use the “meta_value” and “meta_value_num fields in the “Order” brick to order posts according to a “Ratings” meta key and value I have created.
I am guessing that I am supposed to precede the “Order” brick in which “meta_value” or “meta_value_num” are specified (I know not which) with a “Meta” brick identifying my “Ratings” key value pair and in that “Meta” brick, state an “AND” condition to attach the ensuing “Order” brick. Preceding this pair of bricks is the “Meta” test for “featured” with the AND specified in that brick compleres the chain. That is how my peanut brain has assessed this situation.
The real question is how to use the “Order” brick to sort on a particular meta value.
Be advised that while I am attempting to do this I have a lot of other stuff cluttering up the water.
One thing that seems to be happening is that the “shadow box” for the drag and drop destination becomes very far removed from the pointer. Before I realized that was the case I concluded that the plug-in was just flat broke. It isn’t. It does work. But I am I understanding how the “Order” brick is to be connected to a particular “Meta” key?
Forum: Plugins
In reply to: [WP-Polls] recording votes to usersI run a members only WP site assemblytacoma.org that is a participatory democracy. I am the world’s worst software person but have managed to employ a wp table to relate user ID, post ID, and score and to present posts in “rated”/ “score” order while displaying the score. I also display all the ballots such that all members can see their ballot in the box as well as all other ballots. Anonymity depends on the members. If they want anonymity they select a login ID that is nothing like their real name. The voting/scoring mechanism/navigation is a real mess and I would like for a member to be able to select a post, view it, and rate it, recording that rating ON THE MEMBER’S BALLOT (each member has a ballot via the previously described table and each member can change their ratings at any time and display the current results and ballots).
Is it rational to try to (ab)use this WP_POLL plugin to make my system more user friendly? You can log in to assemblytacoma.org as user demo with password demo to see what I am talking about if that helps. You can’t create posts as demo but you can rate stuff. those ratings are wiped every day. The demo account will soon be closed.
Forum: Hacks
In reply to: add_filter('wp_nav_menu_items', 'my stuff') not working?I have come to the conclusion that messing with menus is simply not a plugin thing to do. The theme people and the wordpress core people seem to do things in such a way as to prevent isolation of ones code in a valid plugin. That may well have to do with an idealized view wherein “functionality” is to remain separated from “presentation”. The intersection of these two worlds happens at “menu”.
If I administer the theme properly, and name and select the menu “bar” appropriately then the plugin code can be made to work as I want. I think that is messy, but I will have to abide it.
I appreciate your taking an interest and I did what you said. The code that links up to the filter I was using is not executed because of the way the theme is done. That will be a problem (I think) with all themes. My reaction is to figure out a way to make my stuff work regardless of the theme. But that is probably not the best way to go. I need to “fit in” with the way the theme people do things. It means that I will have to provide good documentation on how to do the menus using the “appearance->menus” manual stuff….. Oh well….
Forum: Plugins
In reply to: [Sweet Captcha] Sweet Captcha fails after site relocationWhat I did to resolve this problem in the test site was to zap the ID and password/secret areas of the live setup form, click save changes and then exit the setup. I was presented with a notification that SweetCaptcha was not properly set up and directed to “click here”. In doing so I was awarded a new ID and such and that took care of the problem. But I understand that this has left some trash in your SweeCaptcha tables. I will endeavor to clean it up by contacting you via email.