My first thought is how best to open a selectable list of members. You could use a modal but if the list of members is long (30 or more) then a modal + list might not be the best approach.
Good point, Henry — I’ll have to rethink the layout. In the meantime, I was wondering if you could answer one more question for me:
If a post in the acvitity feed has an @mention, is there any way to pull the username and avatar of the mentioned user?
Thanks!
Do you mean grab the username and avatar of @-mentioned users for a) activity items already posted or b) new activity items going forward?
B) new activity items going forward
The premise of my client’s site is basically Twitter, but for quotes. A user can enter a quote that their friend said, then tag their friend (assuming the friend has an account) and attribute the quote to them.
The quote will then appear in the activity stream, along with the tagged user’s avatar and username.
I figured BuddyPress would be my best bet for this, since it allows users to add friends and @mention other users, but now I’m a bit lost as to how to manage what my client it looking for.
Right, I see! I’m thinking you’ll need to use a regular expression to get the mentioned user’s username from the activity item’s text. Then you can do a user lookup using that username. From there you’ll have everything you need to know about the mentioned user.
That makes sense, thanks! Do you have any idea how I’d find the username from the activity item’s text? Would it be easiest to search for any text preceded by a “@”?
Would it be easiest to search for any text preceded by a “@”?
Yeah that’s a good idea. The regex pattern you’ll need will be something like @[0-9a-Z_-]+
. That will find within the activity item’s text all strings that begin with an @ character which is followed by one or more lowercase or uppercase characters, including numbers and the – and _ characters. Please note I haven’t tested.
I would like to use a custom field to make an activity post sticky.. But where can I find the code that displays the activity feed? So I can alter the query a bit.