Forum Replies Created
-
In reply to: BuddyPress: “ass_digest_items” in usermeta table
Ah right. So it’s this plugin you’re using:
https://wordpress.org/plugins/buddypress-group-email-subscription/It’s very easy to update user meta in WordPress. See:
https://codex.wordpress.org/Function_Reference/update_user_metaBut the plugin uses the BP version of this function AND I see that there are conditions in place which govern when this particular meta value is updated.
Have you tried asking on the plugin’s support forum? That might be the best place to start as you’ll have people there far more familiar with the plugin’s code.
https://wordpress.org/support/plugin/buddypress-group-email-subscription
In reply to: BuddyPress: “ass_digest_items” in usermeta tableass_digest_itemsisn’t a meta key BuddyPress uses (to my knowledge). Are you sure it doesn’t come from a plugin?In reply to: Notification ManagementI’m using a mark all as read button but it’s customised for my site markup so might not play well elsewhere. What part are you stuck with?
In reply to: How to add a few more members-directory pages?@landwire I see! That explains it.
Is that something that can be taken to core developers and asked if we can enhance the filter functionality
You could always ask? Trac is the best place to do that: https://buddypress.trac.wordpress.org/
In reply to: How to add a few more members-directory pages?Ah right. I see now. So you’ll need a separate page for each role.
Try this
function my_filter( $query = false, $object = false ) { if ( is_page( 'office' ) ) { $users = get_users( 'role=office' ); $exclude = implode( ',', $users ); if ( $object != 'members' ) return $query; $args = wp_parse_args( $query ); if ( ! empty( $args['user_id'] ) ) return $query; if ( !empty( $args['exclude'] ) ) $args['exclude'] = $args['exclude'] . ',' . $exclude; else $args['exclude'] = $exclude; $query = build_query( $args ); } return $query; } add_filter( 'bp_ajax_querystring', 'my_filter', 20, 2 );If
is_page()doesn’t work then that’ll be a problem.If it does work then you can do the same for the rest of the roles you need.
In reply to: How to add a few more members-directory pages?Regarding the 4 user roles you need to filter
office, supplier, student, professional
There is a nifty little function called
array_mergewhich you can use. You’d get your comma-sep list of users to exclude from the loop like this…$office = get_users( 'role=Office' ); $supplier = get_users( 'role=Supplier' ); $student = get_users( 'role=Student' ); $professional = get_users( 'role=Professional' ); $users = array_merge( $office, $supplier, $student, $professional ); $exclude = implode( ',', $users );In reply to: How to add a few more members-directory pages?If you have links like this
example.com/members/usernamethen root profiles are disabled. If you have thisexample.com/usernamethen root profiles are enabled.Try this:
function my_filter( $query = false, $object = false ) { if ( ! is_page( 'office' ) ) return $query; $users = get_users( 'role=YOUR-ROLE-TO-EXCLUDE' ); $exclude = implode( ',', $users ); if ( $object != 'members' ) return $query; $args = wp_parse_args( $query ); if ( ! empty( $args['user_id'] ) ) return $query; if ( !empty( $args['exclude'] ) ) $args['exclude'] = $args['exclude'] . ',' . $exclude; else $args['exclude'] = $exclude; $query = build_query( $args ); return $query; } add_filter( 'bp_ajax_querystring', 'my_filter', 20, 2 );Note: Change
YOUR-ROLE-TO-EXCLUDEto the role you want to exclude. i.e. AuthorAdapted from here:
Exclude Users from Members directory on a BuddyPress based social network
In reply to: How to add a few more members-directory pages?This is a slight issue with that.
is_pagedoesn’t work in BP 1.9.2 if root profiles are enabled. If you have root profiles disabled (the default) then you’re fine.In reply to: How to add a few more members-directory pages?I think you could most probably exclude members of a certain role when on the office page. You’d use the
bp_ajax_querystringfilter. For example:function my_filter( $query = false, $object = false ) { if ( is_page( 'office' ) ) { // do some excluding } return $query; } add_filter( 'bp_ajax_querystring', 'my_filter', 20, 2 );I haven’t tested that idea but think it is the right approach to take.
In reply to: How to add a few more members-directory pages?I think a shortcode is good way of doing it actually. You don’t need to create any new files that way.
Glad to see you got it working how you wanted it!
In reply to: How to add a few more members-directory pages?I think some of the visual differences could be due to CSS. Fundamentally each of these are different. Take the offices-index template for example. If you view the source you’ll see the body classes:
page page-id-1100 page-template-default masthead-fixed full-width singular no-jsWhere as if you view the source of the members directory you should see body classes
directory members buddypress masthead-fixed full-width singular no-jsIf the theme you’re using makes use of the body class when styling
body.page { // styles ... }then that could be why it looks different?In reply to: How to add a few more members-directory pages?You’ll need to add your BuddyPress header and footer to the page-office-loop.php file. For example:
<?php get_header( 'buddypress' ); ?> <!-- bits and bobs here --> <?php get_footer( 'buddypress' ); ?>In reply to: How to add a few more members-directory pages?You could set up a new page via the WP dashboard, and make sure the slug is ‘offices-loop’. Then you’d just need to add a new file
page-offices-loop.phpto your theme’s directory. All your code can then go in that new file.The page would be accessible via the front-end using: example.com/offices-loop
In reply to: Activation email not been receivedhowever one did come through after about 24 hrs ( not good )
Could well be a problem with your host. I’d contact them to see if their mail server is working as it should be.
In reply to: 3rd Sized AvatarSo, with the code I suggested in place. You can output the 3 sized avatars on your site like this:
Thumb size:
$type = 'thumb'; $width = 200; $height = 200; $user_fullname = bp_get_loggedin_user_fullname(); $user_id = bp_loggedin_user_id(); echo bp_core_fetch_avatar( array( 'alt' => $user_fullname, 'class' => 'avatar', 'width' => $width, 'height' => $height, 'item_id' => $user_id, 'type' => $type, 'title' => $user_fullname ) );Full size:
$type = 'full'; $width = 500; $height = 500; $user_fullname = bp_get_loggedin_user_fullname(); $user_id = bp_loggedin_user_id(); echo bp_core_fetch_avatar( array( 'alt' => $user_fullname, 'class' => 'avatar', 'width' => $width, 'height' => $height, 'item_id' => $user_id, 'type' => $type, 'title' => $user_fullname ) );Tiny thumb size:
$width = 20; $height = 20; $user_fullname = bp_get_loggedin_user_fullname(); $user_id = bp_loggedin_user_id(); echo bp_core_fetch_avatar( array( 'alt' => $user_fullname, 'class' => 'avatar', 'width' => $width, 'height' => $height, 'item_id' => $user_id, 'title' => $user_fullname ) );Note: It isn’t recommended to change core files in this way because you’ll lose the changes you made on each upgrade. But it’s what you asked for so… 🙂
In reply to: 3rd Sized AvatarYou’d change
$avatar_size = ( ‘full’ == $type ) ? ‘-bpfull’ : ‘-bpthumb;to:if ($type == 'full' ) { $avatar_size = '-bpfull'; } elseif ($type == 'thumb' ) { $avatar_size = '-bpthumb'; } else { $avatar_size = '-bptinythumb'; }But that approach wouldn’t be recommended because when you upgrade buddypress your changes will be lost.
The tiny thumb will be the default avatar size. If you wanted to use the thumb or full versions then you’d need to pass
thumborfullto bp_core_fetch_avatarIn reply to: 3rd Sized AvatarI was thinking this?
1st: The thumb size
2nd: The full size
3rd: The original sizeIn reply to: 3rd Sized AvatarHi @darqpony
1. Thumbs
define ( 'BP_AVATAR_THUMB_WIDTH', 20 ); define ( 'BP_AVATAR_THUMB_HEIGHT', 20 );2. Full
define ( 'BP_AVATAR_FULL_WIDTH', 150 ); define ( 'BP_AVATAR_FULL_HEIGHT', 150 );3. Original
define ( 'BP_AVATAR_ORIGINAL_MAX_WIDTH', 300 );4. File size
define ( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE', $max_in_kb );Now, you can use
bp_core_fetch_avatarto output either the thumb or the full size avatar. This doesn’t cover the original. You could write your own version ofbp_core_fetch_avatarwhich will output the original as well. That’s if the original is saved. You’ll have to check that it is. I’m sure it will be but have never needed to use it so you might want to make sure.Definitely what @shanebp said! 🙂
Hi @mib314
It is likely that your theme is using
bp_modify_page_titlewith just one argument. Try searching your theme forbp_modify_page_title. If you find it, and it is passing just one argument then you have identified the problem. Then, it’s probably worth letting the theme author know.You’ll notice a comma is used to separate arguments.
Valid:
bp_modify_page_title( $argument1, $argument2 )Problematic:
bp_modify_page_title( $argument1 )In reply to: Is profile fields treated as posts ?No, they’re not treated as posts. They are called xProfile fields and form part of the xProfile component. They’re saved in their own table which I do believe is called wp_bp_xprofile_fields
In reply to: BuddyPress 2014 Survey@mercime the visuals on the GitHub version are V impressive! Thanks again 🙂
In reply to: Housekeeping after delete-acountHi @ndh01
In my case, I would like to auto reassign to a different ID when a user deletes their account.
I think that functionality only happens when the member is deleted by the administrator in the WP dashboard. Posts aren’t reassigned if the member deletes their own account via the front end.
In reply to: Performance issue.Am using Twitter Bootstrap already
Have you customised it? See http://getbootstrap.com/customize/
The Customiser is great because you can get rid of the JavaScript and CSS you don’t need. I find I always need stuff like the CSS ‘the grid system’ but never use stuff like tooltips and popovers.
In reply to: Performance issue.Version 2.0 which is due for release in about 2 months time will have quite a few improvements in place related to performance. Caching is one of the main focus areas and reducing the number of queries is another.
In the mean time, you could disable and remove some of the plugins you don’t use (I noticed you have 46). You could make sure JavaScript files load in the footer, implement lazy loading of images on long pages, optimse and compress images, ask your host if any server improvements can be made, choose your theme carefully and customise your Twitter Bootstrap install so you’re only loading the features you need…