Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apostrophes Issue (with attached solution) #60

Closed
jeffikus opened this issue Jun 25, 2013 · 5 comments
Closed

Apostrophes Issue (with attached solution) #60

jeffikus opened this issue Jun 25, 2013 · 5 comments
Assignees
Milestone

Comments

@jeffikus
Copy link
Contributor

https://woothemes.zendesk.com/agent/#/tickets/63823

Changes are in /templates/single-quiz/question_type-multiple-choice.php on lines 33-35:

if ( isset( $user_quizzes[ $question_item->ID ] ) && ( '' != $user_quizzes[ $question_item->ID ] ) ) {
            $checked = checked( $question, stripslashes( $user_quizzes[ $question_item->ID ] ), false );
        } // End If Statement ?>

And in /classes/class-woothemes-sensei-utils.php the function sensei_grade_question_auto() becomes:

public function sensei_grade_question_auto( $question_id = 0, $answer = '', $user_id = 0 ) {
        if( intval( $user_id ) == 0 ) {
            global $current_user;
            $user_id = $current_user->ID;
        }

        $question_grade = 0;
        if( intval( $question_id ) > 0 ) {
            $right_answer = get_post_meta( $question_id, '_question_right_answer', true );
            if ( 0 == strcmp( $right_answer, stripslashes( $answer ) ) ) {
                // TO DO: Enable custom grades for questions
                $question_grade = 1;
            }
            $activity_logged = WooThemes_Sensei_Utils::sensei_grade_question( $question_id, $question_grade, $user_id );
        }

        return $question_grade;
    }

The main thing here is the stripslashes function being added to both pieces of code.

@ghost ghost assigned jeffikus Jun 25, 2013
jeffikus added a commit that referenced this issue Jul 2, 2013
Apostrophes in multiple choice questions bug fix. Closes #60
@danjjohnson
Copy link
Contributor

This has reappeared. Looks like stripslashes have been removed somewhere along the way - https://github.com/woothemes/sensei/blob/release-1-4-5/templates/single-quiz/question_type-multiple-choice.php#L85

https://github.com/woothemes/sensei/blob/release-1-4-5/classes/class-woothemes-sensei-utils.php#L465

@jeffikus Can we squeeze this into 1.4.5 if they just need replacing? (I can handle the change if that's all that's required)

https://woothemes.zendesk.com/agent/#/tickets/124589
https://woothemes.zendesk.com/agent/#/tickets/124620

@danjjohnson danjjohnson reopened this Dec 4, 2013
@ghost ghost assigned danjjohnson Dec 5, 2013
@danjjohnson
Copy link
Contributor

Closing for now as we need FTP details to debug on customers' sites. Can reopen if/when they reply.

@danjjohnson
Copy link
Contributor

Got another report of this with FTP details - https://woothemes.zendesk.com/agent/#/tickets/143284

Still happening on my local too.

Multi-choice answer won't save if the answer contains an apostrophe.

@danjjohnson danjjohnson reopened this Feb 5, 2014
@danjjohnson
Copy link
Contributor

Another case of the mysterious apostrophe issue - https://woothemes.zendesk.com/agent/#/tickets/158291

@hlashbrooke I have requested FTP details so you can investigate.

@danjjohnson
Copy link
Contributor

@hlashbrooke FTP details now available for this issue in https://woothemes.zendesk.com/agent/#/tickets/158291

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants