Open ckaklamanos opened 4 years ago
Here is the Pull Request for the above enhancement.
Hi @ckaklamanos
We will surely update the mentioned filter in our next update.
Hello @the-wooninjas
Thanks for letting me know.
Hello.
I have seen that you added the above arguments in the recent plugin updates.
However, it seems that they have been added to the wrong position and still, those arguments cannot be "caught" by the filter.
Here is what I mean:
In the new plugin called "badgeos-nomination-submission-add-on" (https://wordpress.org/plugins/badgeos-nomination-submission-add-on/), in the following position:
File: badgeos-nomination-submission-add-on/includes/submission-actions.php Line: 1750
You have added the following code:
// Patch in our achievement and user IDs
$defaults['achievement_id'] = isset( $args["achievement_id"] ) ? absint( $args["achievement_id"] ) : "";
$defaults['user_id'] = $user_ID;
The problem is that the above code comes after the "badgeos_submission_form_language" filter, therefore it is useless.
In order for the above code to be functional, it should be moved before the Line 1747, in other words before:
// Available filter for changing the language
$defaults = apply_filters( 'badgeos_submission_form_language', $defaults );
In this way, we will be able to make use of the new filter arguments.
Please let me know if the above is clear.
Is there a Github repository for this new plugin in order to create a Pull Request?
Thanks in advance.
In our implementation of BadgeOS, we need to customize the language strings of submission forms, depending on the achievement context.
For example, if our submission is about submitting a "project", we want the submission button value to be "Send project". Or, another example, if our submission is about submitting a specific "thing", we want the submission button value to be "Send your thing".
In order to achieve the above, I propose a simple enhancement that adds the passes $achievement_id and $user_id as arguments to the corresponding filter.
This filter is located here:
https://github.com/opencredit/badgeos/blob/0e5b22da119272e4330f70f3c8b7038fd2ac7138/includes/submission-actions.php#L1483
I propose replacing:
$defaults = apply_filters( 'badgeos_submission_form_language', $defaults );
With:$defaults = apply_filters( 'badgeos_submission_form_language', $defaults , $achievement_id , $user_id );
I will create a pull request very soon.