WordPress.org

Forums

YOP Poll
[resolved] How can I hide the vote button on the polls in the Yop Polls archive page? (9 posts)

  1. ckalan1
    Member
    Posted 10 months ago #

    I would like to remove the vote button from the voting panel only on the archive page. I want to keep the normal function and appearance on the match pages.

    Is that possible?

    Thanks,
    Craig

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

  2. YOP
    Member
    Plugin Author

    Posted 10 months ago #

    Hi Craig,

    Edit yop_poll_model.php and in return_poll_html() function, specifically in if(!is_voted) add

    $actual_link =  "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
                            if($actual_link=="your archive url"){
                                $template = str_ireplace( '%POLL-VOTE-BUTTON%', '<button style="visibility:hidden" class="yop_poll_vote_button" id="yop_poll_vote-button-' . $poll_id . $unique_id . '" onclick="yop_poll_register_vote(\'' . $poll_id . '\', \'' . $location . '\', \'' . $unique_id . '\'); return false;">' . $poll_options['vote_button_label'] . '</button>', $template );

    Best wishes,

    YOP Team

  3. ckalan1
    Member
    Posted 10 months ago #

    Thank you very much. I will let you know how it works.

    By the way, I am definitely interested in beta testing the new version.
    http://www.iamadreammaker.com/dm/

    Craig

  4. ckalan1
    Member
    Posted 10 months ago #

    Hello YOP Team,

    I searched yop_poll_model.php and could not find "return_poll_html()" function, or "if(!is_voted)"

    I added the quotes here but not in my search.

    Could you give me a line number.

    Thanks,
    Craig

  5. YOP
    Member
    Plugin Author

    Posted 10 months ago #

    Hey Craig,

    The return_poll_html() functions starts on line 2954.
    Please try again and let us know if you need more help.

    Regards,

    YOP Team

  6. ckalan1
    Member
    Posted 10 months ago #

    I found "return_poll_html() but I still cannot find "if(!is_voted)"

    This is what is on line 2951-2956

    public function return_poll_html( $attr = array( 'tr_id' => '', 'location' => 'page', 'load_css' => false, 'load_js' => false ) ) {
    $tr_id = isset( $attr['tr_id'] ) ? $attr['tr_id'] : '';
    $location = isset( $attr['location'] ) ? $attr['location'] : 'page';
    $unique_id = $this->unique_id;
    $load_css = isset( $attr['load_css'] ) ? $attr['load_css'] : false;
    //$load_js = isset( $attr['load_js'] ) ? $attr['load_js'] : false;

    I am not very experienced with PHP so I am probably doing something wrong.

    Any ideas?

    Thanks,
    Craig

  7. YOP
    Member
    Plugin Author

    Posted 10 months ago #

    Hi Craig,

    if ( !$is_voted ) is located around line 3006. All you have to do next is to add the code we provided previously inside this "if".

    Best wishes,

    YOP Team

  8. ckalan1
    Member
    Posted 10 months ago #

    I inserted the code like this. After I did that, I could not login as an administrator. After I removed it everything went back to normal.
    if ( !$is_voted $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
    if($actual_link=="your archive url"){
    $template = str_ireplace( '%POLL-VOTE-BUTTON%', '<button style="visibility:hidden" class="yop_poll_vote_button" id="yop_poll_vote-button-' . $poll_id . $unique_id . '" onclick="yop_poll_register_vote(\'' . $poll_id . '\', \'' . $location . '\', \'' . $unique_id . '\'); return false;">' . $poll_options['vote_button_label'] . '</button>', $template ); )

    Is this the correct way to insert the line of code you provided

  9. YOP
    Member
    Plugin Author

    Posted 10 months ago #

    Hey Craig,

    Please email us at yop.help (@] gmail.com and we will provide a .txt file that includes the code with all the modifications.

    Regards,

    YOP Team

Reply

You must log in to post.

About this Plugin

About this Topic