buddypress / next-template-packs

is this the next BuddyPress template pack?
35 stars 9 forks source link

Re-factor $buttons arg to work fully with updated element selection #95

Closed hnla closed 7 years ago

hnla commented 7 years ago

This ticket / task relates to #79

In the bp_nouveau_get_activity_*_buttons() functions we re-factored the args arrays to enable a series of elements & classes to be passed through, allowing action buttons in templates to display as anchor links or button element.

If we are running as <button> we need to perform a series of further changes to the $button array e.g if is a button then we need to empty the link href to remove from button element, we need to move the link element href containing the necessary action info such as 'wpnonce' to be passed along.

Re-factoring the functions isn't too problematical an example pass made on the bp_nouveau_get_activity_comment_buttons function in includes/activity/template-tags.php

This example adds a new attr for the button display data-do-delete passing it the link href plus it's nonce while emptying the anchor href arg.

This is actioned for both post a comment and delete, posting a comment works ok however delete breaks on the ajax function bp_nouveau_ajax_delete_activity(0 in includes/activity/ajax.php

Currently this is tested to be breaking on empty $_POST['_wpnonce'] || wp_verify_nonce()` despite attempting to adjust the js ajaxData array in js/buddypress-activity.js for the _wpnonce arg to use the data-* attr; not sure where the issue is here!

We need to look at both the js ajaxData array and Nouveau ajax function to get this working.

We'll then need to replicate across all action button functions.

hnla commented 7 years ago

Currently the delete comment is broken in it's 'button' element guise, the original href link is transposed to a data attr but we need to swap the JS to fetch that and not the href attr.

hnla commented 7 years ago

Closing we have covered button args in other tickets/commits.