Project

General

Profile

Actions

Bug #15877

closed

Fix 'Follow' button behavior on new Sites directory

Added by Boone Gorges about 2 years ago. Updated almost 2 years ago.

Status:
Resolved
Priority name:
Normal
Assignee:
Category name:
Blogs (BuddyPress)
Target version:
Start date:
2022-04-08
Due date:
% Done:

0%

Estimated time:
Deployment actions:

Description

As part of the Sites directory redesign, I tried mimicking the Follow button as it currently appears on the Commons production site. See https://github.com/cuny-academic-commons/cac/blob/098681fbec154d02e58d0e5e6fb15c44001e5ce2/wp-content/themes/bp-nelo/functions.php#L1499=

But the button doesn't work. It seems like the buddypress-followers JS is broken in a couple ways:
a. It doesn't appear to have a listener for the blogs/sites directory
b. The way it identifies the nonce requires parsing the URL in a particular way - the ampersand has to appear in a certain way. This is a bit wonky.
c. I managed to work around a and b https://github.com/cuny-academic-commons/cac/blob/098681fbec154d02e58d0e5e6fb15c44001e5ce2/wp-content/themes/bp-nelo/assets/js/directory.js#L20= but I got a 400 error - like maybe the AJAX handler wasn't set up properly.

Ray, I didn't want to touch buddypress-followers itself, and I thought you might have a clearer idea what I'm doing wrong. Thanks in advance for your help!


Files

ajax-follow-site.gif (62.2 KB) ajax-follow-site.gif Raymond Hoh, 2022-05-09 09:02 PM
Actions

Also available in: Atom PDF