Forum Replies Created
-
In reply to: avatar folder to one folder
@wassimo – it would require a major rewrite of many files.
Much easier solution would be to find decent hosting.Currently, favs are stored as serialized array in wp_usermeta.
The OP is just asking for a total count.
Pretty easy to hook in and ++ / — a count within wp_bp_activity_meta table.But a custom table would be better, imo,
You could use it for a total count scan.
And you could get specific about favs based all members – not just favs specific to a member as per the serialized array.AND – get it out of wp_usermeta table – hurrah.!
The use of that table is becoming a real scalability issue.
Things like last_activity in user_meta is slooooow.
I think boone wants to move last_activity for BP 1.7 and use an existing activity table.So maybe a redo of favorites is a natural task for 1.7 ?
edit – just saw the Paul comment that says:
“During development of BuddyPress 1.7, I’ll be revisiting the Like in BP Labs.”Cool.
Maybe I’m missing something… ?
But couldn’t you use wp_bp_activity_meta table and meta_key = favorite_count
Then in the activity loop – bp_activity_get_meta( $activity_id, ‘favorite_count’ )So you need the hooks Boone mentions, but no custom table – unless you want to get specific about who liked what.
What do you mean by ‘users images’ ? Avatars? Photos? Both?
Avatars don’t have a database entry. They live here:
/wp-content/uploads/avatars/[member_id]/[avatar file]
But there needs to be a thumb and a full-size, and you’ll need to change the file names.
And they may need to be jpg.
For example:
4f5664228829d-bpthumb.jpg
4f5664228829dauto-bpfull.jpgPhotos will require a plugin – and database entries.
How you accomplish that will depend on which plugin you use.In reply to: Setting Users as subscribers automatically?Hugo – I’ve seen other posts that were even more forceful on that topic, but I’ve made an edit, ok ?
{ I could get very specific and spare you the need for actual experience – lol }In reply to: Setting Users as subscribers automatically?In our experience – buddyvents is buggy and very resource intensive.
After much frustration, we switched toHere is the fix:
https://buddypress.trac.wordpress.org/changeset/6023You’ll have to manually edit the files – should be easy as you don’t have to remove anything.
Just find the location in the files and add the ‘green’ areas.In reply to: adding menu tabstop_level nav
https://codex.buddypress.org/developer-docs/functions/core/bp_core_new_nav_item/subnav example, add to your plugins/bp-custom.php
https://codex.buddypress.org/extending-buddypress/bp-custom-php///generate the 'Bongo' subnav tab to Messages add_action( 'bp_setup_nav', 'add_subnav_tab', 100 ); function add_subnav_tab() { global $bp; bp_core_new_subnav_item( array( 'name' => __( 'Bongo', 'buddypress' ), 'slug' => 'bongo', 'parent_url' => $bp->loggedin_user->domain . $bp->messages->slug . '/', 'parent_slug' => $bp->messages->slug, 'screen_function' => 'messages_screen_bongo', 'position' => 40, 'user_has_access' => bp_is_my_profile() ) ); }In reply to: Chat Plugin RecommendationsIn reply to: Execute bp_activity_add_user_favorite functionI think you’re confused about what do_action actually does.
It provides a hook that you can access with add_action.Why not call just call bp_activity_add_user_favorite directly in the php function called by ajax ?
something like:
`
$add_fav = bp_activity_add_user_favorite( $activity_id, $user_id );
if( $add_fav ) echo “1”; //true – it worked
else echo “0”; //false – it failed
`Then handle the response how ever you want back in your ajax function
In reply to: Search Member / Profile fields by URL?I’d approach this a different way –
something like:
`
$match_ids = $wpdb->get_var( “SELECT user_id FROM wp_bp_xprofile_data WHERE field_id = [whatever the field_id is for State] AND value = [whatever value you want to find] “);
`$match_ids will be a simple array.
So loop thru the array and create a comma separated string out of the ids.
Then pass the string to bp_has_members() using ‘include’something like
`
//$get_these_members is the id string you created
$get_these_members = ‘include=’ . substr($get_these_members, 0, -1); //trim the last commaif ( bp_has_members( $get_these_members ) )
`That way you could search for any value on any profile field.
Your approach might work, but… yikes.https://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-members-loop/
In reply to: How to email all usersIn reply to: [Resolved] Who’s Online Settingtest
I don’t think you can set the online interval just for that widget.
You can adjust the online interval for ‘everything’ by hacking a core file – not recommended.
But it’s a small hack – so as long as you remember it (lol) when you update BPIn plugins/buddypress/bp-core/bp-core-classes, ~Line 245
`
if ( ‘online’ == $type )
$sql = “AND DATE_ADD( um.meta_value, INTERVAL 5 MINUTE ) >= UTC_TIMESTAMP()”;
`change the interval to whatever you want.
In reply to: How to check if member has avatar ?So it will always be true due to the default avatar.
There might be an existing BP method to ignore both grav and default, but I don’t know what it is.
So you could string-check, something like this:
`
function user_has_avatar() {
global $bp;$avatar = bp_core_fetch_avatar( array( ‘item_id’ => $bp->loggedin_user->id, ‘no_grav’ => true, ‘html’=>false) );
$pos = strpos($avatar, ‘mystery-man’);
if ($pos === false) return true;return false;
}
`In reply to: How to check if member has avatar ?How are you trying to check this?
Post your code and tell us what page / slug you’re trying to do this on.
If there is no displayed user and you don’t pass a user_id, it will return false.
In reply to: BP 1.5 add subnav item to Admin Optionsbump
In reply to: link to avatar by idWhy would you want to link to an avatar?
If you mean show their avatar as a link to their profile…
Then if you know what that person’s user_id is… say as $that_member_id`
$avatar=bp_core_fetch_avatar(array(“item_id”=>$that_member_id,”type”=>”thumb”,”height”=>32,”width”=>32));
$avatar_link = “” . $avatar . ““;
echo $avatar_link;
`In reply to: [Resolved] A Simple Link To The Users Profile Pagetry changing
$items = $items . $profilelink;to
$items = $profilelink . $items;In reply to: How to limit the characters of the profile bio.You mean the description field ?
That’s tougher. How good are you at php ?
afaik – you need to modify the
/themes/your-theme/members/single/profile/edit.phpYou won’t see a form field for ‘description’
BP uses bp_get_the_profile_field_type() to show fields.
So you need to do an ‘if’ on the bp_the_profile_field_input_name()
And then use javascript to limit the number of chars allowed – lots of examples of this online.In reply to: How to limit the characters of the profile bio.The php function is substr()
There are many ways to use it.
Here’s some:
http://stackoverflow.com/questions/79960/how-to-truncate-a-string-in-php-to-the-word-closest-to-a-certain-number-of-charaIn reply to: Uploaded Avatar QualityCongrats on fixing the issue – although what you did makes no sense to me.
It would seem that your users can now upload 25 MB avatars.Post your bp-custom code re full-size and crop tool.
Did you ever try a png ?
That would let you know if it’s a compression issue or something else.My complete guess is that the images are being downsized prior to cropping and then expanded to your dims which is causing pixelation.
In reply to: Uploaded Avatar QualityAvatars are usually square.
The cropping tool only does squares – at least on all my installs.Try defining a square size and check the quality.
Try a png to check quality.
If you want rectangular avatars, you’ll probably need to make changes to core files.
In reply to: Timestamp help pleaseSeriously ?
Did you try adding the global call ?In reply to: SNIPPET: Intelligent post page templatesInteresting… haven’t tried it yet.
So, if get_template_part can’t find a different template for a particular activity type (because a different template doesn’t exist) it will revert to calling entry.php ?
Note: I think you meant
members/single/activity/permalink.php
rather than
members/single/permalink.phpIn reply to: Timestamp help pleaseYou probably need to use date_format()
Something like:
$time = $pictures_template->picture->date_uploaded; $time = date_format($time, 'Y-m-d H:i:s'); echo 'event happened '.humanTiming($time).' ago';Note that BP has a function for this
bp_core_time_since($time)
but you’ll need to pass $time as a Unix timestamp.