Browse files

Plugin updates

* Achievements
* Breadcrumb NavXT
* CMS Tree Page View
* Restrict Categories
  • Loading branch information...
1 parent 491498a commit c7160d45e69d47f6f447f41c3958f184e90ea279 @craigcook craigcook committed Mar 12, 2013
Showing with 7,058 additions and 3,609 deletions.
  1. +6 −6 plugins/achievements/achievements.php
  2. +160 −116 plugins/achievements/dpa.pot
  3. +71 −0 plugins/achievements/includes/achievements/functions.php
  4. +24 −1 plugins/achievements/includes/achievements/template.php
  5. +5 −3 plugins/achievements/includes/admin/admin.php
  6. +1 −1 plugins/achievements/includes/admin/class-dpa-users-list-table.php
  7. +3 −0 plugins/achievements/includes/admin/css/achievements-rtl.css
  8. +1 −1 plugins/achievements/includes/admin/css/achievements.css
  9. +2 −1 plugins/achievements/includes/admin/css/dev/achievements.less
  10. +1 −0 plugins/achievements/includes/admin/css/supportedplugins-rtl.css
  11. +1 −0 plugins/achievements/includes/admin/css/users-rtl.css
  12. +18 −4 plugins/achievements/includes/admin/functions.php
  13. +9 −5 plugins/achievements/includes/admin/supported-plugins.php
  14. +1 −1 plugins/achievements/includes/admin/users.php
  15. +40 −4 plugins/achievements/includes/class-dpa-shortcodes.php
  16. +49 −1 plugins/achievements/includes/common/functions.php
  17. +24 −2 plugins/achievements/includes/common/template.php
  18. +99 −0 plugins/achievements/includes/common/widgets.php
  19. +9 −0 plugins/achievements/includes/core/actions.php
  20. +15 −0 plugins/achievements/includes/core/dependency.php
  21. +5 −1 plugins/achievements/includes/core/template-loader.php
  22. +2 −2 plugins/achievements/includes/extensions/wordpress.php
  23. +96 −17 plugins/achievements/includes/progress/template.php
  24. +12 −2 plugins/achievements/includes/users/notifications.php
  25. +7 −0 plugins/achievements/readme.md
  26. +94 −0 plugins/achievements/readme.txt
  27. +204 −0 plugins/achievements/templates/achievements/achievements-functions.php
  28. +36 −0 plugins/achievements/templates/achievements/achievements/content-archive-achievement.php
  29. +34 −0 plugins/achievements/templates/achievements/achievements/content-author-achievement.php
  30. +36 −0 plugins/achievements/templates/achievements/achievements/content-single-achievement.php
  31. +86 −0 plugins/achievements/templates/achievements/achievements/feedback-achievement-unlocked.php
  32. +25 −0 plugins/achievements/templates/achievements/achievements/feedback-no-achievements.php
  33. +24 −0 plugins/achievements/templates/achievements/achievements/form-redeem-code.php
  34. +54 −0 plugins/achievements/templates/achievements/achievements/loop-achievements.php
  35. +31 −0 plugins/achievements/templates/achievements/achievements/loop-progresses.php
  36. +47 −0 plugins/achievements/templates/achievements/achievements/loop-single-achievement.php
  37. +42 −0 plugins/achievements/templates/achievements/achievements/loop-single-progress.php
  38. +29 −0 plugins/achievements/templates/achievements/achievements/pagination-achievements.php
  39. +23 −0 plugins/achievements/templates/achievements/achievements/pagination-author-achievements.php
  40. +3 −0 plugins/achievements/templates/achievements/css/achievements-rtl.css
  41. +2 −0 plugins/achievements/templates/achievements/css/achievements.css
  42. +189 −0 plugins/achievements/templates/achievements/css/dev/achievements.less
  43. +81 −0 plugins/achievements/templates/achievements/css/dev/notifications.less
  44. +31 −0 plugins/achievements/templates/achievements/css/dev/variables.less
  45. +3 −0 plugins/achievements/templates/achievements/css/notifications-rtl.css
  46. +2 −0 plugins/achievements/templates/achievements/css/notifications.css
  47. +4 −0 plugins/achievements/templates/achievements/index.php
  48. +5 −0 plugins/achievements/templates/achievements/js/achievements.js
  49. +5 −0 plugins/achievements/templates/achievements/js/dev/achievements.js
  50. +15 −0 plugins/achievements/templates/achievements/js/dev/notifications.js
  51. +1 −0 plugins/achievements/templates/achievements/js/notifications.js
  52. +4 −0 plugins/achievements/templates/index.php
  53. +56 −54 plugins/breadcrumb-navxt/breadcrumb_navxt_admin.php
  54. +68 −21 plugins/breadcrumb-navxt/breadcrumb_navxt_class.php
  55. +1 −1 plugins/breadcrumb-navxt/breadcrumb_navxt_widget.php
  56. +1 −1 plugins/breadcrumb-navxt/includes/block_direct_access.php
  57. +34 −4 plugins/breadcrumb-navxt/includes/mtekk_adminkit.php
  58. +3 −2 plugins/breadcrumb-navxt/includes/mtekk_adminkit_tabs.css
  59. +1 −1 plugins/breadcrumb-navxt/includes/multibyte_supplicant.php
  60. BIN plugins/breadcrumb-navxt/languages/breadcrumb-navxt-ar.mo
  61. +177 −0 plugins/breadcrumb-navxt/languages/breadcrumb-navxt-ar.po
  62. +756 −756 plugins/breadcrumb-navxt/languages/breadcrumb-navxt-az.po
  63. BIN plugins/breadcrumb-navxt/languages/breadcrumb-navxt-cs_CZ.mo
  64. +753 −0 plugins/breadcrumb-navxt/languages/breadcrumb-navxt-cs_CZ.po
  65. BIN plugins/breadcrumb-navxt/languages/breadcrumb-navxt-da_DK.mo
  66. +187 −191 plugins/breadcrumb-navxt/languages/breadcrumb-navxt-da_DK.po
  67. BIN plugins/breadcrumb-navxt/languages/breadcrumb-navxt-de_DE.mo
  68. +5 −585 plugins/breadcrumb-navxt/languages/breadcrumb-navxt-de_DE.po
  69. BIN plugins/breadcrumb-navxt/languages/breadcrumb-navxt-es_ES.mo
  70. +396 −165 plugins/breadcrumb-navxt/languages/breadcrumb-navxt-es_ES.po
  71. BIN plugins/breadcrumb-navxt/languages/breadcrumb-navxt-et.mo
  72. +187 −191 plugins/breadcrumb-navxt/languages/breadcrumb-navxt-et.po
  73. BIN plugins/breadcrumb-navxt/languages/breadcrumb-navxt-fr_FR.mo
  74. BIN plugins/breadcrumb-navxt/languages/breadcrumb-navxt-it_IT.mo
  75. +753 −0 plugins/breadcrumb-navxt/languages/breadcrumb-navxt-it_IT.po
  76. BIN plugins/breadcrumb-navxt/languages/breadcrumb-navxt-nb_NO.mo
  77. BIN plugins/breadcrumb-navxt/languages/breadcrumb-navxt-pt_PT.mo
  78. +187 −191 plugins/breadcrumb-navxt/languages/breadcrumb-navxt-pt_PT.po
  79. BIN plugins/breadcrumb-navxt/languages/breadcrumb-navxt-ru_RU.mo
  80. +187 −191 plugins/breadcrumb-navxt/languages/breadcrumb-navxt-ru_RU.po
  81. BIN plugins/breadcrumb-navxt/languages/breadcrumb-navxt-sv_SE.mo
  82. +398 −167 plugins/breadcrumb-navxt/languages/breadcrumb-navxt-sv_SE.po
  83. BIN plugins/breadcrumb-navxt/languages/breadcrumb-navxt.mo
  84. +211 −220 plugins/breadcrumb-navxt/languages/breadcrumb-navxt.po
  85. +189 −194 plugins/breadcrumb-navxt/languages/breadcrumb-navxt.pot
  86. +30 −9 plugins/breadcrumb-navxt/readme.txt
  87. +59 −17 plugins/cms-tree-page-view/functions.php
  88. +2 −2 plugins/cms-tree-page-view/index.php
  89. +13 −0 plugins/cms-tree-page-view/languages/cms-tree-page-view-fi_FI.mo
  90. +362 −0 plugins/cms-tree-page-view/languages/cms-tree-page-view-fi_FI.po
  91. +14 −3 plugins/cms-tree-page-view/readme.txt
  92. BIN plugins/cms-tree-page-view/screenshot-1.png
  93. BIN plugins/cms-tree-page-view/screenshot-2.png
  94. BIN plugins/cms-tree-page-view/screenshot-3.png
  95. BIN plugins/cms-tree-page-view/screenshot-4.png
  96. BIN plugins/cms-tree-page-view/screenshot-5.png
  97. BIN plugins/cms-tree-page-view/screenshot-6.png
  98. BIN plugins/cms-tree-page-view/screenshot-7.png
  99. +1 −0 plugins/cms-tree-page-view/scripts/cms_tree_page_view.js
  100. BIN plugins/cms-tree-page-view/styles/images/switch-view-icons.psd
  101. +1 −1 plugins/cms-tree-page-view/styles/styles.css
  102. +15 −0 plugins/restrict-categories/js/restrict-categories.js
  103. +13 −2 plugins/restrict-categories/readme.txt
  104. +217 −176 plugins/restrict-categories/restrict-categories.php
  105. BIN plugins/restrict-categories/screenshot-1.png
  106. BIN plugins/restrict-categories/screenshot-2.png
  107. BIN plugins/restrict-categories/screenshot-3.png
  108. +7 −0 plugins/restrict-categories/uninstall.php
  109. +3 −296 themes/QMO5/style.css
View
12 plugins/achievements/achievements.php
@@ -13,8 +13,8 @@
Plugin Name: Achievements
Plugin URI: http://achievementsapp.com/
Description: Achievements gamifies your WordPress site with challenges, badges, and points.
-Version: 3
-Requires at least: 3.5
+Version: 3.1
+Requires at least: 3.5.1
Tested up to: 3.5.1
License: GPLv3
Author: Paul Gibbs
@@ -304,7 +304,7 @@ private function includes() {
*/
require( $this->includes_dir . 'common/functions.php' );
require( $this->includes_dir . 'common/template.php' );
- //require( $this->includes_dir . 'common/widgets.php' );
+ require( $this->includes_dir . 'common/widgets.php' );
require( $this->includes_dir . 'achievements/functions.php' );
require( $this->includes_dir . 'achievements/template.php' );
@@ -439,7 +439,7 @@ public function register_post_types() {
'ep_mask' => 0, // EP_ROOT - removes comment-page rewrite rules
'feed' => false, // Remove feed rewrite rules
'feeds' => false, // Remove feed rewrite rules (this is what the parameter ought to be)
- 'pages' => false,
+ 'pages' => true,
'slug' => dpa_get_root_slug(),
'with_front' => false,
);
@@ -594,8 +594,8 @@ public function register_theme_packages() {
'id' => 'default',
'name' => __( 'Achievements Default', 'dpa' ),
'version' => dpa_get_version(),
- 'dir' => trailingslashit( $this->themes_dir . '/achievements' ),
- 'url' => trailingslashit( $this->themes_url . '/achievements' )
+ 'dir' => trailingslashit( $this->themes_dir . 'achievements' ),
+ 'url' => trailingslashit( $this->themes_url . 'achievements' )
) );
}
View
276 plugins/achievements/dpa.pot
@@ -2,9 +2,9 @@
# This file is distributed under the same license as the Achievements package.
msgid ""
msgstr ""
-"Project-Id-Version: Achievements 3\n"
+"Project-Id-Version: Achievements 3.1\n"
"Report-Msgid-Bugs-To: http://wordpress.org/tag/achievements\n"
-"POT-Creation-Date: 2013-01-20 20:21:53+00:00\n"
+"POT-Creation-Date: 2013-02-17 22:20:59+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -16,185 +16,189 @@ msgstr ""
msgid "Cheatin’ huh?"
msgstr ""
-#: achievements.php:422
+#: achievements.php:421
msgctxt "achievement"
msgid "Add New"
msgstr ""
-#: achievements.php:423
+#: achievements.php:422
msgid "Add New Achievement"
msgstr ""
-#: achievements.php:424
+#: achievements.php:423
msgid "All Achievements"
msgstr ""
-#: achievements.php:425
+#: achievements.php:424
msgctxt "achievement"
msgid "Edit"
msgstr ""
-#: achievements.php:426
+#: achievements.php:425
msgid "Edit Achievement"
msgstr ""
-#. #-#-#-#-# achievements.pot (Achievements 3) #-#-#-#-#
+#. #-#-#-#-# achievements.pot (Achievements 3.1) #-#-#-#-#
#. Plugin Name of the plugin/theme
-#: achievements.php:427 achievements.php:428
-#: includes/admin/class-dpa-users-list-table.php:149
+#: achievements.php:426 achievements.php:427
+#: includes/admin/class-dpa-users-list-table.php:150
#: includes/admin/functions.php:24
msgid "Achievements"
msgstr ""
-#: achievements.php:429
+#: achievements.php:428
msgid "New Achievement"
msgstr ""
-#: achievements.php:430
+#: achievements.php:429
msgid "No achievements found."
msgstr ""
-#: achievements.php:431
+#: achievements.php:430
msgid "No achievements found in Trash."
msgstr ""
-#: achievements.php:432
+#: achievements.php:431
msgid "Search Achievements"
msgstr ""
-#: achievements.php:433
+#: achievements.php:432
msgid "Achievement"
msgstr ""
-#: achievements.php:434 achievements.php:435
+#: achievements.php:433 achievements.php:434
msgid "View Achievement"
msgstr ""
-#: achievements.php:464
+#: achievements.php:463
msgctxt "Achievement post type description"
msgid "Achievements types (e.g. new post, new site, new user)"
msgstr ""
-#: achievements.php:485
+#: achievements.php:484
msgctxt "Achievement Progress post type description"
msgid ""
"Achievement Progress (e.g. unlocked achievements for a user, progress on an "
"achievement for a user)"
msgstr ""
-#: achievements.php:517
+#: achievements.php:516
msgctxt "achievement"
msgid "Locked"
msgstr ""
-#: achievements.php:518
+#: achievements.php:517
msgctxt "dpa"
msgid "Locked <span class=\"count\">(%s)</span>"
msgid_plural "Locked <span class=\"count\">(%s)</span>"
msgstr[0] ""
msgstr[1] ""
-#: achievements.php:530
+#: achievements.php:529
msgctxt "achievement"
msgid "Unlocked"
msgstr ""
-#: achievements.php:531
+#: achievements.php:530
msgctxt "dpa"
msgid "Unlocked <span class=\"count\">(%s)</span>"
msgid_plural "Unlocked <span class=\"count\">(%s)</span>"
msgstr[0] ""
msgstr[1] ""
-#: achievements.php:550
+#: achievements.php:549
msgid "Add New Event"
msgstr ""
-#: achievements.php:551
+#: achievements.php:550
msgid "All"
msgstr ""
-#: achievements.php:552
+#: achievements.php:551
msgid "Edit Event"
msgstr ""
-#: achievements.php:553
+#: achievements.php:552
msgctxt "event taxonomy general name"
msgid "Events"
msgstr ""
-#: achievements.php:554
+#: achievements.php:553
msgid "New Event Name"
msgstr ""
-#: achievements.php:555
+#: achievements.php:554
msgid "Popular Events"
msgstr ""
-#: achievements.php:556
+#: achievements.php:555
msgid "Search Events"
msgstr ""
-#: achievements.php:557
+#: achievements.php:556
msgctxt "event taxonomy singular name"
msgid "Event"
msgstr ""
-#: achievements.php:558
+#: achievements.php:557
msgid "Update Event"
msgstr ""
-#: achievements.php:559
+#: achievements.php:558
msgid "View Event"
msgstr ""
-#: achievements.php:596 templates/achievements/achievements-functions.php:48
+#: achievements.php:595 templates/achievements/achievements-functions.php:48
msgid "Achievements Default"
msgstr ""
-#: achievements.php:628
+#: achievements.php:627
msgctxt "Menu item in the toolbar"
msgid "My Achievements"
msgstr ""
+#: includes/achievements/functions.php:238
+msgid "That code was invalid. Try again!"
+msgstr ""
+
#. translators: first param is post permalink, second param is the "more" text.
-#: includes/achievements/template.php:478
+#: includes/achievements/template.php:501
msgid "&hellip; (<a href=\"%1$s\">%2$s</a>)"
msgstr ""
-#: includes/achievements/template.php:480
+#: includes/achievements/template.php:503
msgctxt "Excerpt - click here to see more of the post"
msgid "more"
msgstr ""
-#: includes/achievements/template.php:523 includes/progress/template.php:194
+#: includes/achievements/template.php:546 includes/progress/template.php:252
msgctxt "[date] at [time]"
msgid "%1$s at %2$s"
msgstr ""
-#: includes/achievements/template.php:562
+#: includes/achievements/template.php:585
msgid "%s achievement"
msgid_plural "%s achievements"
msgstr[0] ""
msgstr[1] ""
-#: includes/achievements/template.php:580
+#: includes/achievements/template.php:603
msgid ""
"This site has %1$s, and the last unlocked was <a href=\"%2$s\">%3$s</a> by "
"%4$s."
msgstr ""
-#: includes/achievements/template.php:595
+#: includes/achievements/template.php:618
msgid "This site has %1$s."
msgstr ""
-#: includes/achievements/template.php:694
+#: includes/achievements/template.php:717
msgid "Viewing %1$s achievement"
msgid_plural "Viewing %1$s achievements"
msgstr[0] ""
msgstr[1] ""
-#: includes/achievements/template.php:698
+#: includes/achievements/template.php:721
msgid "Viewing achievement %2$s (of %4$s total)"
msgid_plural "Viewing %1$s achievements - %2$s through %3$s (of %4$s total)"
msgstr[0] ""
@@ -217,118 +221,128 @@ msgstr ""
msgid "Supported Plugins"
msgstr ""
-#: includes/admin/admin.php:276
+#: includes/admin/admin.php:278
msgid "Achievements Settings"
msgstr ""
-#: includes/admin/admin.php:279
+#: includes/admin/admin.php:281
msgctxt "User&rsquo;s total points from unlocked Achievements"
msgid "Total Points"
msgstr ""
-#: includes/admin/admin.php:286
+#: includes/admin/admin.php:288
msgid "Unlocked Achievements"
msgstr ""
-#: includes/admin/admin.php:289
+#: includes/admin/admin.php:291
msgid "Assign or remove achievements from this user"
msgstr ""
-#: includes/admin/class-dpa-users-list-table.php:81
+#: includes/admin/class-dpa-users-list-table.php:82
msgctxt "admin screen, types of users"
msgid "All <span class=\"count\">(%s)</span>"
msgid_plural "All <span class=\"count\">(%s)</span>"
msgstr[0] ""
msgstr[1] ""
#. translators: User role name with count
-#: includes/admin/class-dpa-users-list-table.php:99
+#: includes/admin/class-dpa-users-list-table.php:100
msgid "%1$s <span class=\"count\">(%2$s)</span>"
msgstr ""
-#: includes/admin/class-dpa-users-list-table.php:146
+#: includes/admin/class-dpa-users-list-table.php:147
msgid "Username"
msgstr ""
-#: includes/admin/class-dpa-users-list-table.php:147
+#: includes/admin/class-dpa-users-list-table.php:148
msgid "Last Achievement"
msgstr ""
-#: includes/admin/class-dpa-users-list-table.php:148
+#: includes/admin/class-dpa-users-list-table.php:149
msgid "Actions"
msgstr ""
-#: includes/admin/class-dpa-users-list-table.php:262
+#: includes/admin/class-dpa-users-list-table.php:263
msgid "Edit"
msgstr ""
-#: includes/admin/functions.php:63
+#: includes/admin/functions.php:65
msgid "Karma points:"
msgstr ""
-#: includes/admin/functions.php:68
+#: includes/admin/functions.php:70
msgctxt "type of achievement"
msgid "Type:"
msgstr ""
-#: includes/admin/functions.php:69
+#: includes/admin/functions.php:71
msgctxt "type of achievement"
msgid "&nbsp;Award"
msgstr ""
-#: includes/admin/functions.php:70
+#: includes/admin/functions.php:72
msgctxt "type of achievement"
msgid "&nbsp;Event"
msgstr ""
-#: includes/admin/functions.php:72
+#: includes/admin/functions.php:74
msgid ""
"An <em>award</em> is given by a site admin, whereas an <em>event</em> is "
"unlocked automatically when its criteria have been met."
msgstr ""
-#: includes/admin/functions.php:74
+#: includes/admin/functions.php:76
msgid "Press here to pick events"
msgstr ""
-#: includes/admin/functions.php:91
+#: includes/admin/functions.php:93
msgctxt ""
"Number of times an achievement&#8217;s events need to repeat before the "
"achievement is awarded"
msgid "Events repeat:"
msgstr ""
-#: includes/admin/functions.php:94
+#: includes/admin/functions.php:96
msgid ""
"Number of times the events need to repeat before the achievement is awarded."
msgstr ""
-#: includes/admin/functions.php:176
+#: includes/admin/functions.php:100
+msgid "Redemption code:"
+msgstr ""
+
+#: includes/admin/functions.php:103
+msgid ""
+"Users can enter this code into the Redemption widget to unlock the "
+"achievement."
+msgstr ""
+
+#: includes/admin/functions.php:189
msgid "Title"
msgstr ""
-#: includes/admin/functions.php:177
+#: includes/admin/functions.php:190
msgctxt "Type of the achievement; award or badge"
msgid "Type"
msgstr ""
-#: includes/admin/functions.php:178
+#: includes/admin/functions.php:191
msgid "Karma Points"
msgstr ""
-#: includes/admin/functions.php:179
+#: includes/admin/functions.php:192
msgid "Date"
msgstr ""
-#: includes/admin/functions.php:198
+#: includes/admin/functions.php:211
msgid "Award"
msgstr ""
-#: includes/admin/functions.php:198
+#: includes/admin/functions.php:211
msgid "Event"
msgstr ""
-#: includes/admin/functions.php:228
+#: includes/admin/functions.php:241
msgid ""
"The title field and the big achievement Editing Area are fixed in place, but "
"you can reposition all the other boxes using drag and drop, and can minimize "
@@ -337,17 +351,17 @@ msgid ""
"choose a 1- or 2-column layout for this screen."
msgstr ""
-#: includes/admin/functions.php:232
+#: includes/admin/functions.php:245
msgid "Customizing This Display"
msgstr ""
-#: includes/admin/functions.php:236
+#: includes/admin/functions.php:249
msgid ""
"<strong>Title</strong> - Enter a title for your achievement. After you enter "
"a title, you&#8217;ll see the permalink below, which you can edit."
msgstr ""
-#: includes/admin/functions.php:237
+#: includes/admin/functions.php:250
msgid ""
"<strong>Achievement editor</strong> - Enter the text for your achievement. "
"There are two modes of editing: Visual and Text. Choose the mode by clicking "
@@ -363,11 +377,11 @@ msgid ""
"regular achievement editor."
msgstr ""
-#: includes/admin/functions.php:241
+#: includes/admin/functions.php:254
msgid "Title and Achievement Editor"
msgstr ""
-#: includes/admin/functions.php:245
+#: includes/admin/functions.php:258
msgid ""
"You can upload and insert media (images, audio, documents, etc.) by clicking "
"the Add Media button. You can select from the images and files already "
@@ -376,25 +390,25 @@ msgid ""
"the “Create a new gallery” button."
msgstr ""
-#: includes/admin/functions.php:247
+#: includes/admin/functions.php:260
msgid ""
"You can also embed media from many popular websites including Twitter, "
"YouTube, Flickr and others by pasting the media URL on its own line into the "
"content of your post/page. Please refer to the WordPress Codex to <a href="
"\"%s\">learn more about embeds</a>."
msgstr ""
-#: includes/admin/functions.php:251
+#: includes/admin/functions.php:264
msgid "Inserting Media"
msgstr ""
-#: includes/admin/functions.php:255
+#: includes/admin/functions.php:268
msgid ""
"Several boxes on this screen contain settings for how your achievement will "
"be published, including:"
msgstr ""
-#: includes/admin/functions.php:256
+#: includes/admin/functions.php:269
msgid ""
"<strong>Publish</strong> - You can set the terms of publishing your "
"achievement in the Publish box. For Status, Visibility, and Publish "
@@ -405,139 +419,145 @@ msgid ""
"schedule an achievement to be published in the future."
msgstr ""
-#: includes/admin/functions.php:258
+#: includes/admin/functions.php:271
msgid ""
"<strong>Featured Image</strong> - This allows you to associate an image with "
"your achievement without inserting it into the big achievement Editing Area."
msgstr ""
-#: includes/admin/functions.php:262
+#: includes/admin/functions.php:275
msgid "Publish Settings"
msgstr ""
-#: includes/admin/functions.php:266
+#: includes/admin/functions.php:279
msgid ""
"<strong>Karma points</strong> - set the number of points (called karma) "
"given to a user when they unlock an achievement."
msgstr ""
-#: includes/admin/functions.php:267
+#: includes/admin/functions.php:280
msgid ""
"<strong>Type</strong> - there are two types of achievement, Award and Event. "
"An Award is given by a site admin, whereas an Event is unlocked "
"automatically when its criteria have been met."
msgstr ""
-#: includes/admin/functions.php:268
+#: includes/admin/functions.php:281
msgid ""
-"<strong>Event Achievements</strong> - this field appears when you create an "
+"<strong>Event achievements</strong> - this field appears when you create an "
"Event achievement. Use the dropdown box to choose the events that you want "
"to trigger this achievement."
msgstr ""
-#: includes/admin/functions.php:269
+#: includes/admin/functions.php:282
msgid ""
"<strong>Events repeat</strong> - for Event achievements, set the number of "
"times the events need to occur before the achievement is awarded."
msgstr ""
-#: includes/admin/functions.php:273
+#: includes/admin/functions.php:283
+msgid ""
+"<strong>Redemption code</strong> - users can enter this code into the "
+"Redemption widget to unlock the achievement."
+msgstr ""
+
+#: includes/admin/functions.php:287
msgid "Achievements Box"
msgstr ""
-#: includes/admin/functions.php:278 includes/admin/functions.php:329
+#: includes/admin/functions.php:292 includes/admin/functions.php:343
#: includes/admin/supported-plugins.php:42 includes/admin/users.php:50
msgid "For more information:"
msgstr ""
-#: includes/admin/functions.php:279 includes/admin/functions.php:330
+#: includes/admin/functions.php:293 includes/admin/functions.php:344
#: includes/admin/supported-plugins.php:43 includes/admin/users.php:51
msgid "Achievements Website"
msgstr ""
-#: includes/admin/functions.php:280 includes/admin/functions.php:331
+#: includes/admin/functions.php:294 includes/admin/functions.php:345
#: includes/admin/supported-plugins.php:44 includes/admin/users.php:52
msgid "Support Forums"
msgstr ""
-#: includes/admin/functions.php:297 includes/admin/supported-plugins.php:26
+#: includes/admin/functions.php:311 includes/admin/supported-plugins.php:26
#: includes/admin/users.php:30
msgid "Overview"
msgstr ""
-#: includes/admin/functions.php:299
+#: includes/admin/functions.php:313
msgid ""
"This screen provides access to all of your achievements. You can customize "
"the display of this screen to suit your workflow."
msgstr ""
-#: includes/admin/functions.php:304 includes/admin/users.php:39
+#: includes/admin/functions.php:318 includes/admin/users.php:39
msgid "Screen Content"
msgstr ""
-#: includes/admin/functions.php:306 includes/admin/users.php:41
+#: includes/admin/functions.php:320 includes/admin/users.php:41
msgid ""
"You can customize the display of this screen&#8217;s contents in a number of "
"ways:"
msgstr ""
-#: includes/admin/functions.php:308
+#: includes/admin/functions.php:322
msgid ""
"You can hide/display columns based on your needs and decide how many "
"achievements to list per screen using the Screen Options tab."
msgstr ""
-#: includes/admin/functions.php:309
+#: includes/admin/functions.php:323
msgid ""
"You can filter the list of achievements by achievement status using the text "
"links in the upper left to show All, Published, Draft, or Trashed "
"achievements. The default view is to show all achievements."
msgstr ""
-#: includes/admin/functions.php:310
+#: includes/admin/functions.php:324
msgid ""
"You can view achievements in a simple title list or with an excerpt. Choose "
"the view you prefer by clicking on the icons at the top of the list on the "
"right."
msgstr ""
-#: includes/admin/functions.php:311
+#: includes/admin/functions.php:325
msgid ""
"You can refine the list to show only achievements from a specific month by "
"using the dropdown menus above the posts list. Click the Filter button after "
"making your selection."
msgstr ""
-#: includes/admin/functions.php:317
+#: includes/admin/functions.php:331
msgid "Available Actions"
msgstr ""
-#: includes/admin/functions.php:319
+#: includes/admin/functions.php:333
msgid ""
"Hovering over a row in the achievements list will display action links that "
"allow you to manage your achievement. You can perform the following actions:"
msgstr ""
-#: includes/admin/functions.php:321
+#: includes/admin/functions.php:335
msgid ""
"<strong>Edit</strong> takes you to the editing screen for that achievement. "
"You can also reach that screen by clicking on the achievement title."
msgstr ""
-#: includes/admin/functions.php:322
+#: includes/admin/functions.php:336
msgid ""
"<strong>Quick Edit</strong> provides inline access to the metadata of your "
"achievement, allowing you to update achievement details without leaving this "
"screen."
msgstr ""
-#: includes/admin/functions.php:323
+#: includes/admin/functions.php:337
msgid ""
"<strong>Trash</strong> removes your achievement from this list and places it "
"in the trash, from which you can permanently delete it."
msgstr ""
-#: includes/admin/functions.php:324
+#: includes/admin/functions.php:338
msgid ""
"<strong>Preview</strong> will show you what your draft achievement will look "
"like if you publish it. View will take you to your live site to view the "
@@ -676,22 +696,22 @@ msgctxt "A plugin is not installed"
msgid "Not installed"
msgstr ""
-#: includes/admin/supported-plugins.php:567
+#: includes/admin/supported-plugins.php:571
msgctxt "A plugin is installed"
msgid "Status: Ready"
msgstr ""
-#: includes/admin/supported-plugins.php:575
+#: includes/admin/supported-plugins.php:579
msgctxt "A plugin is not installed"
msgid "Install Plugin"
msgstr ""
-#: includes/admin/supported-plugins.php:591
+#: includes/admin/supported-plugins.php:595
msgctxt "A plugin is not installed"
msgid "Status: Not installed"
msgstr ""
-#: includes/admin/supported-plugins.php:597
+#: includes/admin/supported-plugins.php:601
msgid "More Info"
msgstr ""
@@ -814,17 +834,17 @@ msgctxt "Separator in time since"
msgid ","
msgstr ""
-#: includes/common/template.php:362
+#: includes/common/template.php:366
msgctxt "Home screen of the website"
msgid "Home"
msgstr ""
-#: includes/common/template.php:426
+#: includes/common/template.php:430
msgctxt "HTML entity for left single angle quotes"
msgid "&lsaquo;"
msgstr ""
-#: includes/common/template.php:426
+#: includes/common/template.php:430
msgctxt "HTML entity for right single angle quotes"
msgid "&rsaquo;"
msgstr ""
@@ -833,6 +853,22 @@ msgstr ""
msgid "Achievement: %s"
msgstr ""
+#: includes/common/widgets.php:32
+msgid "Allow users to redeem achievements by typing in a code."
+msgstr ""
+
+#: includes/common/widgets.php:35
+msgid "(Achievements) Redemption"
+msgstr ""
+
+#: includes/common/widgets.php:55 includes/common/widgets.php:88
+msgid "Redeem achievement"
+msgstr ""
+
+#: includes/common/widgets.php:92
+msgid "Title:"
+msgstr ""
+
#: includes/core/theme-compatibility.php:440
msgctxt "possesive noun"
msgid "%s's achievements"
@@ -1157,39 +1193,39 @@ msgstr ""
msgid "WP e-Commerce"
msgstr ""
-#: includes/progress/template.php:347
+#: includes/progress/template.php:426
msgid "Viewing achievement progress %2$s (of %4$s total)"
msgid_plural ""
"Viewing %1$s achievements&rsquo; progress - %2$s through %3$s (of %4$s total)"
msgstr[0] ""
msgstr[1] ""
-#: templates/achievements/achievements/feedback-achievement-unlocked.php:43
+#: templates/achievements/achievements/feedback-achievement-unlocked.php:48
msgctxt "Twitter message: achievement name, site name"
msgid "I've unlocked the \"%1$s\" achievement on %2$s!"
msgstr ""
-#: templates/achievements/achievements/feedback-achievement-unlocked.php:49
+#: templates/achievements/achievements/feedback-achievement-unlocked.php:54
msgid "Achievement Unlocked"
msgstr ""
-#: templates/achievements/achievements/feedback-achievement-unlocked.php:59
+#: templates/achievements/achievements/feedback-achievement-unlocked.php:64
msgid "Hey, you've unlocked the &#8220;%s&#8221; achievement. Congratulations!"
msgstr ""
-#: templates/achievements/achievements/feedback-achievement-unlocked.php:63
+#: templates/achievements/achievements/feedback-achievement-unlocked.php:68
msgid "Celebrate and share with your friends on %1$s and %2$s."
msgstr ""
-#: templates/achievements/achievements/feedback-achievement-unlocked.php:64
+#: templates/achievements/achievements/feedback-achievement-unlocked.php:69
msgid "Facebook"
msgstr ""
-#: templates/achievements/achievements/feedback-achievement-unlocked.php:65
+#: templates/achievements/achievements/feedback-achievement-unlocked.php:70
msgid "Twitter"
msgstr ""
-#: templates/achievements/achievements/feedback-achievement-unlocked.php:69
+#: templates/achievements/achievements/feedback-achievement-unlocked.php:74
msgid "See your other achievements"
msgstr ""
@@ -1202,6 +1238,14 @@ msgid ""
"This is somewhat embarrassing, isn&rsquo;t it? No achievements were found."
msgstr ""
+#: templates/achievements/achievements/form-redeem-code.php:18
+msgid "Enter code:"
+msgstr ""
+
+#: templates/achievements/achievements/form-redeem-code.php:20
+msgid "Unlock"
+msgstr ""
+
#: templates/achievements/achievements/loop-achievements.php:16
msgid ""
"All of the available achievements with the name, avatar, and karma points "
View
71 plugins/achievements/includes/achievements/functions.php
@@ -202,3 +202,74 @@ function dpa_before_achievement_deleted( $post_id = 0 ) {
foreach ( $progress->posts as $post )
wp_delete_post( $post->ID, true );
}
+
+/**
+ * Handles the redeem achievement form submission.
+ *
+ * Finds any achievements with the specific redemption code, and if the user hasn't already unlocked
+ * that achievement, it's awarded to the user.
+ *
+ * @param string $action Optional. If 'dpa-redeem-achievement', handle the form submission.
+ * @since Achievements (3.1)
+ */
+function dpa_form_redeem_achievement( $action = '' ) {
+ if ( 'dpa-redeem-achievement' !== $action || ! dpa_is_user_active() )
+ return;
+
+ // Check required form values are present
+ $redemption_code = isset( $_POST['dpa_code'] ) ? strip_tags( stripslashes( $_POST['dpa_code'] ) ) : '';
+ $redemption_code = apply_filters( 'dpa_form_redeem_achievement_code', $redemption_code );
+
+ if ( empty( $redemption_code ) || ! dpa_verify_nonce_request( 'dpa-redeem-achievement' ) )
+ return;
+
+ // If multisite and running network-wide, switch_to_blog to the data store site
+ if ( is_multisite() && dpa_is_running_networkwide() )
+ switch_to_blog( DPA_DATA_STORE );
+
+ // Find achievements that match the same redemption code
+ $achievements = dpa_get_achievements( array(
+ 'meta_key' => '_dpa_redemption_code',
+ 'meta_value' => $redemption_code,
+ ) );
+
+ // Bail out early if no achievements found
+ if ( empty( $achievements ) ) {
+ dpa_add_error( 'dpa_redeem_achievement_nonce', __( 'That code was invalid. Try again!', 'dpa' ) );
+
+ // If multisite and running network-wide, undo the switch_to_blog
+ if ( is_multisite() && dpa_is_running_networkwide() )
+ restore_current_blog();
+
+ return;
+ }
+
+ $existing_progress = dpa_get_progress( array(
+ 'author' => get_current_user_id(),
+ ) );
+
+ foreach ( $achievements as $achievement_obj ) {
+ $progress_obj = array();
+
+ // If we have existing progress, pass that to dpa_maybe_unlock_achievement().
+ foreach ( $existing_progress as $progress ) {
+ if ( $achievement_obj->ID === $progress->post_parent ) {
+
+ // If the user has already unlocked this achievement, don't give it to them again.
+ if ( dpa_get_unlocked_status_id() == $progress->post_status )
+ $progress_obj = false;
+ else
+ $progress_obj = $progress;
+
+ break;
+ }
+ }
+
+ if ( false !== $progress_obj )
+ dpa_maybe_unlock_achievement( get_current_user_id(), 'skip_validation', $progress_obj, $achievement_obj );
+ }
+
+ // If multisite and running network-wide, undo the switch_to_blog
+ if ( is_multisite() && dpa_is_running_networkwide() )
+ restore_current_blog();
+}
View
25 plugins/achievements/includes/achievements/template.php
@@ -403,7 +403,7 @@ function dpa_achievement_points( $achievement_id = 0 ) {
*
* @param int $achievement_id Optional. Achievement ID
* @return int
- * @since Achievements (3.0)
+ * @since Achievements (2.0)
*/
function dpa_get_achievement_points( $achievement_id = 0 ) {
$achievement_id = dpa_get_achievement_id( $achievement_id );
@@ -438,6 +438,29 @@ function dpa_get_achievement_target( $achievement_id = 0 ) {
}
/**
+ * Output the redemption code for this achievement.
+ *
+ * @param int $achievement_id Optional. Achievement ID
+ * @since Achievements (3.1)
+ */
+function dpa_achievement_redemption_code( $achievement_id = 0 ) {
+ echo number_format_i18n( dpa_get_achievement_redemption_code( $achievement_id ) );
+}
+ /**
+ * Return the redemption code for this achievement.
+ *
+ * @param int $achievement_id Optional. Achievement ID
+ * @return string
+ * @since Achievements (3.1)
+ */
+ function dpa_get_achievement_redemption_code( $achievement_id = 0 ) {
+ $achievement_id = dpa_get_achievement_id( $achievement_id );
+ $target = get_post_meta( $achievement_id, '_dpa_redemption_code', true );
+
+ return apply_filters( 'dpa_get_achievement_redemption_code', $target, $achievement_id );
+ }
+
+/**
* Output the excerpt of the achievement
*
* @param int $achievement_id Optional. Achievement ID
View
8 plugins/achievements/includes/admin/admin.php
@@ -218,13 +218,15 @@ public function enqueue_styles() {
if ( ! DPA_Admin::is_admin_screen() )
return;
+ $rtl = is_rtl() ? '-rtl' : '';
+
// "Supported Plugins" screen
if ( 'achievements-plugins' == $_GET['page'] )
- wp_enqueue_style( 'dpa_admin_css', trailingslashit( $this->css_url ) . 'supportedplugins.css', array(), '20120722' );
+ wp_enqueue_style( 'dpa_admin_css', trailingslashit( $this->css_url ) . "supportedplugins{$rtl}.css", array(), '20120722' );
// Achievements "users" screen
elseif ( 'achievements-users' == $_GET['page'] )
- wp_enqueue_style( 'dpa_admin_users_css', trailingslashit( $this->css_url ) . 'users.css', array(), '20130113' );
+ wp_enqueue_style( 'dpa_admin_users_css', trailingslashit( $this->css_url ) . "users{$rtl}.css", array(), '20130113' );
}
/**
@@ -369,7 +371,7 @@ public function save_profile_fields( $user_id ) {
foreach ( $new_achievements as $achievement_obj ) {
$progress_obj = array();
- // If we have current progress, pass that to dpa_maybe_unlock_achievement().
+ // If we have existing progress, pass that to dpa_maybe_unlock_achievement().
foreach ( $existing_progress as $progress ) {
if ( $achievement_obj->ID === $progress->post_parent ) {
$progress_obj = $progress;
View
2 plugins/achievements/includes/admin/class-dpa-users-list-table.php
@@ -35,7 +35,7 @@ function __construct( $args = array() ) {
* Get an array of all the columns on the page
*
* @return array
- * @since BuddyPress (1.6)
+ * @since Achievements (3.0)
*/
function get_column_info() {
$this->_column_headers = array(
View
3 plugins/achievements/includes/admin/css/achievements-rtl.css
@@ -0,0 +1,3 @@
+/* This file was automatically generated on Feb 17 2013 22:11:51 */
+/*! http://wordpress.org/extend/plugins/achievements/
+*/body #dpa-mb .inside{margin:0;padding:0}#dpa-mb label{display:inline-block;min-width:45%}#dpa-mb .hint{color:#777;margin-bottom:0}#dpa-points,#dpa-target,#dpa-code{display:inline-block;width:50%}#dpa-type-event{margin-right:10px}#dpa_event_chzn{margin-top:10px;width:100%!important}#dpa_event_chzn .default{color:#333;height:100%;width:100%!important}#dpa_event_chzn .chzn-choices{background-color:transparent;background-image:none;border:1px solid #bbb;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}#dpa_event_chzn.chzn-container-active .chzn-drop{margin-top:1px;position:static}#dpa_event_chzn.chzn-container-active .chzn-choices{-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}#dpa_event_chzn .search-choice{background:#f3f3f3;background-image:-webkit-gradient(linear,right top,right bottom,from(#fff),to(#eee));background-image:-webkit-linear-gradient(top,#fff,#eee);background-image:-moz-linear-gradient(top,#fff,#eee);background-image:-o-linear-gradient(top,#fff,#eee);background-image:linear-gradient(to bottom,#fff,#eee);border-color:#ccc;-webkit-box-shadow:inset 0 2px 1px 0 rgba(255,255,255,0.9);-moz-box-shadow:inset 0 2px 1px 0 rgba(255,255,255,0.9);box-shadow:inset 0 2px 1px 0 rgba(255,255,255,0.9);color:#464646;font-size:12px;min-height:15px;line-height:17px;margin:5px 5px;padding:.25em .8em .35em 1.5em;text-shadow:1px 1px 0 #fff}#dpa_event_chzn .chzn-results .group-result{color:#333}#dpa_event_chzn .chzn-results .highlighted{background-color:#21759b;background-image:-webkit-gradient(linear,right top,right bottom,from(#2a95c5),to(#21759b));background-image:-webkit-linear-gradient(top,#2a95c5,#21759b);background-image:-moz-linear-gradient(top,#2a95c5,#21759b);background-image:-o-linear-gradient(top,#2a95c5,#21759b);background-image:linear-gradient(to bottom,#2a95c5,#21759b);border-color:#21759b;border-bottom-color:#1e6a8d;-webkit-box-shadow:inset 0 1px 0 rgba(120,200,230,0.5);-moz-box-shadow:inset 0 1px 0 rgba(120,200,230,0.5);box-shadow:inset 0 1px 0 rgba(120,200,230,0.5);color:#fff;text-decoration:none;text-shadow:-1px -1px 0 rgba(0,0,0,0.1)}#dpa-event,.chzn-drop{width:100%!important}
View
2 plugins/achievements/includes/admin/css/achievements.css
@@ -1,2 +1,2 @@
/*! http://wordpress.org/extend/plugins/achievements/
-*/body #dpa-mb .inside{margin:0;padding:0}#dpa-mb label{display:inline-block;min-width:45%}#dpa-mb .hint{color:#777;margin-bottom:0}#dpa-points,#dpa-target{display:inline-block;width:50%}#dpa-type-event{margin-left:10px}#dpa_event_chzn{margin-top:10px;width:100%!important}#dpa_event_chzn .default{color:#333;height:100%;width:100%!important}#dpa_event_chzn .chzn-choices{background-color:transparent;background-image:none;border:1px solid #bbb;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}#dpa_event_chzn.chzn-container-active .chzn-drop{margin-top:1px;position:static}#dpa_event_chzn.chzn-container-active .chzn-choices{-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}#dpa_event_chzn .search-choice{background:#f3f3f3;background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#eee));background-image:-webkit-linear-gradient(top,#fff,#eee);background-image:-moz-linear-gradient(top,#fff,#eee);background-image:-o-linear-gradient(top,#fff,#eee);background-image:linear-gradient(to bottom,#fff,#eee);border-color:#ccc;-webkit-box-shadow:inset 0 0 1px 2px rgba(255,255,255,0.9);-moz-box-shadow:inset 0 0 1px 2px rgba(255,255,255,0.9);box-shadow:inset 0 0 1px 2px rgba(255,255,255,0.9);color:#464646;font-size:12px;min-height:15px;line-height:17px;margin:5px 5px;padding:.25em 1.5em .35em .8em;text-shadow:1px 1px 0 #fff}#dpa_event_chzn .chzn-results .group-result{color:#333}#dpa_event_chzn .chzn-results .highlighted{background-color:#21759b;background-image:-webkit-gradient(linear,left top,left bottom,from(#2a95c5),to(#21759b));background-image:-webkit-linear-gradient(top,#2a95c5,#21759b);background-image:-moz-linear-gradient(top,#2a95c5,#21759b);background-image:-o-linear-gradient(top,#2a95c5,#21759b);background-image:linear-gradient(to bottom,#2a95c5,#21759b);border-color:#21759b;border-bottom-color:#1e6a8d;-webkit-box-shadow:inset 0 1px 0 rgba(120,200,230,0.5);-moz-box-shadow:inset 0 1px 0 rgba(120,200,230,0.5);box-shadow:inset 0 1px 0 rgba(120,200,230,0.5);color:#fff;text-decoration:none;text-shadow:-1px -1px 0 rgba(0,0,0,0.1)}#dpa-event,.chzn-drop{width:100%!important}
+*/body #dpa-mb .inside{margin:0;padding:0}#dpa-mb label{display:inline-block;min-width:45%}#dpa-mb .hint{color:#777;margin-bottom:0}#dpa-points,#dpa-target,#dpa-code{display:inline-block;width:50%}#dpa-type-event{margin-left:10px}#dpa_event_chzn{margin-top:10px;width:100%!important}#dpa_event_chzn .default{color:#333;height:100%;width:100%!important}#dpa_event_chzn .chzn-choices{background-color:transparent;background-image:none;border:1px solid #bbb;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}#dpa_event_chzn.chzn-container-active .chzn-drop{margin-top:1px;position:static}#dpa_event_chzn.chzn-container-active .chzn-choices{-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}#dpa_event_chzn .search-choice{background:#f3f3f3;background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#eee));background-image:-webkit-linear-gradient(top,#fff,#eee);background-image:-moz-linear-gradient(top,#fff,#eee);background-image:-o-linear-gradient(top,#fff,#eee);background-image:linear-gradient(to bottom,#fff,#eee);border-color:#ccc;-webkit-box-shadow:inset 0 0 1px 2px rgba(255,255,255,0.9);-moz-box-shadow:inset 0 0 1px 2px rgba(255,255,255,0.9);box-shadow:inset 0 0 1px 2px rgba(255,255,255,0.9);color:#464646;font-size:12px;min-height:15px;line-height:17px;margin:5px 5px;padding:.25em 1.5em .35em .8em;text-shadow:1px 1px 0 #fff}#dpa_event_chzn .chzn-results .group-result{color:#333}#dpa_event_chzn .chzn-results .highlighted{background-color:#21759b;background-image:-webkit-gradient(linear,left top,left bottom,from(#2a95c5),to(#21759b));background-image:-webkit-linear-gradient(top,#2a95c5,#21759b);background-image:-moz-linear-gradient(top,#2a95c5,#21759b);background-image:-o-linear-gradient(top,#2a95c5,#21759b);background-image:linear-gradient(to bottom,#2a95c5,#21759b);border-color:#21759b;border-bottom-color:#1e6a8d;-webkit-box-shadow:inset 0 1px 0 rgba(120,200,230,0.5);-moz-box-shadow:inset 0 1px 0 rgba(120,200,230,0.5);box-shadow:inset 0 1px 0 rgba(120,200,230,0.5);color:#fff;text-decoration:none;text-shadow:-1px -1px 0 rgba(0,0,0,0.1)}#dpa-event,.chzn-drop{width:100%!important}
View
3 plugins/achievements/includes/admin/css/dev/achievements.less
@@ -25,7 +25,8 @@ body #dpa-mb .inside {
}
#dpa-points,
-#dpa-target {
+#dpa-target,
+#dpa-code {
display: inline-block;
width: 50%;
}
View
1 plugins/achievements/includes/admin/css/supportedplugins-rtl.css
@@ -0,0 +1 @@
+/* This file was automatically generated on Feb 17 2013 22:11:58 */
View
1 plugins/achievements/includes/admin/css/users-rtl.css
@@ -0,0 +1 @@
+#dpa-admin-users-form .search-box{margin-bottom:13px}#dpa-admin-users-form .column-dpa_achievements,#dpa-admin-users-form .column-dpa_actions,#dpa-admin-users-form .column-username{width:15%}#dpa-admin-users-form .column-username img{margin-bottom:10px}
View
22 plugins/achievements/includes/admin/functions.php
@@ -29,8 +29,9 @@ function dpa_admin_setup_metaboxes() {
wp_enqueue_script( 'dpa_chosen_js', trailingslashit( achievements()->admin->javascript_url ) . 'chosen-jquery-min.js', array( 'jquery' ), '20121006' );
// General styles for the post type admin screen.
+ $rtl = is_rtl() ? '-rtl' : '';
wp_enqueue_script( 'dpa_admin_js', trailingslashit( achievements()->admin->javascript_url ) . 'achievements-min.js', array( 'jquery', 'dpa_chosen_js' ), '20121006' );
- wp_enqueue_style( 'dpa_admin_css', trailingslashit( achievements()->admin->css_url ) . 'achievements.css', array(), '20121006' );
+ wp_enqueue_style( 'dpa_admin_css', trailingslashit( achievements()->admin->css_url ) . "achievements{$rtl}.css", array(), '20121006' );
}
/**
@@ -50,6 +51,7 @@ function dpa_achievement_metabox( $post ) {
$existing_target = dpa_get_achievement_target( $post->ID );
$existing_events = wp_get_post_terms( $post->ID, dpa_get_event_tax_id(), array( 'fields' => 'ids', ) );
$existing_type = ( empty( $existing_events ) && ! empty( $_GET['action'] ) && 'edit' == $_GET['action'] ) ? 'award' : 'event';
+ $existing_code = dpa_get_achievement_redemption_code( $post->ID );
// Ensure sane defaults
if ( empty( $existing_points ) )
@@ -59,12 +61,12 @@ function dpa_achievement_metabox( $post ) {
$existing_target = 1;
?>
- <div class="misc-pub-section">
+ <div class="misc-pub-section dpa-karma">
<label for="dpa-points"><?php _e( 'Karma points:', 'dpa' ); ?></label>
<input type="number" name="dpa_points" id="dpa-points" value="<?php echo esc_attr( $existing_points ); ?>" />
</div>
- <div class="misc-pub-section">
+ <div class="misc-pub-section dpa-type">
<label for="dpa_type"><?php _ex( 'Type:', 'type of achievement', 'dpa' ); ?></label>
<input type="radio" name="dpa_type" id="dpa-type-award" value="award" <?php checked( $existing_type, 'award' ); ?>><?php _ex( '&nbsp;Award', 'type of achievement', 'dpa' ); ?></input>
<input type="radio" name="dpa_type" id="dpa-type-event" value="event" <?php checked( $existing_type, 'event' ); ?>><?php _ex( '&nbsp;Event', 'type of achievement', 'dpa' ); ?></input>
@@ -94,6 +96,13 @@ function dpa_achievement_metabox( $post ) {
<p class="hint"><?php _e( "Number of times the events need to repeat before the achievement is awarded.", 'dpa' ); ?></p>
</div>
+ <div class="misc-pub-section dpa-redemption-code">
+ <label for="dpa-code"><?php _e( 'Redemption code:', 'dpa' ); ?></label>
+ <input id="dpa-code" value="<?php echo esc_attr( $existing_code ); ?>" name="dpa_code" type="text" />
+
+ <p class="hint"><?php _e( "Users can enter this code into the Redemption widget to unlock the achievement.", 'dpa' ); ?></p>
+ </div>
+
<?php
wp_nonce_field( 'dpa_achievement_metabox_save', 'dpa_achievement_metabox' );
do_action( 'dpa_achievement_metabox' );
@@ -140,6 +149,10 @@ function dpa_achievement_metabox_save( $achievement_id ) {
$type = 'award';
}
+ // Redemption code
+ $redemption_code = isset( $_POST['dpa_code'] ) ? strip_tags( stripslashes( $_POST['dpa_code'] ) ) : '';
+ update_post_meta( $achievement_id, '_dpa_redemption_code', $redemption_code );
+
// Event repeats count target
$frequency = ! empty( $_POST['dpa_target'] ) ? (int) $_POST['dpa_target'] : 1;
if ( $frequency < 1 )
@@ -265,8 +278,9 @@ function dpa_achievement_new_contextual_help() {
$achievements_box = '<p>' . __( '<strong>Karma points</strong> - set the number of points (called karma) given to a user when they unlock an achievement.', 'dpa' ) . '</p>';
$achievements_box .= '<p>' . __( '<strong>Type</strong> - there are two types of achievement, Award and Event. An Award is given by a site admin, whereas an Event is unlocked automatically when its criteria have been met.', 'dpa' ) . '</p>';
- $achievements_box .= '<p>' . __( '<strong>Event Achievements</strong> - this field appears when you create an Event achievement. Use the dropdown box to choose the events that you want to trigger this achievement.', 'dpa' ) . '</p>';
+ $achievements_box .= '<p>' . __( '<strong>Event achievements</strong> - this field appears when you create an Event achievement. Use the dropdown box to choose the events that you want to trigger this achievement.', 'dpa' ) . '</p>';
$achievements_box .= '<p>' . __( '<strong>Events repeat</strong> - for Event achievements, set the number of times the events need to occur before the achievement is awarded.', 'dpa' ) . '</p>';
+ $achievements_box .= '<p>' . __( '<strong>Redemption code</strong> - users can enter this code into the Redemption widget to unlock the achievement.', 'dpa' ) . '</p>';
get_current_screen()->add_help_tab( array(
'id' => 'achievement-box',
View
14 plugins/achievements/includes/admin/supported-plugins.php
@@ -284,7 +284,7 @@ function dpa_supported_plugins_list() {
$page_url = add_query_arg( 'filter', $filter, $page_url );
// Get supported plugins
- $extensions = achievements()->extensions;
+ $extensions = (array) achievements()->extensions;
// Sort list of plugins by rating
//if ( ! empty( $_GET['order'] ) && 'rating' == $_GET['order'] )
@@ -297,8 +297,8 @@ function dpa_supported_plugins_list() {
// Sort alphabetically
//else
- $extensions_array = (array) $extensions;
- uasort( $extensions_array, create_function( '$a, $b', 'return strnatcasecmp($a->get_name(), $b->get_name());' ) );
+ uasort( $extensions, create_function( '$a, $b', 'return strnatcasecmp($a->get_name(), $b->get_name());' ) );
+ $extensions = (object) $extensions;
// Build URL for non-javascript table sorting
$redirect_to = remove_query_arg( _dpa_supported_plugin_get_queryargs(), self_admin_url( 'edit.php?post_type=achievement&page=achievements-plugins' ) );
@@ -438,7 +438,9 @@ function dpa_supported_plugins_grid() {
$filter = dpa_supported_plugins_get_filter();
// Get supported plugins
- $extensions = achievements()->extensions;
+ $extensions = (array) achievements()->extensions;
+ uasort( $extensions, create_function( '$a, $b', 'return strnatcasecmp($a->get_name(), $b->get_name());' ) );
+ $extensions = (object) $extensions;
echo '<div class="wrapper"><div>';
foreach ( $extensions as $extension ) {
@@ -475,7 +477,9 @@ function dpa_supported_plugins_mb_switcher() {
echo '<select id="dpa-details-plugins">';
// Get supported plugins
- $extensions = achievements()->extensions;
+ $extensions = (array) achievements()->extensions;
+ uasort( $extensions, create_function( '$a, $b', 'return strnatcasecmp($a->get_name(), $b->get_name());' ) );
+ $extensions = (object) $extensions;
foreach ( $extensions as $extension ) {
// Extensions must inherit the DPA_Extension class
View
2 plugins/achievements/includes/admin/users.php
@@ -58,7 +58,7 @@ function dpa_admin_screen_users_on_load() {
*
* @global DPA_Users_List_Table $dpa_users_list_table Activity screen list table
* @global string $plugin_page
- * @since Achievements (3.)
+ * @since Achievements (3.0)
*/
function dpa_admin_screen_users() {
global $dpa_users_list_table, $plugin_page;
View
44 plugins/achievements/includes/class-dpa-shortcodes.php
@@ -41,14 +41,22 @@ private function setup_globals() {
// Setup the shortcodes
$this->codes = apply_filters( 'dpa_shortcodes', array(
+
// Achievements index
- 'dpa-achievements-index' => array( $this, 'display_achievements_index' ),
+ 'dpa-achievements-index' => array( $this, 'display_achievements_index' ),
+
+ // User achievement index
+ 'dpa-user-achievements-index' => array( $this, 'display_user_achievements' ),
// Specific achievement - pass an 'id' attribute
- 'dpa-single-achievement' => array( $this, 'display_achievement' ),
+ 'dpa-single-achievement' => array( $this, 'display_achievement' ),
+
+ // Widgets
+ 'dpa-redeem-achievement-form' => array( $this, 'display_redeem_achievement_form' ),
// Misc
- 'dpa-breadcrumb' => array( $this, 'display_breadcrumb' ),
+ 'dpa-breadcrumb' => array( $this, 'display_breadcrumb' ),
+ 'dpa-unlock-notice' => array( $this, 'display_feedback_achievement_unlocked' ),
) );
}
@@ -127,6 +135,7 @@ private function end() {
return $output;
}
+
/**
* Achievement shortcodes
*/
@@ -210,11 +219,33 @@ public function display_user_achievements() {
/**
+ * Widget shortcodes
+ */
+
+ /**
+ * Display the redeem achievements widget in an output buffer and return to ensure that post/page
+ * contents are displayed first.
+ *
+ * @return string Contents of output buffer
+ * @since Achievements (3.1)
+ */
+ public function display_redeem_achievement_form() {
+ $this->unset_globals();
+
+ // Start output buffer
+ $this->start();
+
+ dpa_get_template_part( 'form-redeem-code' );
+
+ return $this->end();
+ }
+
+ /**
* Other templates
*/
/**
- * Display a breadcrumb
+ * Display a breadcrumb in an output buffer and return to ensure that post/page contents are displayed first.
*
* @return string Contents of output buffer
* @since Achievements (3.0)
@@ -237,6 +268,11 @@ public function display_breadcrumb() {
* @since Achievements (3.0)
*/
public function display_feedback_achievement_unlocked() {
+
+ // Style and script
+ achievements()->theme_functions->enqueue_notifications_style( true );
+ achievements()->theme_functions->enqueue_notifications_script( true );
+
$this->unset_globals();
// Start output buffer
View
50 plugins/achievements/includes/common/functions.php
@@ -298,6 +298,7 @@ function dpa_parse_args( $args, $defaults = '', $filter_key = '' ) {
*
* @param string $path Optional
* @since Achievements (3.0)
+ * @todo Do I need to worry about the plugin running sitewide in multisite?
* @return mixed False if no page, Page object if true
*/
function dpa_get_page_by_path( $path = '' ) {
@@ -307,10 +308,57 @@ function dpa_get_page_by_path( $path = '' ) {
if ( ! empty( $path ) ) {
// Pretty permalinks are on so path might exist
- // @todo Achievements - do I need to worry about the plugin running sitewide in multisite?
if ( get_option( 'permalink_structure' ) )
$retval = get_page_by_path( $path );
}
return apply_filters( 'dpa_get_page_by_path', $retval, $path );
}
+
+/**
+ * Return the unescaped redirect_to request value
+ *
+ * @return string The URL to redirect to, if set
+ * @since Achievements (3.1)
+ */
+function dpa_get_redirect_to() {
+ $retval = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
+ return apply_filters( 'dpa_get_redirect_to', $retval );
+}
+
+
+/**
+ * Nonces
+ */
+
+/**
+ * Makes sure the user requested an action from another page on this site.
+ *
+ * To avoid security exploits within the theme.
+ *
+ * @param string $action Optional. Action nonce
+ * @param string $query_arg Optional (defaults to _wpnonce). Where to look for nonce in $_REQUEST
+ * @see https://bbpress.trac.wordpress.org/ticket/1863 for the background of the bbPress version of the function
+ * @since Achievements (3.1)
+ * @todo Support port number for non-multisite.
+ */
+function dpa_verify_nonce_request( $action = '', $query_arg = '_wpnonce' ) {
+
+ // Parse home_url() into pieces to remove query strings, strange characters, and other funny things that plugins might to do to it.
+ $parsed_home = parse_url( home_url( '/', ( is_ssl() ? 'https://' : 'http://' ) ) );
+ $home_url = trim( strtolower( $parsed_home['scheme'] . '://' . $parsed_home['host'] . $parsed_home['path'] ), '/' );
+
+ // Build the currently requested URL
+ $scheme = is_ssl() ? 'https://' : 'http://';
+ $requested_url = apply_filters( 'dpa_verify_nonce_request_url', strtolower( $scheme . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ) );
+
+ // Check the nonce
+ $result = isset( $_REQUEST[$query_arg] ) ? wp_verify_nonce( $_REQUEST[$query_arg], $action ) : false;
+
+ // Did the nonce check fail?
+ if ( empty( $result ) || empty( $action ) || ( strpos( $requested_url, $home_url ) !== 0 ) )
+ $result = false;
+
+ do_action( 'dpa_verify_nonce_request', $action, $result );
+ return $result;
+}
View
26 plugins/achievements/includes/common/template.php
@@ -161,7 +161,11 @@ function dpa_body_class( $wp_classes, $custom_classes = array() ) {
if ( dpa_is_single_achievement() )
$achievements_classes[] = dpa_get_achievement_post_type();
- //* Clean up **************************************************************/
+ // Does the user have any pending notifications?
+ if ( dpa_user_has_notifications() )
+ $achievements_classes[] = 'achievement-notifications';
+
+ // Clean up
// Add achievements class if we are on an Achievements page
if ( ! empty( $achievements_classes ) )
@@ -648,4 +652,22 @@ function dpa_title( $title = '', $sep = '&raquo;', $seplocation = '' ) {
// Filter and return
return apply_filters( 'dpa_title', $title, $sep, $seplocation );
-}
+}
+
+
+/**
+ * Forms
+ */
+
+/**
+ * Output the required hidden form fields for redeeming an achievement
+ *
+ * @since Achievements (3.1)
+ */
+function dpa_redeem_achievement_form_fields() {
+?>
+
+ <input type="hidden" name="dpa_action" id="dpa_post_action" value="dpa-redeem-achievement" />
+ <?php wp_nonce_field( 'dpa-redeem-achievement' );
+
+}
View
99 plugins/achievements/includes/common/widgets.php
@@ -0,0 +1,99 @@
+<?php
+/**
+ * Achievements widgets
+ *
+ * Contains the forum list, topic list, reply list and login form widgets.
+ *
+ * @package Achievements
+ * @subpackage CommonWidgets
+ */
+
+// Exit if accessed directly
+if ( ! defined( 'ABSPATH' ) ) exit;
+
+
+/**
+ * Redeem achievements widget
+ *
+ * This widget consists of a text box, allowing users to type in a code and unlock an associated achievement.
+ *
+ * @since Achievements (3.1)
+ */
+class DPA_Redeem_Achievements_Widget extends WP_Widget {
+
+ /**
+ * Redeem achievements widget
+ *
+ * @since Achievements (3.1)
+ */
+ public function __construct() {
+ $widget_ops = apply_filters( 'dpa_redeem_achievements_widget_options', array(
+ 'classname' => 'widget_dpa_redeem_achievements',
+ 'description' => __( 'Allow users to redeem achievements by typing in a code.', 'dpa' )
+ ) );
+
+ parent::__construct( false, __( '(Achievements) Redemption', 'dpa' ), $widget_ops );
+ }
+
+ /**
+ * Register the widget
+ *
+ * @since Achievements (3.1)
+ */
+ public static function register_widget() {
+ register_widget( 'DPA_Redeem_Achievements_Widget' );
+ }
+
+ /**
+ * Displays the output
+ *
+ * @since Achievements (3.1)
+ */
+ public function widget( $args, $instance ) {
+ $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
+ if ( empty( $title ) )
+ $title = __( 'Redeem achievement', 'dpa' );
+
+ $title = apply_filters( 'dpa_redeem_achievements_widget_title', $instance['title'], $instance, $this->id_base );
+
+ echo $args['before_widget'];
+ echo $args['before_title'] . $title . $args['after_title'];
+
+ dpa_get_template_part( 'form-redeem-code' );
+
+ echo $args['after_widget'];
+ }
+
+ /**
+ * Update the topic widget options
+ *
+ * @param array $new_instance The new instance options
+ * @param array $old_instance The old instance options
+ * @since Achievements (3.1)
+ */
+ public function update( $new_instance, $old_instance ) {
+ $instance = $old_instance;
+ $instance['title'] = strip_tags( $new_instance['title'] );
+
+ return $instance;
+ }
+
+ /**
+ * Output the topic widget options form
+ *
+ * @param $instance Instance
+ * @since Achievements (3.1)
+ */
+ public function form( $instance ) {
+ $title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'Redeem achievement', 'dpa' );
+ ?>
+
+ <p>
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'dpa' ); ?>
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
+ </label>
+ </p>
+
+ <?php
+ }
+}
View
9 plugins/achievements/includes/core/actions.php
@@ -82,6 +82,9 @@
// Try to load the achievements-functions.php file from the active theme
add_action( 'dpa_after_setup_theme', 'dpa_load_theme_functions', 10 );
+// Widgets
+add_action( 'dpa_widgets_init', array( 'DPA_Redeem_Achievements_Widget', 'register_widget' ), 10 );
+
// Template - Head, foot, errors and messages
add_action( 'dpa_head', 'dpa_achievement_notices' );
add_action( 'dpa_template_notices', 'dpa_template_notices' );
@@ -99,3 +102,9 @@
// Before delete achievement
add_action( 'delete_post', 'dpa_before_achievement_deleted' );
+
+// POST handler
+add_action( 'dpa_template_redirect', 'dpa_post_request', 10 );
+
+// Theme-side POST requests
+add_action( 'dpa_post_request', 'dpa_form_redeem_achievement', 10 );
View
15 plugins/achievements/includes/core/dependency.php
@@ -264,6 +264,21 @@ function dpa_after_setup_theme() {
}
/**
+ * The main action used for handling theme-side POST requests
+ *
+ * @since Achievements (3.1)
+ */
+function dpa_post_request() {
+ if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) || defined( 'DOING_AJAX' ) && DOING_AJAX || is_admin() )
+ return;
+
+ if ( empty( $_POST['dpa_action'] ) )
+ return;
+
+ do_action( 'dpa_post_request', $_POST['dpa_action'] );
+}
+
+/**
* Filter the plugin locale and domain.
*
* @param string $locale Optional
View
6 plugins/achievements/includes/core/template-loader.php
@@ -59,8 +59,12 @@ function dpa_load_theme_functions() {
if ( dpa_is_deactivation() )
return;
- if ( ! defined( 'WP_INSTALLING' ) || ( ! empty( $pagenow ) && ( 'wp-activate.php' !== $pagenow ) ) )
+ if ( ! defined( 'WP_INSTALLING' ) || ( ! empty( $pagenow ) && ( 'wp-activate.php' !== $pagenow ) ) ) {
dpa_locate_template( 'achievements-functions.php', true );
+
+ if ( class_exists( 'DPA_Default' ) )
+ achievements()->theme_functions = new DPA_Default();
+ }
}
View
4 plugins/achievements/includes/extensions/wordpress.php
@@ -110,7 +110,7 @@ function event_name( $event_name, $func_args ) {
*/
public function event_user_id( $user_id, $action_name, $action_func_args ) {
// Only deal with events added by this extension.
- if ( ! in_array( $action_name, array( 'comment_post', 'draft_to_publish', ) ) )
+ if ( ! in_array( $action_name, array( 'comment_post', 'wordpress_draft_to_publish', ) ) )
return $user_id;
// New comment, check that the author isn't anonymous
@@ -126,7 +126,7 @@ public function event_user_id( $user_id, $action_name, $action_func_args ) {
return $comment->user_id;
// New post, get the post author
- } elseif ( 'draft_to_publish' == $action_name && 'post' == $action_func_args[0]->post_type ) {
+ } elseif ( 'wordpress_draft_to_publish' == $action_name && 'post' == $action_func_args[0]->post_type ) {
return $this->get_post_author( $user_id, $action_name, $action_func_args );
}
}
View
113 plugins/achievements/includes/progress/template.php
@@ -46,7 +46,9 @@ function dpa_has_progress( $args = array() ) {
'post_parent' => dpa_is_single_achievement() ? dpa_get_achievement_id() : null,
// If on a single achievement page, don't paginate progresses.
- 'posts_per_page' => dpa_is_single_achievement() ? -1 : dpa_get_progresses_per_page(),
+ //'posts_per_page' => dpa_is_single_achievement() ? -1 : dpa_get_progresses_per_page(),
+ // Above commented out for 3.1; see https://github.com/paulgibbs/achievements/issues/70 for details
+ 'posts_per_page' => -1,
// If on a user's achievements page, fetch the achievements if we haven't got them already
'ach_populate_achievements' => dpa_is_single_user_achievements() && ! is_a( achievements()->achievement_query, 'WP_Query' ),
@@ -57,6 +59,62 @@ function dpa_has_progress( $args = array() ) {
// Run the query
achievements()->progress_query = new WP_Query( $args );
+ // If no limit to posts per page, set it to the current post_count
+ if ( -1 == $args['posts_per_page'] )
+ $args['posts_per_page'] = achievements()->progress_query->post_count;
+
+ // Add pagination values to query object
+ achievements()->progress_query->posts_per_page = $args['posts_per_page'];
+ achievements()->progress_query->paged = $args['paged'];
+
+ // Only add pagination if query returned results
+ if ( ( (int) achievements()->progress_query->post_count || (int) achievements()->progress_query->found_posts ) && (int) achievements()->progress_query->posts_per_page ) {
+
+ // Limit the number of achievements shown based on maximum allowed pages
+ if ( ( ! empty( $args['max_num_pages'] ) ) && achievements()->progress_query->found_posts > achievements()->progress_query->max_num_pages * achievements()->progress_query->post_count )
+ achievements()->progress_query->found_posts = achievements()->progress_query->max_num_pages * achievements()->progress_query->post_count;
+
+ // If pretty permalinks are enabled, make our pagination pretty
+ if ( $GLOBALS['wp_rewrite']->using_permalinks() ) {
+
+ // Page or single post
+ if ( is_page() || is_single() )
+ $base = get_permalink();
+
+ // User achievements page
+ elseif ( dpa_is_single_user_achievements() )
+ $base = user_trailingslashit( trailingslashit( get_author_posts_url( $args['author'] ) ) . dpa_get_authors_endpoint() );
+
+ // Default
+ else
+ $base = get_permalink( $args['post_parent'] );
+
+ // Use pagination base
+ $base = trailingslashit( $base ) . user_trailingslashit( $GLOBALS['wp_rewrite']->pagination_base . '/%#%/' );
+
+ // Unpretty pagination
+ } else {
+ $base = add_query_arg( 'paged', '%#%' );
+ }
+
+ // Pagination settings with filter
+ $progress_pagination = apply_filters( 'dpa_progress_pagination', array(
+ 'base' => $base,
+ 'current' => (int) achievements()->progress_query->paged,
+ 'format' => '',
+ 'mid_size' => 1,
+ 'next_text' => '&rarr;',
+ 'prev_text' => '&larr;',
+ 'total' => ( $args['posts_per_page'] == achievements()->progress_query->found_posts ) ? 1 : ceil( (int) achievements()->progress_query->found_posts / (int) $args['posts_per_page'] ),
+ ) );
+
+ // Add pagination to query object
+ achievements()->progress_query->pagination_links = paginate_links( $progress_pagination );
+
+ // Remove first page from pagination
+ achievements()->progress_query->pagination_links = str_replace( $GLOBALS['wp_rewrite']->pagination_base . "/1/'", "'", achievements()->progress_query->pagination_links );
+ }
+
// If on a user's achievements page, we need to fetch the achievements
if ( $args['ach_populate_achievements'] && achievements()->progress_query->have_posts() ) {
$achievement_ids = wp_list_pluck( (array) achievements()->progress_query->posts, 'post_parent' );
@@ -308,6 +366,27 @@ function dpa_get_progress_class( $progress_id = 0 ) {
return $retval;
}
+/**
+ * Has the current achievement in the progress loop been unlocked by the current user?
+ *
+ * The "current" user refers to the user in the dpa_has_achievements() loop, which is not necessarily
+ * the currently-logged in user.
+ *
+ * @param int $achievement_id Optional. Achievement ID to check.
+ * @return bool True if achievement has been unlocked
+ * @since Achievements (3.0)
+ */
+function dpa_is_achievement_unlocked( $achievement_id = 0 ) {
+ $achievement_id = dpa_get_achievement_id( $achievement_id );
+
+ // Look in the progress posts and match the achievement against a post_parent
+ $progress = wp_filter_object_list( achievements()->progress_query->posts, array( 'post_parent' => $achievement_id ) );
+ $progress = array_shift( $progress );
+
+ $retval = ( ! empty( $progress ) && dpa_get_unlocked_status_id() == $progress->post_status );
+ return apply_filters( 'dpa_is_achievement_unlocked', $retval, $achievement_id, $progress );
+}
+
/**
* Achievement Progress pagination
@@ -351,22 +430,22 @@ function dpa_get_progress_pagination_count() {
}
/**
- * Has the current achievement in the progress loop been unlocked by the current user?
- *
- * The "current" user refers to the user in the dpa_has_achievements() loop, which is not necessarily
- * the currently-logged in user.
+ * Output pagination links
*
- * @param int $achievement_id Optional. Achievement ID to check.
- * @return bool True if achievement has been unlocked
- * @since Achievements (3.0)
+ * @since Achievements (3.1)
*/
-function dpa_is_achievement_unlocked( $achievement_id = 0 ) {
- $achievement_id = dpa_get_achievement_id( $achievement_id );
-
- // Look in the progress posts and match the achievement against a post_parent
- $progress = wp_filter_object_list( achievements()->progress_query->posts, array( 'post_parent' => $achievement_id ) );
- $progress = array_shift( $progress );
-
- $retval = ( ! empty( $progress ) && dpa_get_unlocked_status_id() == $progress->post_status );
- return apply_filters( 'dpa_is_achievement_unlocked', $retval, $achievement_id, $progress );
+function dpa_progress_pagination_links() {
+ echo dpa_get_progress_pagination_links();
}
+ /**
+ * Return pagination links
+ *
+ * @return string Pagination links
+ * @since Achievements (3.1)
+ */
+ function dpa_get_progress_pagination_links() {
+ if ( ! is_a( achievements()->progress_query, 'WP_Query' ) )
+ return;
+
+ return apply_filters( 'dpa_get_progress_pagination_links', achievements()->progress_query->pagination_links );
+ }
View
14 plugins/achievements/includes/users/notifications.php
@@ -30,17 +30,27 @@ function dpa_send_notification( $achievement_obj, $user_id, $progress_id ) {
}
/**
+ * Does the user have any pending notifications?
+ *
+ * @since Achievements (3.1)
+ */
+function dpa_user_has_notifications() {
+ $notifications = dpa_get_user_notifications();
+ return apply_filters( 'dpa_user_has_notifications', ! empty( $notifications ) );
+}
+
+/**
* Print any notifications for the current user to the page footer.
*
* @since Achievements (3.0)
*/
function dpa_print_notifications() {
// If user's not active or is inside the WordPress Admin, bail out.
- if ( ! dpa_is_user_active() || is_admin() || is_404() )
+ if ( ! dpa_is_user_active() || is_admin() || is_404() || ! dpa_user_has_notifications() )
return;
// Get current notifications
- $achievements = array();
+ $achievements = array();
$notifications = dpa_get_user_notifications();
// If we're viewing an achievement, clear the notification
View
7 plugins/achievements/readme.md
@@ -0,0 +1,7 @@
+# Achievements for WordPress
+Achievements gamifies your WordPress site with challenges, badges, and points.
+
+* [Download the plugin from WordPress.org](http://wordpress.org/extend/plugins/achievements).
+* For more information, go to [achievementsapp.com](http://achievementsapp.com/).
+
+Have you found a bug, or have a feature request? If you have a Github account, please report issues [here](https://github.com/paulgibbs/achievements/issues). Otherwise, send an email to: paul at byotos.com.
View
94 plugins/achievements/readme.txt
@@ -0,0 +1,94 @@
+=== Achievements for WordPress ===
+Contributors: DJPaul
+Tags: achievements, badges, challenges, gaming, points, rewards
+Requires at least: 3.5.1
+Tested up to: 3.5.1
+Stable tag: 3.1
+License: GPLv3
+License URI: http://www.gnu.org/licenses/gpl-3.0.html
+Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=P3K7Z7NHWZ5CL&lc=GB&item_name=B%2eY%2eO%2eT%2eO%2eS%20%2d%20BuddyPress%20plugins&currency_code=GBP&bn=PP%2dDon
+
+Achievements gamifies your WordPress site with challenges, badges, and points.
+
+== Description ==
+
+Achievements gamifies your WordPress site with challenges, badges, and points. Badges and points are the funnest way to reward and encourage members of your community to participate. Leaderboards and rankings bring friendly competition to your community.
+
+Simply by activating Achievements, any standard WordPress theme is suddenly capable of having achievements and tracking user progress; everything works out of the box. Achievements integrates seamlessly with your existing WordPress theme.
+
+This plugin supports many of your favourite WordPress plugins, including [bbPress](http://wordpress.org/extend/plugins/bbpress/), [BuddyPress](http://wordpress.org/extend/plugins/buddypress/), [BuddyStream](http://wordpress.org/extend/plugins/buddystream/), [coursewa.re](http://wordpress.org/extend/plugins/buddypress-courseware/), [Invite Anyone](http://wordpress.org/extend/plugins/invite-anyone/), and [WP e-Commerce](http://wordpress.org/extend/plugins/wp-e-commerce/). For example, have you ever wanted to give your community members points when they contribute to a discussion, or buy items from your store? Now you can.
+
+For information, support, and developer documentation, visit [achievementsapp.com](http://achievementsapp.com/).
+
+[vimeo http://vimeo.com/56058144]
+
+== Changelog ==