Closed (fixed)
Project:
Achievements
Version:
7.x-1.5
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 May 2012 at 11:42 UTC
Updated:
13 Jun 2012 at 14:41 UTC
Hi
In the achievements.api.php sample code the leading forward slashes have to be removed for images to show correctly in the case Drupal is not installed in the root of the webserver.
If Drupal is installed in the root of the website, '/site/all/default/files' and 'site/all/default/file' overlap as '/site/all/default/files', if not, the subdirectory part will be missing (so '/site/all/default/files' stays '/site/all/default/files' where it should be something like '/drupal7/site/all/default/files'). Use of 'site/all/default/files' will correctly correctly expand it.
So hook_achievements_info() should look like:
function hook_achievements_info() {
$achievements = array(
'comment-count-50' => array(
'title' => t('Posted 50 comments!'),
'description' => t("We no longer think you're a spam bot. Maybe."),
'storage' => 'comment-count',
'points' => 50,
),
'comment-count-100' => array(
'title' => t('Posted 100 comments!'),
'description' => t('But what about the children?!'),
'storage' => 'comment-count',
'points' => 100,
'images' => array(
'unlocked' => 'sites/default/files/example1.png',
// 'secret' and 'locked' will use the defaults.
),
),
// An example of achievement groups: 'article-creation' is the group ID,
// "Article creation" is the group title, and all relevant achievements are
// placed in an 'achievements' array. The ungrouped comment achievements
// above will be automatically pushed into a "Miscellany" group.
'article-creation' => array(
'title' => t('Article creation'),
'achievements' => array(
'node-mondays' => array(
'title' => t('Published some content on a Monday'),
'description' => t("Go back to bed: it's still the weekend!"),
'points' => 5,
'images' => array(
'unlocked' => 'sites/default/files/example1.png',
'locked' => 'sites/default/files/example2.png',
'secret' => 'sites/default/files/example3.png',
// all default images have been replaced.
),
),
),
),
);
Comments
Comment #1
morbus iffWill be fixed in the next commit. Thanks!