WordPress.org

Ready to get started?Download WordPress

Forums

Simply Poll
Simply Poll not displaying resultss (46 posts)

  1. kaotik78
    Member
    Posted 2 years ago #

    HI,

    I've got Simply Poll installed, it displays the poll questions. When you vote on a question and click submit nothing is shown, just white space.

    Viewing the source shows that the code is there but not visible. Refreshing the page, brings the voting choices back but once you click on a choice, the selections fade out, and only white space remains, no results show up.

    WordPress v3.1.4
    PHP v5.1.4

    Thanks!

    http://wordpress.org/extend/plugins/simply-poll/

  2. WolfieZero
    Member
    Plugin Author

    Posted 2 years ago #

    I've tried to replicated the issue on my local machine but to no avail. The issues appears to be something with the Javascript (jQuery).

    I think it's hitting the $.ajax() function and failing there; I'm not sure if it's the call back it will have an issue with or the returned results. Are you able to show the page where you have installed SP that I can have access too?

    (I will put a note in to add some debugging features in a future update)

  3. kaotik78
    Member
    Posted 2 years ago #

    I appologize, I failed to also mention that when installing the plugin, I received this error.

    "The plugin generated 506 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin."

    The site can be viewed here: http://tinyurl.com/7t8uc2o

  4. WolfieZero
    Member
    Plugin Author

    Posted 2 years ago #

    Ah, you are missing a file for some reason. The error the console is giving me is

    POST http://www.shaunnelson.com/wp-content/plugins/simply-poll/page/user/poll-submit.php 404 (Not Found)

    Try uninstalling and installing the plugin again. If that doesn't work then try and download the plugin and manually upload it to your plugins folder and see if that works.

    If none of that works then I might need to specifically check the plugin against the WP and PHP versions you specified.

  5. kaotik78
    Member
    Posted 2 years ago #

    Strange, I ftp'd into the directory and the file is there. I've uninstalled and re-installed the plugin. The plugin was installed by ftp'ing the folder to the plugins directory then activating it via the WP control panel. Funky path issue prehaps with the version of PHP I'm using?

    The URL in the POST is missing the /wordpress_31/ directory. It should read like this below.

    http://www.shaunnelson.com/wordpress_31/wp-content/plugins/simply-poll/page/user/poll-submit.php

    Is there something in the poll code that assumes the wordpress installation is at root level?

  6. WolfieZero
    Member
    Plugin Author

    Posted 2 years ago #

    Ah, that will be it then! It's not picking up the real full path. I have presumed the WP install is always root.

    I won't be able to do it today but I'll try and push an update tomorrow to tackle that very issue.

    Good spot! I use a mu installation as well, but my sites are setup to run via a sub-domain so I'm always working from root.

  7. kaotik78
    Member
    Posted 2 years ago #

    I just changed the path in the config.php file but it still isn't working.

    define('SP_URL','http://'.$_SERVER['HTTP_HOST'].'/wordpress_31/wp-content/plugins/simply-poll/');
    
    define('SP_URI',$_SERVER['DOCUMENT_ROOT'].'/wordpress_31/wp-content/plugins/simply-poll/');

    Hmmm I'm determined to figure this out cause I like the simplicity of the poll.

  8. WolfieZero
    Member
    Plugin Author

    Posted 2 years ago #

    haha goes in hand with the name.

    It's still the wrong URL according to console. You'll eliminate a few steps in testing by keeping the console open as chances are any issues are Javascript based.

  9. kaotik78
    Member
    Posted 2 years ago #

    What console are you referring to, a Firefox console or a WordPress console?

  10. WolfieZero
    Member
    Plugin Author

    Posted 2 years ago #

    I use Chrome, which has one built in, but Firefox you'll need the Firebug add on to get the console.

  11. kaotik78
    Member
    Posted 2 years ago #

    I am running one for Firefox, I see the path is correct now in my console.

    Still not coming up with results after submitting the vote.

    --
    [11:43:44.975] Use of getAttributeNode() is deprecated. Use getAttribute() instead. @ http://www.shaunnelson.com/wordpress_31/
    [11:43:45.003] Use of attributes' nodeValue attribute is deprecated. Use value instead. @ http://www.shaunnelson.com/wordpress_31/
    [11:43:45.610] POST http://www.shaunnelson.com/wordpress_31/wp-content/plugins/simply-poll/page/user/poll-submit.php [HTTP/1.1 200 OK 281ms]
    [11:43:45.807] POST http://www.shaunnelson.com/wordpress_31/ [HTTP/1.1 200 OK 547ms]

    It seems to point to the correct path now.

  12. WolfieZero
    Member
    Plugin Author

    Posted 2 years ago #

    Hmm, to better check something I'll need you to add a line to the code.

    Go to /simply-poll/script/simplypoll.js and on line 48 can you add console.log(data); and on line 56 add console.log(html); then we can see if we are getting an AJAX response and what's coming back.

  13. kaotik78
    Member
    Posted 2 years ago #

    Ok, give it a try.

  14. WolfieZero
    Member
    Plugin Author

    Posted 2 years ago #

    Odd, the script isn't sending any data back from the first ajax request. I think I know what the issue is and it's to do with the subdomain.

    I'm going to be offline for the rest of the night, but I'll setup a local environment tomorrow and get that issue replicated and thus fix it. I can let you know the fixes involved as well if you like?

    You can take those console.log() functions out now. Thanks for being helpful trying to solve this issue; I will try and get the fix up tomorrow.

  15. kaotik78
    Member
    Posted 2 years ago #

    Thank you for your help!! Regardless of the outcome, I do appreciate it!

  16. kaotik78
    Member
    Posted 2 years ago #

    I realize your offline but I'm still plugging away. Thus far I've been able to get the poll to work but only by doing the following.

    modifying wproot.php to include my subdirectory

    $wpRoot = $_SERVER['DOCUMENT_ROOT'].'/wordpress_31';

    and changing the config.php lines to the following

    define('SP_URL', 'http://'.$_SERVER['HTTP_HOST'].'/wordpress_31/wp-content/plugins/simply-poll/');
    define('SP_URI', $_SERVER['DOCUMENT_ROOT'].'/wordpress_31/wp-content/plugins/simply-poll/');

    You can vote, but the results do not show UNLESS you refresh the browser, then you can see the results.

    A step in the right direction though I think!

  17. WolfieZero
    Member
    Plugin Author

    Posted 2 years ago #

    I'm back online and working on the plugin.

    I noticed that I've not done some of the file locations correctly so I'm now working on getting all those correctly done. I'm working on a local setup that's running a multisite with sub-folders so I should get this right but I'll do a setup where it's a single WP in a sub-folder; so trying to cover all angles here!

  18. kaotik78
    Member
    Posted 2 years ago #

    Sounds great! Just drop a line when you would like me to test :)

  19. kaotik78
    Member
    Posted 2 years ago #

    Just checking in to see when you'd like me to retest the poll.

  20. WolfieZero
    Member
    Plugin Author

    Posted 2 years ago #

    Not yet, just been caught up with a few other bits. On the job at the moment though. Thanks :)

  21. WolfieZero
    Member
    Plugin Author

    Posted 2 years ago #

    So to give an overview of what I've been doing and why it's taking it's time.

    I use a script to pull in the WordPress functions and settings so that external files can use them. The script is

    $wpRoot = $_SERVER['DOCUMENT_ROOT'];
    
    	if (file_exists($wpRoot.'/wp-load.php'))
    		require_once($wpRoot.'/wp-load.php');
    	else
    		require_once($wpRoot.'/wp-config.php');

    The issue is that it doesn't work so well when it comes to multi-site installs as it loses the settings for a particular site; so the database prefixes and folder/domain names resolve back to the main domain.

    I'm wondering if anybody knows of any other way to grab the WP functions and settings for external files that will work for a multi-site setup?

  22. WolfieZero
    Member
    Plugin Author

    Posted 2 years ago #

    Apparently this is a bad way of doing it, so I'm currently looking at 5 tips for using AJAX in WordPress to understand how to include the file correctly.

  23. WolfieZero
    Member
    Plugin Author

    Posted 2 years ago #

    Right, it's working for me locally!

    Let me just tidy up a few things and I'll get an beta to you to have a got with.

    Side note; I'm glad you brought this up as it's taught me a different way of handling the data. It's actually working a lot more effectively for javascript users now, but I need to test for none-javascript users as well.

  24. kaotik78
    Member
    Posted 2 years ago #

    Awesome, can't wait to give it a shot! I'm just glad I could have helped!

  25. WolfieZero
    Member
    Plugin Author

    Posted 2 years ago #

    Here we go dude, a beta copy of Simply Poll 1.4

    http://cl.ly/0u050n0b0s2Y2k3E0F3p

  26. kaotik78
    Member
    Posted 2 years ago #

    Ok I've got it up on the site. It's not displaying the poll results once submitted still. I'm wondering if something is not configured properly on my server if it's working fine for you.

  27. WolfieZero
    Member
    Plugin Author

    Posted 2 years ago #

    Okay, just to make things easier I've updated the code slightly but also added a logger to make debugging easier.

    http://cl.ly/2m1J1P3y0m0z1O2u1V1k

    When you've tested it and it's failed again simply post the log file on here (it's safe, it doesn't store any personal details, only poll IDs and what's been accessed and when). you can switch off the logger by setting the value in config.php from
    define('SP_DEBUG', true);
    to
    define('SP_DEBUG', false);

    Cheers for still helping, I know I must be a pain!

  28. kaotik78
    Member
    Posted 2 years ago #

    Morning! I'll give that a shot. It's not a pain at all to help out! We're getting somewhere :)

  29. kaotik78
    Member
    Posted 2 years ago #

    11:41:13/12.07.11 - spSubmit()
    11:41:13/12.07.11 - $_POST - Array
    (
    [action] => spAjaxSubmit
    [poll] => 2
    [answer] => 2
    )

    11:41:13/12.07.11 - The int 2 has been accepted
    11:41:13/12.07.11 - $answer - Array
    (
    [answer] => test 2
    [vote] => 6
    )

    11:41:13/12.07.11 - $json - {"answer":{"answer":"test 2","vote":6},"pollid":2}
    11:41:13/12.07.11 - spResults()
    11:41:13/12.07.11 - $_POST - Array
    (
    [action] => spAjaxResults
    )

    11:41:13/12.07.11 - $results - Array
    (
    [polls] => Array
    (
    [0] => Array
    (
    [id] => 1
    [question] => Which roast do you prefer
    )

    [1] => Array
    (
    [id] => 2
    [question] => test
    )

    )

    )

    11:41:58/12.07.11 - spSubmit()
    11:41:58/12.07.11 - $_POST - Array
    (
    [action] => spAjaxSubmit
    [poll] => 2
    [answer] => 1
    )

    11:41:58/12.07.11 - The int 1 has been accepted
    11:41:58/12.07.11 - $answer - Array
    (
    [answer] => test 1
    [vote] => 5
    )

    11:41:58/12.07.11 - $json - {"answer":{"answer":"test 1","vote":5},"pollid":2}
    11:41:59/12.07.11 - spResults()
    11:41:59/12.07.11 - $_POST - Array
    (
    [action] => spAjaxResults
    )

    11:41:59/12.07.11 - $results - Array
    (
    [polls] => Array
    (
    [0] => Array
    (
    [id] => 1
    [question] => Which roast do you prefer
    )

    [1] => Array
    (
    [id] => 2
    [question] => test
    )

    )

    )

  30. WolfieZero
    Member
    Plugin Author

    Posted 2 years ago #

    Awesome, that's great.

    So from the looks of this you are recording the answer but the script doesn't know what results to pull.

    11:41:59/12.07.11 - spResults()
    11:41:59/12.07.11 - $_POST - Array
        (
            [action] => spAjaxResults
        )

    This part is missing the value [pollid] => 2.

    I'll have a look into this and see why that would happen. Thanks for that!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic