WordPress.org

Support

Support » Plugins and Hacks » [Resolved] results from one poll populating to all polls

[Resolved] results from one poll populating to all polls

  • 401frankie
    Member

    @401frankie

    Hi!
    the set-up: yop poll inserted into tablepress table.
    Each state has 1 page. take “alabama” for example. within the “alabama” page there is a tablepress table with the names of individual sites such as “alabama artificial limb”. Each site is a line of the table. the yop poll was inserted via “copy and paste” individually in each box of the table.
    the results from one poll are populating all polls with the same question, even across different pages!
    http://www.databasedog.com/wordpress/?page_id=30
    How can I fix this?
    Thanks!

    http://wordpress.org/plugins/yop-poll/

Viewing 15 replies - 1 through 15 (of 23 total)
  • TobiasBg
    Participant

    @tobiasbg

    Hi,

    thanks for your post, and sorry for the trouble.

    I’m not familiar with YOP poll, but my assumption here is that you need to pass some sort of unique ID to each poll. Otherwise, it will take e.g. the current post’s ID which is the ID of the page with the table. And with that, all polls are actually the same one.

    Regards,
    Tobias

    401frankie
    Member

    @401frankie

    thank you. that is a good idea.
    1) how do i go about that? an example of the poll looks like this: [yop_poll id=”2″]
    I am afraid if I just add some random number like [yop_poll id=”2″ 1] that it will actually be making some kind of command. Am I wrong about this? can I just add 1,2,3,4…. to the end of the poll?
    2) And, if this is the way to go about it, I have 4 polls in 566 entries. Is there a way to make it self-populate instead of entering 2,264 separate changes? maybe [yop_poll id=”2+(n+1)”] or something?
    thanks!

    TobiasBg
    Participant

    @tobiasbg

    Hi,

    ok, so each poll has an ID.
    But then you’ll have to create one poll for each residency in each state anyway, i.e. you’ll have 2,264 polls with a different ID.
    And unfortunately you’ll have to add them to the table cells manually (or use an external programming mechanism that generates a CSV that you then import into TablePress).

    Regards,
    Tobias

    401frankie
    Member

    @401frankie

    woah! I didn’t expect that answer! haha! Well, I guess i better get to work.
    Thanks,TobiasBg

    401frankie
    Member

    @401frankie

    Hi Tobias,
    how bout this? I can “clone” each poll 566 times. Is there a way that I can command the program to instantly create 566 clones instead of doing them one at a time?
    thanks!

    401frankie
    Member

    @401frankie

    OR is there a different poll that is better suited for this use?

    401frankie
    Member

    @401frankie

    TobiasBg
    Participant

    @tobiasbg

    Hi,

    sorry, for that you’ll have to wait for a reply by the YOP Poll developer 🙁

    But it’s just reasonable that you’ll need 2,264 different polls, as you seem to want to let people reply to four different questions/properties for 566 entries (which are spread over 50 states).
    So, that’s 556*4=2,264 polls.

    As this is indeed a lot of manual work (and there’s room for error, and it’s not really extensible), you might want to check out a custom solution, based on a custom mySQL table and some PHP programming.

    Regards,
    Tobias

    401frankie
    Member

    @401frankie

    Hi Tobias,
    Custom means hiring someone else? or is this available through wordpress?
    Also, you have seen the website… do you think there is a better way to do this than a poll within a table?
    **This question is open to anyone reading this! **
    I have entered around 1,200 entries (via cloning), but the room for error has me freaked out.
    Thanks again!

    401frankie
    Member

    @401frankie

    I’m unsure of what to do.
    I have now entered all the polls but this is impractical. in order to test the site I need to take some of the polls…but finding them in order to reset in over 2,000 clones is not working.
    I need a better idea.
    Is there a forum that may have other users who can suggest different plug ins?

    TobiasBg
    Participant

    @tobiasbg

    Hi,

    yes, “custom” could mean hiring someone, or developing it yourself (if you have programming skills).
    Unfortunately, I’m not aware of existing plugins that can do this. Sorry 🙁
    You could try the more general forums at http://wordpress.org/support/ or maybe ask on a platform like StackExchange.

    Regards,
    Tobias

    Plugin Author YOP
    Participant

    @yourownprogrammer

    Hi 401frankie,

    To generate more easily all the polls you need edit inc/admin.php and in
    view_all_polls_operations function where you have

    if ( 'clone' == $action ) {

    replace

    foreach ( $bulkyoppolls as $yoppoll_id ) {
                            $yoppoll_id  = ( int )$yoppoll_id;
                            $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $yoppoll_id );
                            if ( ( $this->current_user_can( 'clone_own_polls' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'clone_polls' ) ) ){
                                    Yop_Poll_Model::clone_poll( $yoppoll_id );
                            }
                            else {
                                $total_uncloned++;
                            }
                        }

    with

    foreach ( $bulkyoppolls as $yoppoll_id ) {
                            $yoppoll_id  = ( int )$yoppoll_id;
                            $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $yoppoll_id );
                            if ( ( $this->current_user_can( 'clone_own_polls' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'clone_polls' ) ) ){
                                for ( $i = 0; $i < 5; $i++ ) {
                                    Yop_Poll_Model::clone_poll( $yoppoll_id );
                                }
                            }
                            else {
                                $total_uncloned++;
                            }
                        }

    In for ( $i = 0; $i < 5; $i++ ) replace “5” wit the value you want.
    We would recommend to start with a smaller value, maximum 50, as it may take a while until all 50 clones are generated.

    To clone the poll go to “All Polls”, select the poll you want to clone and from the menu at the top, in Bulk Actions, choose Clone and click on Apply.

    This should generate the number of clones you want.

    Regards,

    YOP Team

    TobiasBg
    Participant

    @tobiasbg

    Hi,

    good to hear that there’s an automated way to create those polls!
    It will still be some work to insert them into the tables.

    Regards,
    Tobias

    401frankie
    Member

    @401frankie

    thanks! I have already entered them, but I am grateful to have that info and will use it next time.
    So… now that I have all the clones in there, is there a way to “reset all” without clicking the boxes of each poll? Or to otherwise choose a selection of boxes without clicking? (
    I’m sure there’s a php for that! read that like: there’s an app for that! haha!)

    TobiasBg
    Participant

    @tobiasbg

    Hi,

    sorry, I don’t know. Let’s hope that YourOwnProgrammer can help again.

    Regards,
    Tobias

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘[Resolved] results from one poll populating to all polls’ is closed to new replies.