Hello.
Your module is really what I need, but i have a very little experience in code writing. Please help, if you can and want.
I read your achievements.api.php file and understand most of it. I decided, that i will not create a new module folder, just modify yours. And now I can't understand what file in your folder I must change - achievements.module, achievement.tpl.php or achievements.api.php itself. When I change achievements.api.php nothing happens and when I change achievements.module, my site don't open at all.
I know that a question is stupid, but somehow I must start to uindestand a drupal system better.
Thanks a lot.
Comments
Comment #1
morbus iffThat's your biggest problem. Don't do that. Follow "Creating achievements" in the README or on the project page.
Comment #2
taecelle commentedThanks.
Now I understand it.
But i need help anyway. I created a folder "my_achieve", in folder - two files: my_achieve.info and my_achieve.module.
In my_achieve.module i put a part of your example code:
When I try to enable this module, my site just goes blank. What i made wrong? (I know, that i made ALL wrong, but may be it can be helped)))
Comment #3
morbus iffYou'd need to check your web server's error or PHP log, and/or do a syntax check with whatever code editor you're using. Full whitescreens like that tend to mean a syntax error which, here, is likely given that you've got a comma where you should have put a semi-colon (in my_achieve_achievements_info(). There might be others. Note also that your actual achievement unlock code is unlikely to work since you've only defined one achievement for 500 comments - not 500 achievements for 1 comment, 2 comments, 3 comments, 4 comments, etc.
Comment #4
taecelle commentedThanks, i just found the error. Now site works ok, but in profile no achievements is unlocked (I have a 490 comments). What i must do to unlock them for every user who reached milestones earlier??
Code is:
Comment #5
morbus iffIf you want to offer retroactive achievements, you'd have to code them yourself (either by writing a one-time importer script to determine and grant them all), or specifically tweak your code so that the next time they write a comment, you'd count what they have, set the internal achievement storage to that value, then unlock all previous achievements.
Comment #6
taecelle commentedOOO, it works!!
Thank you.
And one little question (pleeese!)
How can i make, that only comments to specific node type are taken into account?
Comment #7
morbus iffCheck the $comment variable (print it out with print_r() or some such, etc.). If it doesn't include the node type (I don't recall off the top of my head), then it does contain $comment->nid so you could always $node = node_load($comment->nid) and check the $node->type.
Comment #8
taecelle commentedYep, it doesn't contain a type in comment variable. Please, can you help to write a right code for this?
Is it right?
Thank you very much for your help)
Comment #9
morbus iffDid you try it?
Comment #10
taecelle commentedyes, it works fine)
Thank you)