#2446 closed enhancement (worksforme)
Limited control over AJAXed Favorite/Subscription buttons
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | low | |
Severity: | minor | Version: | trunk |
Component: | API - Favorites | Keywords: | |
Cc: |
Description
Theme designers have a lot of control over the styling and presentation of Subscription and Favorite buttons through the passing of an $args array to the bbp_user_subscribe_link() and bbp_user_favorites_link() functions. This is GREAT, and allows fine tuning of the presentation of these buttons.
Unfortunately, this flexibility does not extend to the versions of these buttons retrieved by AJAX in the BBP_Default->ajax_favorite() and BBP_Default->ajax_subscription() methods.
This creates a somewhat awkward situation when your lovingly styled and/or renamed Subscribe or Favorite buttons are replaced with the default versions by AJAX.
I think there are two good (and easy) solutions here that would make life better:
1) Apply a filter to the default arguments used in the bbp_get_user_favorites_link() and bbp_get_user_subscribe_link() functions. The advantage of this approach is that we could add one single filter that would apply identical styling to both the buttons in our templates and those retrieved by AJAX.
2) Apply a filter in the ajax methods to the $attrs which are passed when a button is retrieved by ajax. This would be a more specific approach, but also fine since we can already pass args to the templated buttons. Really the need here is to enable AJAX to retrieve buttons which are consistent with those used throughout our theme.
I hope the addition of such a filter can make it for 2.5, thanks!
bbp_parse_args
uses the$context
string passed into it to apply passive and aggressive filters to passed attributes. This should allow you the flexibility you need to filter those attributes for all cases.For Favorites:
bbp_before_get_user_favorites_link_parse_args
bbp_after_get_user_favorites_link_parse_args
For Subscriptions:
bbp_before_get_user_subscribe_link_parse_args
bbp_after_get_user_subscribe_link_parse_args