Forum Replies Created
-
In reply to: [Resolved] How To Get Notification Count? (Code)?
…how do I get it?
That depends. For example:
If you want the currently logged-in user:
$user_id = bp_loggedin_user_id();If the context is a member’s profile page and you want the displayed member:
$user_id = bp_displayed_user_id();So, depending on the above, what you need may be either:
bp_notifications_get_unread_notification_count( bp_loggedin_user_id() );or
bp_notifications_get_unread_notification_count( bp_displayed_user_id() );Because we’re talking about notifications, it’s likely you’ll want the former because you wouldn’t really need to show somebody else’s notifications count.
In reply to: [Resolved] How To Get Notification Count? (Code)?How are you getting the user’s ID
$user_id?In reply to: Excluding role from (almost) everythingHi @melissa1968
This will be possible to do but will be quite a big project (unless you can find a plugin that does the job for you).
You’d need to go through every BP component, picking out all of the various actions that can be done by members. Then you’d have to write your custom code to exclude the given user from from being able to perform that functionality.
In reply to: [Resolved] How To Get Notification Count? (Code)?There’s 2 types of notifications: a) read and b) unread.
bp_notifications_get_unread_notification_count( $user_id )will get you the unread count so you could use that value in the comparison you mentioned here.I think you’re right in that bp-legacy files are used when a file doesn’t exist in your templates folder. In this case though I’m not sure the same applies as it’s a .js file. Perhaps @danbp will know what happens in this instance?
Update: After a little research, it seems as though the same does apply to .js files. See here which loosely mentions .js files
* As of BP 1.8 the paths for assets i.e styles and JS has been modified to look to your ‘buddypress’ or ‘community’ folders first…
So you’re right to think the JavaScript that expands the what’s new textarea on focus may exist elsewhere. But unless you’ve explicitly created the file in your theme, then bp-templates/bp-legacy/js/buddypress.js should be the only place.
In reply to: Check to see if group is fullGreat stuff 🙂
Hi @ashvin03
Nowhere in your function do you tell BuddyPress to change the user’s role to
subscriber, therefore the problem must be coming from elsewhere. Try disabling all plugins and activating the Twenty Fifteen theme to see if the issues resolves.In reply to: BuddyPress 2.1.1 is not working with WP 4.1Further to what @r-a-y said, I just wanted to make sure you’re logged in? I’m sure you are, but can’t see from the screenshot
In reply to: BuddyPress 2.1.1 is not working with WP 4.1How about Twenty Fifteen. Can you try with that theme enabled?
In reply to: BuddyPress 2.1.1 is not working with WP 4.1Hi @marisams
I have switched back the theme to “Mantra” because the site looks very bad with 2014
Aside from the aesthetics of Twenty Fourteen, does the problem happen when you use that theme? I think earlier on in this thread you mentioned it does still happen.
How about Twenty Fifteen? If so, then we can rule out it being a theme issue.
In reply to: registration validationi am trying to find how (if) BP is doing validation
using BP 2.1.1Hi @ar2015
Leaving validation to chance isn’t something that BuddyPress does, so you can be sure that it will strive to validate everything that’s necessary. For example, the user’s username and email address are validated by
bp_core_validate_user_signup()and the blog URL and title are validated inbp_core_validate_blog_signup()Hope this helps point you in the right direction.
Hi @crehiren
You can do that quite easily. For example, if you wanted to add a new role to the currently logged-in user then you could do this:
// Get a WP_User object for the current user. $user = wp_get_current_user(); // Use the add_role() method to add the editor role to this user. $user->add_role( 'editor' );In reply to: Check to see if group is fullDoes
var_dump( $usermeta );tell you anything? I think it’ll probably be anarrayof stuff like the user’s password, profile field IDs etcIn reply to: Check to see if group is fullMy first thought was to get the member count of the relevant group during each user registration.
That can be done with
groups_get_total_member_count( $group_id );.You’d need to check this figure is less or equal to 150 and if it isn’t, you’d need to add the user to an over-spill group, creating a new one if necessary.
As you mentioned users are added to a group automatically during registration.
The
bp_core_signup_userhook fires at the end of the registration process so could hook all your code for the above to that. That hook gives you access to$user_id,$user_login,$user_password,$user_emailand$usermeta, so you should be able to get all the info you need from those. For example:function my_func( $user_id, $user_login, $user_password, $user_email, $usermeta ) { // Write your code here. } add_action( 'bp_core_signup_user', 'my_func', 10, 5 );Hope this helps.
I tried to delete actiavion_key for them in wp_usermeta, but they still appear as unactivated.
Deleting the activation key alone through the database won’t activate a user. There are more tasks that need to be done in order for a user to become activated. See the
bp_core_activate_signup()function in bp-members-functions.php for details on how BuddyPress does it.In reply to: Send reminder about not answered messageThis will be possible with some custom code but is no trivial task and I doubt there’s anything currently available which will do this for you. Sorry if that’s not what you was hoping to hear 🙁
In reply to: profile picsAs I say it’s working for me. Likely you have a plugin (or two) installed which could be causing the problem. What plugins do you have installed?
In reply to: profile picsYes, Twenty Fifteen the theme. The idea is to check if things work with the default theme. If things work then you’ll know it’s your current theme that has introduced the problem.
I’ve just tested using 2015 and it works for me.
In reply to: profile picsIf you activate Twenty Fifteen and then go to example.com/members/USERNAME/profile/change-avatar/ you should see a button which lets you select a file to upload.
It’s only kept there until the user clicks on the link in the activation email. At that point, the user gets taken to your website, and the activation key is deleted.
In reply to: Pre loading members@djpaul nice proverb!
In reply to: Pre loading membersImporter plugins are always welcome here at BuddyPress! 😀
cc @djpaul
In reply to: Post Update button disable during postingYeah, it’ll go into your template file, after your button. Note, you’ll need to change the selector to that of your button. I’ve used
#buttonbut you may need something like#aw-whats-new-submitIn reply to: Post Update button disable during postingYou could use jQuery?
<script> $( '#button' ).click( function() { $( this ).attr( 'disabled', true ); }); </script>