• Resolved IAmMarchHare

    (@iammarchhare)


    People running the Total Security plugin are recommended to change permissions on the wp-admin directory to 750. This has implications on any AJAX plugin, or so I’ve learned. I’m no WP programmer by any stretch of the imagination, but this seems contradictory at best.

    What is odd, though, is that I get different results depending upon the circumstances.

    In testing both of my current sites, I got the “An error has occured [sic]!” error box. I set the poll for registered users to vote in, but guests and registered users to view. However, guests cannot view it regardless and get the box. No big deal, but the error message is rather generic. I changed the .js script to state “An error has occured! Did you login first?” whenever an error occurs.

    However, after uploading, only one site works as intended. On https://www.cogperspective.org, I can logout, and when I try to vote or view results, no error box pops up? It worked on an exact copy I had downloaded, so I’m at a loss at what is going on. Why it would work on one site and not the other is confusing, and the fact that it seemed to work on a test download makes it even more interesting.

    If I get time to re-download and remake the local test, I might try it again, but it is tax season. ??

    https://www.ads-software.com/plugins/yop-poll/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author YOP

    (@yourownprogrammer)

    Hi IAmMarchHare,

    The other plugin you use redirects the ajax to login and our plugin does not receive [response]answer[/response] so when it comes to extracting the answer the script crashes.

    Edit js/yop-poll-public.js and in yop_poll_extractResponse and yop_poll_extractApiResponse fundtions replace

    resp[1];

    with

    if ( resp instanceof Array ) {
            return resp[1];
        }
        else {
            return '{"error":"the_message_you_want","success":"","message":""}';
        }

    Best wishes,

    YOP Team

    Thread Starter IAmMarchHare

    (@iammarchhare)

    First of all, let me thank you for what has to be the fastest response I’ve ever received on a WP plugin, paid or not.

    Should there be parentheses or something around the replaced text, though? Again, my programming skills don’t involve JS or even PHP for that matter, but being a C programmer in a prior life makes me think it looks odd. Worse, it doesn’t seem to change anything when updated.

    In context, here is the first function following the above exactly:

    function yop_poll_extractResponse( str ) {
    	var patt	= /\[ajax-response\](.*)\[\/ajax-response\]/m;
    	resp 		= str.match( patt )
    	return if ( resp instanceof Array ) {
    	        return resp[1];
    	    }
    	    else {
    	        return '{"error":"the_message_you_want","success":"","message":""}';
    	    }
    }
    Plugin Author YOP

    (@yourownprogrammer)

    Hey IAmMarchHare,

    Sorry about that, it was our bad.

    You should replace return resp[1]; with the code we provided so the first function should look like this:

    function yop_poll_extractResponse( str ) {
    	var patt	= /\[ajax-response\](.*)\[\/ajax-response\]/m;
    	resp 		= str.match( patt )
    	if ( resp instanceof Array ) {
    	        return resp[1];
    	    }
    	    else {
    	        return '{"error":"the_message_you_want","success":"","message":""}';
    	    }
    }

    Regarding the text replaced there is no need for any parentheses, just the message.

    Regards,

    YOP Team

    Thread Starter IAmMarchHare

    (@iammarchhare)

    The second one, yop_poll_extractApiResponse(), seems to work just fine (although it displays text and not a popup, but I can live with that), but the first one (in the example you gave last) does not for some reason. I even re-copied and pasted exactly what you wrote above. ??

    Plugin Author YOP

    (@yourownprogrammer)

    Hi IAmMarchHare,

    When you say that it doesn’t work do you mean that it does not do anything or that the poll is not being displayed?

    If it does not return the answer in the correct format, then it sends the one built in the “else” branch.

    If you want to add a popup then before
    return '{"error":"Eroare","success":"","message":""}'; add

    alert( 'your_mesage' )

    Regards,

    YOP Team

    Thread Starter IAmMarchHare

    (@iammarchhare)

    By “not work” I mean that while not logged in, I select an option from the poll and click on the Vote button, and the page refreshes with no error message at all. If I click on View Results, I get the appropriate error message.

    Plugin Author YOP

    (@yourownprogrammer)

    Hi IAmMarchHare,

    Can you provide us a link to a page where we can find the poll? We found a poll at https://www.cogperspective.org/, in the sidebar, but it seems to work well.

    Regards,
    YOP Team!

    Thread Starter IAmMarchHare

    (@iammarchhare)

    Interesting! I decided to try Firefox this morning instead of Chrome, and clicking on the Vote button brings up a login dialog. Even Chrome in icognito mode doesn’t seem to do anything but refresh the entire page, so it doesn’t look like a browser plugin issue. Chrome must be blocking the popup for some reason.

    Thread Starter IAmMarchHare

    (@iammarchhare)

    OK, I got Chrome to accept popups on that page. It took a little figuring out because the block popups box in the address bar quickly appears and then disappears (which is why I never noticed it), so I had to figure out the manual process to do it.

    Thank you for your help.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘YOP, Total Security and wp-admin permissions’ is closed to new replies.