• Resolved preetee

    (@preetee)


    Dear all,

    Can someone help me out on this issue, when i go in the statistic option in the wordpress admin
    https://thisisatest.com/wp-admin/admin.php?page=wpProQuiz&module=statistics&id=3 and clicked on a a username data to view the user results and information about the customs field ,a 500 Internal Server Error occur and the pop up keeps on loading.

    In my firebug

    Parametersapplication/x-www-form-urlencoded
    action wp_pro_quiz_admin_ajax
    data[avg] 0
    data[quizId] 3
    data[refId] 8
    data[userId] 0
    func statisticLoadUser
    action=wp_pro_quiz_admin_ajax&func=statisticLoadUser&data%5BquizId%5D=3&data%5BuserId%5D=0&data%5BrefId%5D=8&data%5Bavg%5D=0

    Grateful to a helpful answer to this issue. Thank you in advacance as this is urgent

    https://www.ads-software.com/plugins/wp-pro-quiz/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter preetee

    (@preetee)

    Dear Wisecapt,

    I have look into the article and tried to find who whether there is a script error or permission issues causing this issue. Unfortunately i can’t find.

    I even maximise php memory as some people to resolve,but in vain.:(

    This is driving nut and i need to deliver this work by friday .Would really grateful to get some shared information on how to resolve this issue.

    Thank you for responding back

    Thread Starter preetee

    (@preetee)

    Dear Wisecapt,

    Where is the get_userdata found in??

    In the statistic controller,function ajaxLoadStatisticUser there is this line
    $userInfo = get_userdata($view->statisticModel->getUserId());
    am wondering where is the implementation of this method as it take in as parameter the userid.

    Is this causing the 500 error message? O.o..

    Thank you once again for response

    I know the code works on my server, so I do not think its a script error. Make sure you have the latest php and mysql database server.

    Another thing to try is using a default wordpress theme. Sometimes themes cause a problem and its worth trying a default theme to see if the problem goes away.

    Wisecapt

    Thread Starter preetee

    (@preetee)

    Dear Wisecapt,

    Thank you for replying back.:)
    In fact the issue is due the version of mysql version on production server which is 5.0.45 .
    The php version on production server 5.2.4

    On local development side, the script is working perfectly with mysql version 5.5.24 and php version 5.4.3.
    When i tried to switch with php version 5.2.4 on locally it works
    then i switch with mysql version 5.0.45 locally as well, then i got the same 500 Internal error .

    In my firebug,

    POST

    Parametersapplication/x-www-form-urlencoded
    action	wp_pro_quiz_admin_ajax
    data[avg]	0
    data[quizId]	2
    data[refId]	9
    data[userId]	0
    func	statisticLoadUser
    Source
    action=wp_pro_quiz_admin_ajax&func=statisticLoadUser&data%5BquizId%5D=2&data%5BuserId%5D=0&data%5BrefId%5D=9&data%5Bavg%5D=0

    RESPONSE

    <div id='error'>
    			<p class='wpdberror'><strong>WordPress database error:</strong> [Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause]<br />
    			<code>SELECT
    					sf.*,
    					MIN(sf.create_time) AS min_create_time,
    					MAX(sf.create_time) AS max_create_time
    				FROM
    					wp_wp_pro_quiz_statistic_ref AS sf
    				WHERE
    					sf.statistic_ref_id = 9 AND sf.quiz_id = 2</code></p>
    			</div><br />
    <b>Fatal error</b>:  Call to a member function getUserId() on a non-object in <b>C:\wamp\www\test\wp-content\plugins\wp-pro-quiz\lib\controller\WpProQuiz_Controller_Statistics.php</b> on line <b>701</b><br />

    Thank you for you kind help.

    Thread Starter preetee

    (@preetee)

    Dear Wisecapt

    Good news i resolved the issue..was turning crazy..but i think madness turns to bring buld of light on my head ??

    To resolve this issue
    I have change add GROUP BY sf.statistic_ref_id in the class file
    named WpProQuiz_Model_StatisticRefMapper in the following function

    public function fetchByRefId($refIdUserId, $quizId, $avg = FALSE) {
    		$where = $avg ? 'sf.user_id = %d' : 'sf.statistic_ref_id = %d';
    		$results = $this->_wpdb->get_results(
    			$this->_wpdb->prepare(
    				"SELECT
    					sf.*,
    					MIN(sf.create_time) AS min_create_time,
    					MAX(sf.create_time) AS max_create_time
    				FROM
    					{$this->_tableStatisticRef} AS sf
    				WHERE
    					{$where} AND sf.quiz_id = %d
                    GROUP BY sf.statistic_ref_id"
    			, $refIdUserId, $quizId)
    		, ARRAY_A);
    
    		foreach ($results as $row) {
    			$row['form_data'] = $row['form_data'] === null ? null : @json_decode($row['form_data'], true);
    
    			return  new WpProQuiz_Model_StatisticRefModel($row);
    		}
    	}

    Let’s me know about your feedback.
    Take care

    Dear Pretee, I had the same issue and your help solved it. Many thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘a 500 Internal Server Error occur on statisticLoadUser function’ is closed to new replies.