After updating from 2.0-beta3 to beta4 I get the following error when I flag / unflag a node (link type = javascript toggle):

An HTTP error 404 occurred.
http://localhost/drupal/en/flag/flag/favorite_products/60?destination=taxonomy%2Fproducts%2F1&token=155b2becd4096092b58e762ed2dcd794

When I select as link type "normal link", I get the following error:
Page not found
The requested page could not be found.

I have following modules installed on my test site:
Token 6.x-1.15
Views 6.x-3.x-dev (2010-Nov-12)
Content Construction Kit (CCK) 6.x-3.x-dev (2010-Nov-11)
Internationalization 6.x-1.7
Internationalization Views 6.x-3.x-dev (2010-Jul-21)
jQuery UI 6.x-1.4
jQuery Update 6.x-2.0-alpha1

When I go back to version beta3 the problem is solved.

Comments

mooffie’s picture

I don't have an idea right now. Does it work when you remove the "en" prefix?

FWIW, in beta3 the menu item was:

 $items['flag'] = array(
    'page callback' => 'flag_page',

whereas in beta4 it's:

  $items['flag/%/%flag/%'] = array(
    'page callback' => 'flag_page',
    'page arguments' => array(1, 2, 3),
tomsm’s picture

Status: Active » Fixed

I have solved it.
The error was caused by a wrong "javascript parsed" entry in the i18n_variable table.
After removing it, the error was gone.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Dave Kinchlea’s picture

Status: Closed (fixed) » Active

Hi
I've got the same problem, just noticed it now. I don't have the il8n but do have a number of modules. Can you tell me a bit more about what you found and how you found it? Was it literally the string "javascript parsed" as a record entry ... as in a bad record?

Thanks for any help! It's good that downgrading to beta3 fixes things but I do like to stay current where I can.

tomsm’s picture

With record I mean a line in a database table. I opened my Drupal database with phpMyAdmin. Then I opened the table i18n_variable and deleted the record with name "javascript parsed", because this should not be translated.
Do you have a multilingual site?

mooffie’s picture

Dave, have you tried clearing Drupal's cache? Maybe the menu router needs rebuild.

Dave Kinchlea’s picture

Status: Active » Closed (fixed)

@tomsm: no, it is English only, that's why I was asking because I thought I would have to go table surfing myself. It seems my fix was even easier however.

@mooffie: well not directly but standard operating procedure is for me to run an updatedb which I assume clears the cache (this is all scripted). Upon reading your reply, however, I re-upgraded, cleared the cache manually and voila so perhaps SOP wasn't followed in this case or the script is broken. Anyway operator error seems most likely the cause (and time for some further troubleshooting).

Upon reflection I think I assumed too much ... if "drush updatedb" doesn't find any updates to apply I suspect it doesn't clear cache (why would it?) and although 7 different modules were upgraded that run it appears that none triggered an update. Time to fix that script and stop assuming so much :-)

Thanks to both! Love the support!

philsward’s picture

I too received the same error and found that Boost was the problem. After shutting boost off, the flag began working properly. After clearing all of the cache on boost, I then ran into the issue where clicking on the flag, if "Normal Link" was used, would not update the page. Turning on the "Javascript Link" worked though I don't like the output of the status message :(

Hope that helps out someone else :)

philippkipp’s picture

I've got the same issue. deleted the javascript line from the database as suggested above. Does not help at all. Not using Boost.
What I am trying to to is using the flag link in a panel. To use ist there it created a block with the code in it

  print flag_create_link('supporter', $node->nid);

The resulting link address is: DOMAINNAMEHERE.COM/flag/flag/FLAGTYPEHERE/?destination=node%2F30&token=753903c3196b5ca88ad798340b08fb48

nid is 30. Maybe i need to on the fly replace the %2F with /, but I don't know how to do that.

Can anybody help?

tajindersingh’s picture

Hello Philippkipp,

You are using:

print flag_create_link('supporter', $node->nid);

where $node object requires to be there, but in panels this might not be the case.

In resulting link address NODE ID for node to be flagged is missing:
DOMAINNAMEHERE.COM/flag/flag/FLAGTYPEHERE/[NODE ID SHOULD BE HERE]?destination=node%2F30&token=753903c3196b5ca88ad798340b08fb48

That means $node->nid doesn't available when the code is called.

Try below code considering your panels page is receiving arg(1) being nid which is usually a case with node page:

print flag_create_link('supporter', arg(1));

Best of luck,

Tajinder Singh
IMP Technologies
Creating Masterpieces...
http://imptechs.com

webindustries’s picture

perfect fix thanks!

sjhuskey’s picture

Issue summary: View changes

I was having this issue in a view. I had the following code to display a flag:

print flag_create_link('accept_proposal', $row->nid);

That displayed the flag, but clicking on it produced a 404 error. The issue was easily resolved: I added Content: Nid to the fields in my view, set it not to be displayed, and my flag worked again. This is probably obvious to many, but I mention it here in the hope that it will save others some time.

stanoreke’s picture

#12 saved me after spending lots of hours on it.
Thanks

drvdt’s picture

Thanks to sjhuskey with #12
Check your display, maybe not have nid to flag