opencredit / badgeos

BadgeOS is a plugin to WordPress that allows you to easily create badges and set up the steps and achievements users take to earn them. Badges are Mozilla OBI compatible and sharable via Credly.
http://www.badgeos.org
GNU Affero General Public License v3.0
92 stars 64 forks source link

Add 2 arguments in "badgeos_submission_form_language" filter #717

Closed ckaklamanos closed 2 years ago

ckaklamanos commented 4 years ago

Add 2 arguments in "badgeos_submission_form_language" filter: "$achievement_id" and "$user_ID"

ckaklamanos commented 2 years ago

Hello.

This is an issue that is not resolved yet.

Although you have added the 2 arguments in the filter, they are being added after the filter declaration. Therefore, it is impossible to override them with the filter.

Please look at

badgeos-nomination-submission-add-on/includes/submission-actions.php, Line 1771.

// Available filter for changing the language
$defaults = apply_filters( 'badgeos_submission_form_language', $defaults );

// Patch in our achievement and user IDs
$defaults['achievement_id'] = isset( $args["achievement_id"] ) ? absint( $args["achievement_id"] ) : "";
$defaults['user_id']        = $user_ID;

The line

$defaults = apply_filters( 'badgeos_submission_form_language', $defaults );

Should go after the "achivement_id" and "user_id" declaration, so that a developer will be able to override them.

This is a hack I always do when I update your plugin, otherwise, my customizations will not work.

Thanks for re-considering it.

PS: Is there s Github repo for this plugin, so that I can provide a Pull Request? Thanks.