Anyone who can help please? Thank you!
Are that tricky to sort out these notifications? I’m not sure what to suggest without running code and playing around with it which I’m not sure I have time for at the moment, but try and get your working code up in a copyable form on pastebin/github so we can, if necessary, download and play around with.
@hnla Here is the link to it on github:
https://github.com/bphelp/custom_toolbar
Thanks in advanced for any help or time you may be able to spare.
If anyone else out there can offer advice in how to do this it will be appreciated! Thanks everyone! 🙂
I really could use some help on this so if you can please help! Thanks folks!
now having to write this a second time as bp decided I wasn’t logged in for some odd reason after I submitted so this is brief.
Watch your syntax, don’t wrap those functions in strings, ‘;’ line terminations in an array ought not to be there. You don’t need or want to echo out those functions at this point simply pass the function through so simply the ‘get’ function.
This is a working example of two:
<code>
$wp_toolbar->add_node(array(
‘parent’ => ‘user-friends’,
‘id’ => ‘friend-requests’,
‘title’ => ‘ Friend Requests ‘,
‘href’Â => bp_loggedin_user_domain() . bp_get_friends_slug() . ‘/requests/’,
‘meta’ => array(‘html’ => ‘<span>’ . bp_friend_get_total_requests_count( bp_loggedin_user_id() ) . ‘</span>’ )
));
</code>
<code>
$wp_toolbar->add_node(array(
‘parent’ => ‘user-messages’,
‘id’ => ‘messages’,
‘title’ => ‘ Messages ‘,
‘href’ => bp_loggedin_user_domain() . bp_get_messages_slug() . ‘/view/’,
‘meta’ => array(‘html’ => ‘<span>’ . bp_get_total_unread_messages_count(bp_loggedin_user_id() . ‘</span>’ ) )
));
</code>
This isn’t ideal but all I can see to work with in add_node() but there may be better approaches, and to get this working I mainly had to study the code page to see how the ‘meta’ was handled.
@hnla Okay I added this and it places the count under the title. Now all I need to do is:
1.) Add name of person sending friend request and messages beside the count as well as the greeting.
Example: You have 1 friend request from USER1, You have 2 messages from USER2
2.) Add avatar of person sending the friend request or message to to left in the drop-down notification.
If you or anyone else can help on that it will be great.
For anyone who would like to use this I packaged it as a plugin here:
https://github.com/bphelp/custom_toolbar
If you would like to help with the code I can add you as a contributor. Thanks everyone!
Just seeing if anyone has anything to add to this plugin which is free of charge. I really would appreciate some experienced buddypress developers helping out. And no I do not have money to hire a developer. Due to NAFTA I have not been able to find work in 2.6 years so if money is your agenda, I don’t have it but contribute if you can because it will be appreciated. Thanks everyone!
@bphelp all the further requirements you want to add can be found in the various core files, I know no better than you at this stage and would have to be reading through those files to identify what functions, variables etc I had to work with to achieve what I wanted, I did something similar to this a while back for custom WP pages dragging user data out, the only way I managed that was by studying the core files.
Without wanting to sound harsh 🙂 it’s down to you to finish now, the bits like avatars shouldn’t be too hard to figure now you’ve got this far.
When it’s finished get it placed on the WP plugin repo.
@hnla Thanks for the advice and encouragement! I will do my best and when it is ready I will release it to the repository for others to use. Thanks for everything, I really appreciate it!
@bphelp were you able to figure out the dropdown? I am making the same thing and have added the count, however I need help how to show a details dropdown to each