Search Results for 'buddypress'
-
AuthorSearch Results
-
August 18, 2015 at 9:15 am #243323
In reply to: Need urgent help with BP notifications
danbp
ParticipantI am writing all these code in bp-functions.php in my bududdypress folder within my theme folder. (this may be my problem).
Yeah, it is probably the problem. Custom functions for BP can/should be added to bp-custom.php, which should sit in wp-content/plugins/bp-custom.php, not in your child theme buddypress folder.
Or into functions.php of your child-theme.
bp-custom.php explained on Codex.
August 18, 2015 at 9:08 am #243322In reply to: how to check if the length of field is too long?
danbp
ParticipantHere an example for profile field lenght with some comments.
function bpfr_custom_textfield_length() { //Check if user is logged in & if xprofile component is activated if ( is_user_logged_in() && bp_is_active( 'xprofile' ) ) : $my_custom_textfield = bp_get_member_profile_data( 'field=Brief Biography&user_id='.bp_get_member_user_id() ); /* * The length = number of characters, not words. * Set the number of caracters to show. * The 3 dots are the appended text ending the excerpt. * Don't remove the quotes if you change this * BuddyPress 2.1 will add new class and id for custom fields. * The span can be omited to style this part. See ticket #5741 */ if ( strlen($my_custom_textfield) > 20) : //adjust to your need $my_custom_textfield = substr($my_custom_textfield, 20).'...'; //adjust to your need endif; // uncomment the following line to get a span around the displayed field content // echo '<span class="short-custom">'. $my_custom_textfield; .'</span>'; // comment the following line if you use the span echo $my_custom_textfield; endif; // is_user_logged_in } add_action( 'bp_directory_members_item', 'bpfr_custom_textfield_length' );Ticket #5741
August 18, 2015 at 9:01 am #243321In reply to: Need urgent help with BP notifications
chicho1969
Participantokay, This is almost done, but is really rare, not everything works as it should.
First of all, this is not a pluggin, I am writing all these code in bp-functions.php in my bududdypress folder within my theme folder. (this may be my problem).
Step by step:
1st Problem setup globals is not working as it espected:define( 'BP_NOTIFIER_CELBIRTHDAY_SLUG', 'celbirthday_notifier' ); function celbirthday_notifier_setup_globals () { global $bp, $wpdb; $bp = buddypress(); $bp->celbirthday_notifier = new stdClass(); $bp->celbirthday_notifier->id = 'celbirthday_notifier'; //I asume others are not going to use this is $bp->celbirthday_notifier->slug = BP_NOTIFIER_CELBIRTHDAY_SLUG; $bp->celbirthday_notifier->notification_callback = 'celbirthday_notifier_format_notifications'; //show the notification $bp->active_components[$bp->celbirthday_notifier->id] = $bp->celbirthday_notifier->id; do_action( 'bp_setup_globals' ); }This function is not doing nothing unless I call it directly:
celbirthday_notifier_setup_globals ();
I Know this is not the proper way, but it is the only way I found to make it run.
Does anyone know why it does not work properly?Continue with the notification:
//Format notifications function celbirthday_notifier_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) { if ( 'new_birthday' === $action ) { if ( (int) $total_items > 1 ) { if ( 'string' === $format ) { $famoso_name = get_the_title( $secondary_item_id ); return apply_filters( 'celebrities_multiple_verifications_notification','Say Happybirthday to '.$famoso_name); } } else { if ( 'string' === $format ) { //falta definir $famoso_link y mas $famoso_name = get_the_title( $secondary_item_id ); return apply_filters( 'celebrities_single_verifications_notification','Say Happybirthday to '.$famoso_name); // $return = apply_filters( $filter, '<a href="' . esc_url( $famoso_link ) . '" title="birthday anounce">' . esc_html( $text ) . '</a>', (int) $total_items, $text, $famoso_link ); // $message = apply_filters( 'bp_activity_at_message_notification_message', $message, $poster_name, $content, $message_link, $settings_link ); } } } do_action( 'celbirthday_notifier_format_notifications', $action, $item_id, $secondary_item_id, $total_items ); return false; }ok, this format function is working right, although I have to do some more work. After it, I have two more functions (mark and delete notifications) wich are also working fine.
//mark notification function celebrities_mark_screen_notifications() { global $bp; bp_notifications_mark_notifications_by_item_id( $bp->loggedin_user->id, $bp->celbirthday_notifier->id, 'new_birthday', $secondary_item_id = false, $is_new='0'); } add_action( 'bp_notifications_screen', 'celebrities_mark_screen_notifications' );and…
function celbirthday_notifier_remove_screen_notifications() { global $bp; bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->profile->slug, 'new_birthday' ); } add_action( 'bp_notifications_screen', 'celbirthday_notifier_remove_screen_notifications' ); add_action( 'xprofile_screen_display_profile', 'celbirthday_notifier_remove_screen_notifications' );As I say, this works fine, but a I am not sure if I need the second “add_action” (xprofile screen).
And finally, to add notification I use this code (which is not working)://Adding notification function buddypress_celebrities_add_notification() { if ( bp_is_active( 'notifications' ) ) { $fecha_act = date("Y-m-d"); $res_birth = $wpdb->get_results( "SELECT wp_best_favs.user_id, wp_postmeta.post_id FROM wp_best_favs LEFT JOIN wp_postmeta ON ( wp_postmeta.post_id = wp_best_favs.celeb_ID ) WHERE ( wp_postmeta.meta_key = 'fecha_na') AND (DAY( <code>wp_postmeta</code>.<code>meta_value</code> ) = DAY( '$fecha_act' )) AND (MONTH( <code>wp_postmeta</code>.<code>meta_value</code> ) = MONTH( '$fecha_act' )) "); $res_birth = array_filter($res_birth); $matriz = objectToArray($res_birth); //I use this function to convert objet array to simple array if(count($matriz)==0) { // está vacío } else { global $wpdb; $bp = buddypress(); $current_time = bp_core_current_time(); foreach ($matriz as $v1) { $famoso_id = $v1[post_id]; $receiver_user_id = $v1[user_id]; $args = array( 'user_id' => $receiver_user_id, 'item_id' => $famoso_id, 'secondary_item_id' => $famoso_id, 'component_name' => $bp->celbirthday_notifier->slug, 'component_action' => 'new_birthday', 'date_notified' => $current_time, 'is_new' => 1, ); bp_notifications_add_notification( $args ); } } } } do_action( 'bp_init', 'buddypress_celebrities_add_notification' );So this is my bigger problem:
Add notifications (function buddypress_celebrities_add_notification()) is not working.
I am pretty sure this is because I am not hooking properly, but I tried so many hooks and none of it did work.
I Know the code is fine because if I comment the two first lines and the two last lines (so I run the code not as a function) the notifications are being added to database.Anyone can help me, to find a proper hook, or just pointing me in the right direction.
Thanks in advance.August 18, 2015 at 8:57 am #243319In reply to: [Resolved] Warning: strstr(): Empty needle in
danbp
ParticipantHi @ramuzic,
read the related ticket for more explanation from here:
https://buddypress.org/support/topic/warning-strstr-empty-needle/#post-239979If the error is still in after changing to one of twenty theme, it’s possible you use a cache plugin containing some old files or your browser history is…very old. Clear it !
August 18, 2015 at 7:15 am #243313In reply to: restrict friend requests
Henry Wright
ModeratorHave you tried the BuddyPress Limit Friendship plugin?
August 17, 2015 at 11:56 pm #243306In reply to: Private Message Pagination
Henry Wright
Moderator@danbp I needed your answer 1 year 6 months ago 🙂
August 17, 2015 at 7:51 pm #243300In reply to: Private Message Pagination
danbp
Participantper_page option is availble for the message loop, like inbox (which is default), sentbox and notices where all received message are stored. This option let you paginat the result.
Now, the case of a long conversation. This start in the inbox, where you found it at page 1 or 12…
You click on the message and you see the content. This page is not concerned by the loop containing your per_page option. You can control that in the url.If you read the code in the file i indicated you previously, you’ll see that there is no pagination system in it.
Message option can be set in bp-templates\bp-legacy\buddypress\members\single\messages\message-loop.php
You need to copy this file into your child-theme first so you won’t loose your modification at next update. See codex if you need more infos about theming.
August 17, 2015 at 7:37 pm #243299danbp
ParticipantA username is not a real name and wordpress use only username, email and password (the only real security point) to allow access.
And the default behavior of WordPress is to set the nicename equal to the username. So, where is the security issue ?If you’re affraid by the Name field coming with BuddyPress during registration, rename it to Pseudonyme and you’re done. The field must contain a value, which can be first name, last name or whatever. The value is mandatory, not the name as name… ch1n3s3b0y is certainly not your name !
You’re asking to replace the username by a another value collected with the same register form. Do you think that such other field has less importance in regard of security ? Why would the username be critical and the custom field not ?
You can even disallow dashboard access to your subscriber, so they never can change anything outside of what is on hand on front-end profile management.
Please read here to calm you down (hopefully) 🙂
August 17, 2015 at 7:36 pm #243298In reply to: i want to, nobody can not change own gender.
Kailan Wyatt
ParticipantYou can try this plugin by BuddyDev
August 17, 2015 at 7:14 pm #243297In reply to: Private Message Pagination
RecAgenda
ParticipantSo then, if I can get some clarification, what’s it talking about on this page with:
per_page optional
The number of messages to display on a page before they are paginated to the next page.- Default value: 10
If that’s as obvious as I think it is, then where I can find that in my files?
August 17, 2015 at 3:27 pm #243292maelga
Participant+1
I only found this old thread but with broken links unfortunately: https://buddypress.org/support/topic/member-profile-url-with-user-id-instead-of-username/
So any input would be appreciated.
August 17, 2015 at 3:22 pm #243291In reply to: [Resolved] Problem with duplicate content
Splendorito
ParticipantHi Henry,
I was able to fix this. It was in w3tc, I had combined certain files, and forgot to set up templates for buddypress.min.js in the minify options, the thing is that it started in the latest version of BP, before I never had any troubles with it.
August 17, 2015 at 10:20 am #243282In reply to: Private Message Pagination
danbp
ParticipantHi @recagenda,
you can’t enable this, because it doesn’t exist. I could be wrong, but so far i know, private conversation are not paginable.
Reference file is bp-templates\bp-legacy\buddypress\members\single\messages\single.php
https://buddypress.org/support/topic/pagination-private-message-thread/ – @henrywright
August 16, 2015 at 3:39 am #243253In reply to: Group Widget Link Target
danbp
ParticipantReference file: buddypress\bp-groups\bp-groups-widgets.php
To make your own version of the widget: https://codex.wordpress.org/Widgets_API
HTML definition
target="_blank"Or maybe this plugin ?
https://wordpress.org/plugins/bp-extend-widgets/August 16, 2015 at 3:13 am #243249In reply to: My accaunt in menu or header
danbp
ParticipantHowdy [username] is part of WordPress Toolbar. When BP is activated, it add a sub-menu to this menu.
If you want it elswhere, it’s not really possible as the BP part of it was written to go to the admin_bar only.
To get a similar menu, you simply add buddypress menu to your theme main menu (explained on above codex link). But this menu will be static and you cant get same details.
Another solution is to recode that menu, so you can add it with a filter function to wp_nav_menu, which handles the main menu or the header menu.
To do this, you can use a new Walker Class extention or the existing filter. Possibly also some other ways to do this, but i don’t know them.
To remove the Howdy menu and the attached BuddyPress Profile sub menu from the Toolbar, you can use this snippet (in functions.php or bp-custom.php):
function bpfr_remove_my_account_menu() { global $wp_admin_bar; $wp_admin_bar->remove_menu('my-account'); } add_action( 'wp_before_admin_bar_render', 'bpfr_remove_my_account_menu' );Codex References
https://codex.wordpress.org/Function_Reference/wp_nav_menu
https://codex.wordpress.org/Navigation_MenusAugust 15, 2015 at 11:51 pm #243239djsteveb
ParticipantI would GUESS that you could edit that plugin to add in the code as mentioned above https://buddypress.org/support/topic/how-users-can-link-to-their-profile/
Or ask the plugin author for clarification.
I stopped using that plugin when they added the extra security stuff for strong passwords that broke things for me.. however the plugin’s support page is pretty active, and given that he/she has options for redirecting users after login based on role – there may be an easy way to add such functionality to the plugin by asking the plugin author.
There is a bit of info with some of the functions here ->https://codex.buddypress.org/themes/members-navigation-menus/
I see others are asking about bp xprofile fields and such within the them my login support forum,
( wordpress.org/support/plugin/theme-my-login )
so hopefully this plugin author will add more and more BP options – I enjoyed using that plugin some time ago – hope it continues to mature.August 15, 2015 at 11:43 pm #243238In reply to: My accaunt in menu or header
djsteveb
ParticipantAugust 15, 2015 at 9:32 pm #243231In reply to: Disabling Admin ability to see User Notifications
manicexpression
ParticipantForgive me if I’m just making a mistake, I’ve never tried what you’re suggesting, in the link you sent me, it asks me to go to this directory,
/bp-templates/bp-legacy/buddypress/
But when I go there, there’s no Template file to copy, just more folders.
Thoughts?
August 15, 2015 at 6:58 pm #243229In reply to: My accaunt in menu or header
djsteveb
Participant@sismis
maybe this will help without getting into code -> https://codex.buddypress.org/getting-started/buddypress-links-in-wordpress-menus/August 15, 2015 at 5:32 pm #243228danbp
Participant@djsteveb +1 !
– you go to your menu dashboard and select the menu of your theme (if exist, it should be there)
– you open screen option (top right) on menu admin and select BuddyPress
– you select profile in the left column where BuddyPress appeared and give it a title XYZ
– save and you’re done !Now you have a XYZ button near Home, About and whatever is already on your theme menu.
Doc is here https://codex.buddypress.org/getting-started/buddypress-links-in-wordpress-menus/August 15, 2015 at 4:42 pm #243227In reply to: Disabling Admin ability to see User Notifications
shanebp
ModeratorYou could create a template overload of this file:
bp-templates\bp-legacy\buddypress\members\single\notifications.phpThen wrap the current markup with this conditional:
bp_is_my_profile()August 15, 2015 at 3:34 pm #243225In reply to: Disabling Admin ability to see User Notifications
manicexpression
ParticipantFor the moment, as a temporary fix, I have completely removed the Notifications.php file from
public_html/wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress/members/single/notifications.php
August 15, 2015 at 3:30 am #243216djsteveb
Participantsame question asked by someone else hours ago (Also on front page currently)?
https://buddypress.org/support/topic/how-users-can-link-to-their-profile/which is same as 4 days ago as pointed out by others – https://buddypress.org/support/topic/how-users-can-link-to-their-profile/
I think(?)
August 14, 2015 at 9:53 pm #243209In reply to: Tool bar missing Register?
djsteveb
Participant@darkhelmet1 – settings -> buddypress -> third tab near top is “settings”
first checkbox: Show the Toolbar for logged out usersIs it checked?
Which theme are you using?
Any other plugins installed / activated?
August 14, 2015 at 8:14 pm #243204In reply to: Adding Profile Link to Menu
danbp
ParticipantThis question was asked 4 days ago here:
https://buddypress.org/support/topic/how-users-can-link-to-their-profile/And some other search result you can read also, here:
https://buddypress.org/support/search/bp_get_loggedin_user_link/Finally, question is: which menu are you talking about ? Give details please.
-
AuthorSearch Results