Skip to content
This repository has been archived by the owner on Jan 22, 2022. It is now read-only.

Commit

Permalink
Plugin updates
Browse files Browse the repository at this point in the history
Achievements
CMS Tree Page View
FeedWordPress
Flexi Pages Widget
Widget Logic
  • Loading branch information
craigcook committed Jan 8, 2013
1 parent 8c72ef8 commit 673feac
Show file tree
Hide file tree
Showing 62 changed files with 4,646 additions and 1,432 deletions.
754 changes: 376 additions & 378 deletions plugins/achievements/dpa.pot

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions plugins/achievements/includes/achievements-classes.php
Expand Up @@ -422,13 +422,13 @@ function get( $args ) {
break; break;


case 'active': case 'active':
$sql = $wpdb->prepare( "SELECT a.{$select_vals} FROM {$bp->achievements->table_achievements} as a {$extras}WHERE is_active = 1" ); $sql = "SELECT a.{$select_vals} FROM {$bp->achievements->table_achievements} as a {$extras}WHERE is_active = 1";
$sql_total_count = $wpdb->prepare( "SELECT COUNT(a.id) FROM {$bp->achievements->table_achievements} as a {$extras}WHERE is_active = 1" ); $sql_total_count ="SELECT COUNT(a.id) FROM {$bp->achievements->table_achievements} as a {$extras}WHERE is_active = 1";
break; break;


case 'inactive': case 'inactive':
$sql = $wpdb->prepare( "SELECT a.{$select_vals} FROM {$bp->achievements->table_achievements} as a {$extras}WHERE is_active = 0" ); $sql = "SELECT a.{$select_vals} FROM {$bp->achievements->table_achievements} as a {$extras}WHERE is_active = 0";
$sql_total_count = $wpdb->prepare( "SELECT COUNT(a.id) FROM {$bp->achievements->table_achievements} as a {$extras}WHERE is_active = 0" ); $sql_total_count = "SELECT COUNT(a.id) FROM {$bp->achievements->table_achievements} as a {$extras}WHERE is_active = 0";
break; break;


case 'single': case 'single':
Expand All @@ -445,8 +445,8 @@ function get( $args ) {
case 'eventcount': case 'eventcount':
case 'newest': case 'newest':
case 'points': case 'points':
$sql = $wpdb->prepare( "SELECT a.{$select_vals} FROM {$bp->achievements->table_achievements} as a {$extras}" ); $sql = "SELECT a.{$select_vals} FROM {$bp->achievements->table_achievements} as a {$extras}";
$sql_total_count = $wpdb->prepare( "SELECT COUNT(a.id) FROM {$bp->achievements->table_achievements} as a {$extras}" ); $sql_total_count = "SELECT COUNT(a.id) FROM {$bp->achievements->table_achievements} as a {$extras}";
break; break;
} }


Expand All @@ -471,7 +471,7 @@ function get( $args ) {
// Only admins see inactive Achievements in the Directory. // Only admins see inactive Achievements in the Directory.
if ( !dpa_permission_can_user_edit() ) { if ( !dpa_permission_can_user_edit() ) {
if ( $search_terms ) { if ( $search_terms ) {
$admin_sql = $wpdb->prepare( " AND is_active=1" ); $admin_sql = " AND is_active=1";
$sql .= $admin_sql; $sql .= $admin_sql;
$sql_total_count .= $admin_sql; $sql_total_count .= $admin_sql;


Expand Down Expand Up @@ -648,9 +648,9 @@ function dpa_get_total_achievements_count() {
$admin_sql = ''; $admin_sql = '';


if ( !dpa_permission_can_user_edit() ) if ( !dpa_permission_can_user_edit() )
$admin_sql = $wpdb->prepare( "WHERE is_active=1" ); $admin_sql = "WHERE is_active=1";


$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->achievements->table_achievements} {$admin_sql}" ) ); $count = $wpdb->get_var( "SELECT COUNT(id) FROM {$bp->achievements->table_achievements} {$admin_sql}" );
wp_cache_set( 'dpa_get_total_achievements_count', $count, 'dpa' ); wp_cache_set( 'dpa_get_total_achievements_count', $count, 'dpa' );
} }


Expand All @@ -670,10 +670,10 @@ function dpa_get_total_achievements_count_for_user( $user_id = false ) {
global $bp, $wpdb; global $bp, $wpdb;


if ( !$user_id ) if ( !$user_id )
$user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id; $user_id = ( ! empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->id : $bp->loggedin_user->id;


if ( !$count = wp_cache_get( 'dpa_get_total_achievements_count_for_user_' . $user_id, 'bp' ) ) { if ( !$count = wp_cache_get( 'dpa_get_total_achievements_count_for_user_' . $user_id, 'bp' ) ) {
$admin_sql = $wpdb->prepare( "AND (is_active = 1 OR is_active = 2)" ); $admin_sql = "AND (is_active = 1 OR is_active = 2)";
$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(a.id) FROM {$bp->achievements->table_achievements} as a, {$bp->achievements->table_unlocked} as u WHERE a.id = u.achievement_id AND u.user_id = %d {$admin_sql}", $user_id ) ); $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(a.id) FROM {$bp->achievements->table_achievements} as a, {$bp->achievements->table_unlocked} as u WHERE a.id = u.achievement_id AND u.user_id = %d {$admin_sql}", $user_id ) );
wp_cache_set( 'dpa_get_total_achievements_count_for_user_' . $user_id, $count, 'bp' ); wp_cache_set( 'dpa_get_total_achievements_count_for_user_' . $user_id, $count, 'bp' );
} }
Expand Down
11 changes: 9 additions & 2 deletions plugins/achievements/includes/achievements-core.php
Expand Up @@ -51,6 +51,7 @@
function dpa_setup_globals() { function dpa_setup_globals() {
global $bp; global $bp;


$bp->achievements = new stdClass;
$bp->achievements->id = 'achievements'; $bp->achievements->id = 'achievements';
$bp->achievements->slug = DPA_SLUG; $bp->achievements->slug = DPA_SLUG;
$bp->achievements->table_achievements = $bp->table_prefix . 'achievements'; $bp->achievements->table_achievements = $bp->table_prefix . 'achievements';
Expand Down Expand Up @@ -258,6 +259,7 @@ function dpa_setup_admin_bar() {


// My Achievements // My Achievements
$wp_admin_nav[] = array( $wp_admin_nav[] = array(
'id' => 'dpa-my-achievements',
'parent' => 'my-account-' . $bp->achievements->id, 'parent' => 'my-account-' . $bp->achievements->id,
'title' => __( 'My Achievements', 'dpa' ), 'title' => __( 'My Achievements', 'dpa' ),
'href' => trailingslashit( $link . DPA_SLUG_MY_ACHIEVEMENTS ) 'href' => trailingslashit( $link . DPA_SLUG_MY_ACHIEVEMENTS )
Expand Down Expand Up @@ -450,7 +452,7 @@ function dpa_get_active_actions() {
global $bp, $wpdb; global $bp, $wpdb;


if ( !$actions = wp_cache_get( 'dpa_active_actions', 'dpa' ) ) { if ( !$actions = wp_cache_get( 'dpa_active_actions', 'dpa' ) ) {
$actions = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT action.name FROM {$bp->achievements->table_achievements} as achievement, {$bp->achievements->table_actions} as action WHERE achievement.action_id = action.id AND achievement.action_id != -1 AND (achievement.is_active = 1 OR achievement.is_active = 2)" ) ); $actions = $wpdb->get_results( "SELECT DISTINCT action.name FROM {$bp->achievements->table_achievements} as achievement, {$bp->achievements->table_actions} as action WHERE achievement.action_id = action.id AND achievement.action_id != -1 AND (achievement.is_active = 1 OR achievement.is_active = 2)" );
wp_cache_set( 'dpa_active_actions', $actions, 'dpa' ); wp_cache_set( 'dpa_active_actions', $actions, 'dpa' );
} }
return apply_filters( 'dpa_get_active_actions', (array)$actions ); return apply_filters( 'dpa_get_active_actions', (array)$actions );
Expand All @@ -468,7 +470,7 @@ function dpa_get_actions() {
global $bp, $wpdb; global $bp, $wpdb;


if ( !$actions = wp_cache_get( 'dpa_actions', 'dpa' ) ) { if ( !$actions = wp_cache_get( 'dpa_actions', 'dpa' ) ) {
$actions = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->achievements->table_actions} ORDER BY category, description" ) ); $actions = $wpdb->get_results( "SELECT * FROM {$bp->achievements->table_actions} ORDER BY category, description" );
wp_cache_set( 'dpa_actions', $actions, 'dpa' ); wp_cache_set( 'dpa_actions', $actions, 'dpa' );
} }
return apply_filters( 'dpa_get_actions', (array)$actions ); return apply_filters( 'dpa_get_actions', (array)$actions );
Expand Down Expand Up @@ -1962,6 +1964,11 @@ function dpa_screen_achievement_create() {


$achievements_errors = $achievement->save(); $achievements_errors = $achievement->save();
if ( !is_wp_error( $achievements_errors ) ) { if ( !is_wp_error( $achievements_errors ) ) {

// Avoid PHP warning
if ( ! isset( $achievements_template ) )
$achievements_template = new stdClass;

$achievements_template->achievement = $achievement; // Required for dpa_record_activity() $achievements_template->achievement = $achievement; // Required for dpa_record_activity()


if ( 1 == $achievement->is_active ) if ( 1 == $achievement->is_active )
Expand Down
4 changes: 2 additions & 2 deletions plugins/achievements/includes/achievements-templatetags.php
Expand Up @@ -1103,7 +1103,7 @@ function dpa_addedit_action_groups() {
function dpa_get_addedit_action_groups() { function dpa_get_addedit_action_groups() {
global $bp, $wpdb; global $bp, $wpdb;


$groups = $wpdb->get_results( $wpdb->prepare( "SELECT id, name FROM {$bp->groups->table_name} ORDER BY name ASC" ) ); $groups = $wpdb->get_results( "SELECT id, name FROM {$bp->groups->table_name} ORDER BY name ASC" );
$current_group_id = $bp->achievements->current_achievement->group_id; $current_group_id = $bp->achievements->current_achievement->group_id;
$selected = ( $current_group_id < 1 ) ? 'selected="selected"' : ''; $selected = ( $current_group_id < 1 ) ? 'selected="selected"' : '';
$options = array( sprintf( '<option value="%1$d"%2$s>%3$s</option>', apply_filters( 'dpa_get_achievement_group_id', -1 ), $selected, __( '(All groups)', 'dpa' ) ) ); $options = array( sprintf( '<option value="%1$d"%2$s>%3$s</option>', apply_filters( 'dpa_get_achievement_group_id', -1 ), $selected, __( '(All groups)', 'dpa' ) ) );
Expand Down Expand Up @@ -1144,7 +1144,7 @@ function dpa_get_grant_achievement_userlist() {
else else
$column = "user_status"; $column = "user_status";


$members = $wpdb->get_results( $wpdb->prepare( "SELECT ID, display_name FROM {$wpdb->users} WHERE {$column} = 0 ORDER BY display_name ASC" ) ); $members = $wpdb->get_results( "SELECT ID, display_name FROM {$wpdb->users} WHERE {$column} = 0 ORDER BY display_name ASC" );
foreach ( $members as $member ) foreach ( $members as $member )
$options[] = sprintf( '<li><input type="checkbox" name="members[]" id="m-%1$d" value="%2$d" />%3$s', apply_filters( 'bp_get_member_user_id', $member->ID ), apply_filters( 'bp_get_member_user_id', $member->ID ), apply_filters( 'bp_get_member_user_nicename', $member->display_name ) ); $options[] = sprintf( '<li><input type="checkbox" name="members[]" id="m-%1$d" value="%2$d" />%3$s', apply_filters( 'bp_get_member_user_id', $member->ID ), apply_filters( 'bp_get_member_user_id', $member->ID ), apply_filters( 'bp_get_member_user_nicename', $member->display_name ) );


Expand Down
22 changes: 11 additions & 11 deletions plugins/achievements/loader.php
Expand Up @@ -13,9 +13,9 @@
Plugin Name: Achievements Plugin Name: Achievements
Plugin URI: http://achievementsapp.com/ Plugin URI: http://achievementsapp.com/
Description: Achievements gives your BuddyPress community fresh impetus by promoting and rewarding social interaction with challenges, badges and points. Description: Achievements gives your BuddyPress community fresh impetus by promoting and rewarding social interaction with challenges, badges and points.
Version: 2.3 Version: 2.4
Requires at least: WP 3.0.1, BuddyPress 1.5 Requires at least: WP 3.0.1, BuddyPress 1.5
Tested up to: WP 3.3.1, BuddyPress 1.6 Tested up to: WP 3.5.999, BuddyPress 1.6.3
License: General Public License version 3 License: General Public License version 3
Author: Paul Gibbs Author: Paul Gibbs
Author URI: http://byotos.com/ Author URI: http://byotos.com/
Expand All @@ -24,7 +24,7 @@
Text Domain: dpa Text Domain: dpa
"Achievements for BuddyPress" "Achievements for BuddyPress"
Copyright (C) 2009-12 Paul Gibbs Copyright (C) 2009-13 Paul Gibbs
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as published by it under the terms of the GNU General Public License version 3 as published by
Expand Down Expand Up @@ -166,7 +166,7 @@ function dpa_install_and_upgrade() {
break; break;


case 1: case 1:
$wpdb->query( $wpdb->prepare( "ALTER TABLE {$table_prefix}achievements ADD COLUMN site_id bigint(20) NOT NULL" ) ); $wpdb->query( "ALTER TABLE {$table_prefix}achievements ADD COLUMN site_id bigint(20) NOT NULL" );
$wpdb->update( "{$table_prefix}achievements", array( 'site_id' => BP_ROOT_BLOG ), null, '%d' ); $wpdb->update( "{$table_prefix}achievements", array( 'site_id' => BP_ROOT_BLOG ), null, '%d' );
break; break;


Expand Down Expand Up @@ -206,15 +206,15 @@ function dpa_install_and_upgrade() {
break; break;


case 4: case 4:
$wpdb->query( $wpdb->prepare( "CREATE INDEX name ON {$table_prefix}achievements (name(20))" ) ); $wpdb->query( "CREATE INDEX name ON {$table_prefix}achievements (name(20))" );
$wpdb->query( $wpdb->prepare( "CREATE INDEX action_id ON {$table_prefix}achievements (action_id)" ) ); $wpdb->query( "CREATE INDEX action_id ON {$table_prefix}achievements (action_id)" );
$wpdb->query( $wpdb->prepare( "CREATE INDEX description ON {$table_prefix}achievements (description(20))" ) ); $wpdb->query( "CREATE INDEX description ON {$table_prefix}achievements (description(20))" );
break; break;


case 5: case 5:
$wpdb->query( $wpdb->prepare( "ALTER TABLE {$table_prefix}achievements ADD COLUMN group_id bigint(20) NOT NULL" ) ); $wpdb->query( "ALTER TABLE {$table_prefix}achievements ADD COLUMN group_id bigint(20) NOT NULL" );
$wpdb->update( "{$table_prefix}achievements", array( 'group_id' => -1 ), null, '%d' ); $wpdb->update( "{$table_prefix}achievements", array( 'group_id' => -1 ), null, '%d' );
$wpdb->query( $wpdb->prepare( "CREATE INDEX group_id ON {$table_prefix}achievements (group_id)" ) ); $wpdb->query( "CREATE INDEX group_id ON {$table_prefix}achievements (group_id)" );
break; break;


case 6: case 6:
Expand Down Expand Up @@ -242,7 +242,7 @@ function dpa_install_and_upgrade() {
break; break;


case 9: case 9:
$wpdb->query( $wpdb->prepare( "ALTER TABLE {$table_prefix}achievements_actions ADD COLUMN is_group_action int(1) NOT NULL" ) ); $wpdb->query( "ALTER TABLE {$table_prefix}achievements_actions ADD COLUMN is_group_action int(1) NOT NULL" );
$wpdb->update( "{$table_prefix}achievements_actions", array( 'is_group_action' => 0 ), null, '%d' ); $wpdb->update( "{$table_prefix}achievements_actions", array( 'is_group_action' => 0 ), null, '%d' );
$wpdb->update( "{$table_prefix}achievements_actions", array( 'is_group_action' => 1 ), array( 'category' => 'groups' ), '%d' ); $wpdb->update( "{$table_prefix}achievements_actions", array( 'is_group_action' => 1 ), array( 'category' => 'groups' ), '%d' );
break; break;
Expand Down Expand Up @@ -306,7 +306,7 @@ function dpa_install_and_upgrade() {
break; break;


case 19: case 19:
$wpdb->query( $wpdb->prepare( "CREATE INDEX is_active ON {$table_prefix}achievements (is_active)" ) ); $wpdb->query( "CREATE INDEX is_active ON {$table_prefix}achievements (is_active)" );
break; break;


case 20: case 20:
Expand Down
14 changes: 9 additions & 5 deletions plugins/achievements/readme.txt
Expand Up @@ -4,8 +4,8 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=P3K7Z
Tags: buddypress,achievement,cubepoints,reward,points,score,rank,social,gaming,tokens,status,badge,WoW,Warcraft,games,challenges Tags: buddypress,achievement,cubepoints,reward,points,score,rank,social,gaming,tokens,status,badge,WoW,Warcraft,games,challenges
License: General Public License version 3 License: General Public License version 3
Requires at least: WP 3.0.1, BuddyPress 1.5 Requires at least: WP 3.0.1, BuddyPress 1.5
Tested up to: WP 3.3.1, BuddyPress 1.6 Tested up to: WP 3.5.999, BuddyPress 1.6.3
Stable tag: 2.3 Stable tag: 2.4


Achievements gives your BuddyPress community fresh impetus by promoting and rewarding social interaction with challenges, badges and points. Achievements gives your BuddyPress community fresh impetus by promoting and rewarding social interaction with challenges, badges and points.


Expand All @@ -25,6 +25,10 @@ For information, support, premium enhancements and developer documentation, visi
1. To get started, visit your site, and select the "Achievements" in the main navigation. 1. To get started, visit your site, and select the "Achievements" in the main navigation.


== Changelog == == Changelog ==
= 2.4 =
* Compatibility fixes for WordPress 3.5. Props to Norm Huelsman for the initial patch.
* Fix PHP warnings.

= 2.3 = = 2.3 =
* Improves compatibility with some themes. * Improves compatibility with some themes.


Expand Down Expand Up @@ -88,15 +92,15 @@ For information, support, premium enhancements and developer documentation, visi
* The historical release history has been moved to a better place. * The historical release history has been moved to a better place.


== Upgrade Notice == == Upgrade Notice ==
= 2.3 = = 2.4 =
* Improves compatibility with some themes. * Improves compatibility with WordPress 3.5.


== Frequently Asked Questions == == Frequently Asked Questions ==
For information, support, and developer documentation, visit http://achievementsapp.com/. For information, support, and developer documentation, visit http://achievementsapp.com/.


== License == == License ==
"Achievements for BuddyPress" "Achievements for BuddyPress"
Copyright (C) 2009-12 Paul Gibbs Copyright (C) 2009-13 Paul Gibbs


This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as published by it under the terms of the GNU General Public License version 2 as published by
Expand Down

0 comments on commit 673feac

Please sign in to comment.