First of all, thanks very much for this amazing module.

However, after installation, i faced sql (using drigg theme) error

"user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LEFT JOIN drigg_node dn2 ON dn2.dnid = n.nid WHERE ( 1=1 AND !(n.type='drigg' ' at line 1 query: LEFT JOIN drigg_node dn2 ON dn2.dnid = n.nid WHERE ( 1=1 AND !(n.type='drigg' AND dn2.killed=1 ) ) in ....\drupal5\includes\database.mysql.inc on line 172."

In addition, the vote widget does not work either.

If i use other theme, there will not be such sql error msg, the vote form will be normal check point but workable.

In addition, is the installation process too complicated? like the drigg theme, is there anyway to use drupal theme hooks to automatically call the functions required?

I am using drupal5.2 , mysql5.0

Thanks

Comments

mercmobily’s picture

Status: Active » Postponed (maintainer needs more info)

Hi,

Please only raise ONE issue per report. The installation process is what it needs to be. If you want something simple, install drigg-distr.tgz, aimed at people who are not used to Drupal.

About the problem: it's really strange. I am unable to reproduce the problem. When does it come up? Can you give me precise instructions on how to reproduce it? Which extra modules have you installed?

Can you give me a link to a live site with the problem?

Bye,

Merc.

mercmobily’s picture

Priority: Critical » Normal

Hi,

Users should be educated on the use of the priority "Critical"

Merc.

gnosis.kv’s picture

Priority: Normal » Critical
Status: Postponed (maintainer needs more info) » Active

in additon it shows
"
warning: Missing argument 1 for drigg_help() in D:\Inetpub\websites\drupal5\sites\all\modules\voting\drigg\drigg.module on line 8.
"

after click the voting button, it shows "karma error: parseerror"

i am not sure if it caused by conflict with other module. i will go through the code and try to find out the problem this weekend. :)

gnosis.kv’s picture

Priority: Critical » Normal
Status: Active » Postponed (maintainer needs more info)

hi Merc,

thanks for your quick apply.

after comment out the "drigg_db_rewrite_sql“ function, error msg shows "user warning: Query was empty query:"

so seems the system send some empty query somewhere.

mercmobily’s picture

Hi,

OK, did you read my message above?

----------------------------------------------------------------
About the problem: it's really strange. I am unable to reproduce the problem. When does it come up? Can you give me precise instructions on how to reproduce it? Which extra modules have you installed?

Can you give me a link to a live site with the problem
-----------------------------------------------------------------

Finally, I need to ask... are you using this on Drupal 5.5?

Bye,

Merc.

gnosis.kv’s picture

Hi Merc,

I am not using drupal 5.5 but 5.2 instead.

Drigg must run on 5.5?

Instead of using ur default theme, i followed ur online install instruction and copied those functions to my current theme.

after doing so, the db error gone.

but the after voting, it still shows "Karma Error: parsererror".

I checked the code, it's from jquery.

if ( status == "success" ) {
					// Watch for, and catch, XML document parse errors
					try {
						// process the data (runs the xml through httpData regardless of callback)
						data = jQuery.httpData( xml, s.dataType );
					} catch(e) {
						status = "parsererror";
					}
				}

actually, the data updating has been done, after refresh the page, the correct voting result will be displayed. the only problem is Ajax failed to update result after voting due to the "parsererror".

mercmobily’s picture

Hi,

Did you update jquery.js as explained in the documentation?

If you install firebug, what's the result of the voting query?

Once more: can you please give me a URL where I can see this?

Bye,

Merc.

gnosis.kv’s picture

sorry, i only tested it on my local server.

i have the latest jquery.

the problem is there is some conflict with devel module.

the value send back was

{"karma_aggregate":1}  and devel information, "the execution time", "memory" 

i believe it should be simply "{"karma_aggregate":1}"

mercmobily’s picture

Hi,

Do you have the "devel" module enabled?

If so, voting won't work because the return value will get mixed up with the devel module's output.

Bye,

Merc.

gnosis.kv’s picture

Status: Postponed (maintainer needs more info) » Active

Hi Merc,

I see the problem.

To fix it and the right way to return json is

in extra_voting_forms.module

1. in "extra_voting_forms_return" function, dont print the output and exit, but return the string value to "extra_voting_forms_handle".

2. in "extra_voting_forms_handle" function, dont print the output either, but do

exit(extra_voting_forms_return(@params).

in this way, the devel module will not append extra information to your json output.

I have tested it on my server, and it works well.

Cheers!

Welcome further discussion.

mercmobily’s picture

Title: drigg does not work after installation » drigg does not work if Devel module is activated

Hi,

Sorry, I am not sure I follow you...
I don't get the two points:

---------------------------------------
1. in "extra_voting_forms_return" function, dont print the output and exit, but return the string value to "extra_voting_forms_handle".

2. in "extra_voting_forms_handle" function, dont print the output either, but do
exit(extra_voting_forms_return(@params).
----------------------------------------

Can you please send me a patch?

Thanks,

Merc.

mercmobily’s picture

Priority: Normal » Minor

Hi,

I tried to interpret what you wrote, and I must say I don't get it :-)

Are you sure that with "your" way, if there is an error you still get it displayed?

(You can "force" an error in the code)

Reducing the priority to "minor".

Bye,

Merc.

mercmobily’s picture

Title: drigg does not work if Devel module is activated » Voting does not work if Devel module is activated
Project: Drigg » Extra Voting Forms
Version: 5.x-1.6 » 5.x-1.2

Hi,

Changed to another module (the appropriate one).

gnosis.kv’s picture

Title: Voting does not work if Devel module is activated » drigg does not work after installation
Project: Extra Voting Forms » Drigg
Version: 5.x-1.2 » 5.x-1.6
Priority: Minor » Normal

Hi Merc,

Here is the updated extra_voting_forms_return and extra_voting_forms_handle function.

By doing so, you can get the clean json without devel info appended.

i hope i made myself clear. :)

function extra_voting_forms_return($form_type,$object,$error,$current_karma){

  if($form_type == 'ajax'){

    // Adjust the string for Ajax...
    if($current_karma===''){
      $current_karma='"Undefined"';
    }

    // Return the right thing to the javascript
    if($error != ''){
      
      $output = "{\"karma_aggregate\":$current_karma, \"error\":\"$error\"}";
      //print "{\"karma_aggregate\":$current_karma, \"error\":\"$error\"}";
      #drupal_set_message($error);
    } else {
      
      $output = "{\"karma_aggregate\":$current_karma}";
      //print "{\"karma_aggregate\":$current_karma}";

    }
    //module_invoke_all('exit');
    return $output; 

  } else { 

    if($error != ''){
      drupal_set_message($error,'error');
    } else {
      drupal_set_message(t('Thank you for voting!'));
    }
    drupal_goto(referer_uri());
  }

}
function extra_voting_forms_handle(){

  global $_REQUEST, $user;

  // The form has been posted...
  if ($_REQUEST['form_type']) { 

    // Set the incoming variables
    $oid        = $_REQUEST['oid'];
    $otype      = $_REQUEST['otype'];
    $karma_vote = $_REQUEST['karma_vote'];
    $form_type  = $_REQUEST['form_type'];


    // If otype isn't 'c' or 'n', return to the home page
    if($otype != 'c' && $otype != 'n'){
      exit(extra_voting_forms_return($form_type,$o,t('Error in the form'),''));
    }

    // Create the object, and load it
    $o= new stdClass();
    $o->sk_id = $oid;
    $o->sk_type = $otype;
    $o=extra_voting_forms_load_object($o);
    if(!$o){
      exit(extra_voting_forms_return($form_type,$o,t('Error loading the object!'),''));
    }

    // Check that $form_type is sane. extra_voting_forms_return does NOT
    // check it as a parameter
    if($form_type != 'ajax' && $form_type != 'form'){
      drupal_set_message(t('Error in the parameters!'),'error');
      drupal_goto('node/'.$o->nid);
    }    



    // It's a direct form, and the user doesn't
    // have voting rights!
    if($form_type != 'ajax' && $user->uid == 0){
      drupal_goto( extra_voting_forms_anonymous_url(), "destination=".extra_voting_forms_destination($o) );
    }

    // Give the vote and return. $give_vote_return will return the error
    // message (if there was one) or '' if all went OK. This is exactly what
    // extra_voting_forms_return expects, which is handy...
    list($give_vote_return,$k)=extra_voting_forms_give_vote($o,$karma_vote);
    
    if(! variable_get('extra_voting_forms_display_karma_for_'.$o->sk_type, 0) ){
      $k='';
    }
    drupal_set_header("Content-Type: text/json");
    exit(extra_voting_forms_return($form_type,$o,$give_vote_return,$k));

  }

}
gnosis.kv’s picture

Priority: Normal » Minor

sorry, mistakenly reset the priority.

the above code is just an example, i have not studied your code thoroughly. I just want to show you my way to send clean json without devel info.

the database error has gone after i changed back to my previous theme, not sure abt what's wrong with your theme functions.

mercmobily’s picture

Title: drigg does not work after installation » Voting does not work if Devel module is activated
Project: Drigg » Extra Voting Forms
Version: 5.x-1.6 » 5.x-1.2

Hi,

Please leave the title as I set it.

Also, the module affected is extra_voting_form, not drigg.

mercmobily’s picture

Hi,

Fixed in 1.3

Thanks for the patch!

Merc.

mercmobily’s picture

Status: Active » Closed (fixed)
gnosis.kv’s picture

That's great!

Truly wish you all the best and great success with your drigg project.

Flying Drupalist’s picture

Version: 5.x-1.2 » 6.x-1.x-dev
Status: Closed (fixed) » Active

This problem is still present in the 6.x dev.

Hopefully the current maintainer would try to fix this.

mercmobily’s picture

Hi,

I am having a real problem with this.
The main issue is that it *seems* to be a problem with the devel module, more than EVF.
It's really annoying and I want to close it, but I am a little lost.

Merc.

mercmobily’s picture

Status: Active » Fixed

Hi,

Got it. Fixed this bugger.
I needed a drupal_set_header("Content-Type: text/json"); before the json return. Yay.

Merc.

mercmobily’s picture

Status: Fixed » Closed (fixed)