Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'buddypress'

Viewing 25 results - 16,876 through 16,900 (of 94,565 total)
  • Author
    Search Results
  • helloeng
    Participant

    Hello

    I’ve noticed that anyone, including non-members, non-subscribed visitors to my page can view the ‘members’ tab, and read the members profile information.

    I can’t find any options to make information private. Where can I find this?

    Wordpress 4.4
    Buddypress 2.40

    Thanks

    shanebp
    Moderator

    Create a template overload of this file:
    buddypress\bp-templates\bp-legacy\buddypress\members\members-loop.php

    In the overload, remove this code. It appears twice.

    <div class="pag-count" id="member-dir-count-bottom">
    
    	<?php bp_members_pagination_count(); ?>
    
    </div>
    fashleyjr002
    Participant

    Hi there Buddypress support I would like to change the url http://www.myeslcorner.com/wp-login.php on the user profile page. this can be seen when a a non log-in user views a certain profile. with the notification “You need to log in or create an account to post to this user’s Wall.” thanks

    #248346
    roccom669
    Participant

    im using sparkling theme for my website. it doesnt seems to support buddypress. please suggest something. my blog is http://www.wpfever.com

    sharmavishal
    Participant

    Use tools-buddypress-members to fix it

    Andrew
    Participant

    On HTML validator https://validator.w3.org/ I have 1 error:

    Bad value for attribute action on element form: Must be non-empty.
    <form action=”” name=”activity-loop-form” id=”activity-loop-form” method=”post”>

    Because in activity/activity-loop there is a form at the bottom with nothing in the action attribute:

    do_action( 'bp_after_activity_loop' ); ?>
    
    <?php if ( empty( $_POST['page'] ) ) : ?>
    
    	<form action="" name="activity-loop-form" id="activity-loop-form" method="post">
    
    		<?php wp_nonce_field( 'activity_filter', '_wpnonce_activity_filter' ); ?>
    
    	</form>
    
    <?php endif; ?>

    I searched these forums and someone already mentioned this:
    https://buddypress.org/support/search/Must+be+non-empty./

    I don’t think HTML5 allows the action attribute to be blank.

    #248337
    kostasbarkas30
    Participant

    Hello guys,

    One question about bp checkins. this is a fantastic plugin but bpci_activity_address not showing greek characters. any idea how to make the code to use utf-8 so as to play the greek characters?

    thanks

    i am using buddypress 2.3.5 and wordpress 4.3.1

    kostasbarkas30
    Participant

    Hello guys,

    I have a problem in members directory it counts wrong.
    Viewing 1-n from n members shows wrong number .

    Is there any way to remove this ? (viewing….)

    i use buddypress 2.3.5 and wordpress 4.3.1 with kleo theme

    thanks a lot

    #248330
    Henry Wright
    Moderator

    To like something are you using a plugin? BuddyPress doesn’t come with like functionality out of the box. I would think the plugin you’re using should supply the notification functionality. Try asking your plugin’s author to see if they can add the feature for you.

    #248329
    ibuddybook
    Participant

    Thanks for reply Mr,danbp

    Already i installed buddypress lke plugin. this plugin not send like notification. i thing buddypress like notification is not available in the internet. but how to manage my visitors. Social networking website main function is Like notifiacation only. visitors more expect this features. but buddypress not updating this function?????

    #248326

    In reply to: Private Pages Glitch?

    fscbmwcca
    Participant

    I installed BP Simple Private it seems to let you mark pages as private and if not logged in it redirects the page. I am only testing now and seems to be working. What I ultimately want to do is exclude “Subscribers” from BuddyPress and bbPress. Haven’t found how to do that yet.

    #248323

    In reply to: Private Pages Glitch?

    burger0815
    Participant

    Hello Brajesh Singh and Engine44

    I am a newcomer to buddypress and I think I had similar problems as Engine44.
    Frankly I could imagine that there are more people who have this
    problem but eventually don’t even realize it as a problem.
    In particular I can’t imagine that all that bp networks which
    are used by schools want to have kids discuss in public. So it might
    be a severe problem. But as said I am a newcomer so I might easily be
    wrong.

    The following concerns mostly the member and activity pages (I hope they are called
    this way, this is a direct translation from german), which are either set
    public -or if set private can’t be found anymore (which seems to kill more or less all major bp functions, like you can’t see profile etc.) I haven’t looked into groups yet.

    I asked a person for help who is pretty proficient in solving general programming
    problems but who is not a programmer and in particular not a PHP programmer. So eat with
    utmost caution.

    He came up with the following hack:
    The activity and member pages need to be public in order to assign them
    on the bp page. (I think this is the default upon installation)
    Then set the pages to private.

    go to buddypress/bp-core/bp-core-functions.php
    and then in function bp_core_get_directory_pages() {…

    change

    $page_names = $wpdb->get_results( „SELECT ID, post_name, post_parent, post_title FROM {$posts_table_name} WHERE ID IN ({$page_ids_sql}) AND post_statues = ‘publish’ ” );

    into

    // temporary hack
    if ( is_user_logged_in() ) {
    $page_names = $wpdb->get_results( “SELECT ID, post_name, post_parent, post_title FROM {$posts_table_name} WHERE ID IN ({$page_ids_sql}) ” );
    } else {
    $page_names = $wpdb->get_results( “SELECT ID, post_name, post_parent, post_title FROM {$posts_table_name} WHERE ID IN ({$page_ids_sql}) AND post_statues = ‘publish’ ” );
    }
    // was:
    // $page_names = $wpdb->get_results( “SELECT ID, post_name, post_parent, post_title FROM {$posts_table_name} WHERE ID IN ({$page_ids_sql}) AND post_statues = ‘publish’ ” );
    // /temporary hack

    #248321
    shanebp
    Moderator

    Have you tried deactivating other plugins to see if there is a conflict?

    Have you tried switching to a WP theme like 2013 to see if there is an issue in your current theme?

    How can i PM an expert each time i run into something i don’t know?

    These forums are run by volunteers.
    If you want access to an expert, you can create a listing on the jobs forum.

    #248318
    danbp
    Participant

    Hi,

    consider https://wordpress.org/plugins/buddypress-like/

    Notification likes will be implemented in next update (dixit author)

    #248317
    danbp
    Participant

    Hi,

    yes of course it is possible.
    You have to modify CSS from within your child-theme.

    Try:

    #buddypress div.item-list-tabs ul li.current a span, #buddypress div.item-list-tabs ul li.selected a span {
        background-color: red!important;
    }

    This example will change the background color into red for the number when you’re on a profile tab.
    Ie. when on message tab, background goes red. When not, it stays in original color. When on friends tab, background goes red, and so on.

    Use Firebug or a similar tool to get the correct tag class or id name.

    #248311
    RedWolf420
    Participant

    First time poster here, just looking to get some insight on how the group forums work. Basically, I have my site set up and running fine. I recently installed BuddyPress (I was using Ultimate Member), and I wanted people to have their own separate forums for their groups, different than the entire sites forums. I host a RP server for a game, and the group forums are so the members of the settlements they live in can communicate with each other.

    I followed the exact steps provided on setting up sitewide & group forums, but every time I get to the part in “Create A Group” to actually set up a forum, I am automatically re-directed to the main sites forum directory. I have tried deleting the group, disabling the ability to create forums, re-enabling it, then creating the group. I can enter in the name and description, as well as set permissions, but as soon as I click “next”, it directs me to the forums again. I go in the group to edit it and once I click forums again, I am re-directed.

    I am a noob when it comes to web development. I am assuming it’s being directed wrong, but how? If I didn’t change any slugs or URL’s to redirect to, what am I missing?

    #248307
    ibuddybook
    Participant

    Mr,Henry Wright

    I was searching the like notification plugin in the internet. but not available. buddypress live notification plugin only available. this plugin is working in comment section. not working for share activity and like. so please help me to solve my problem????

    Thank you

    H.Suresh

    #248306
    Joshua Blevins
    Participant

    I see the code here about creating custom member types, but it didn’t say much about where to put this code. I assumed one of two places. Either in the bp-custom.php file wp-content/plugins/ or in functions.php. However, when i post the code below into both I did not get the desired effect.

    
    function custom_member_types(){
    	bp_register_member_type("role", array("labels" => array("name" => "role", "singular_name" => "role"), "has_directory" => "coaches"));
    }
    
    add_action("bp_register_member_types", "custom_member_types");
    #248301
    Hendrik Lersch
    Participant

    Yes, i know.. Buddypress is free and i’m also very grateful for it.

    But i have spent the last 5 hours to find out, why my new navigation item didn’t work. I have read dozens of articles and posts, but my custom navigation link always leads me to the members overview page.

    Finally i was able to fix it by adding 'default_subnav_slug' => 'my_subnav_slug' to my bp_core_new_nav_item() function.

    I don’t want to add a subnav, therefore i dont mind, that it is needed! It’s documented here as OPTIONAL! Please fix this, thank you!

    I mean, the buddypress documentation is sparse anyway, so the existing information should be at least properly, shouldn’t it? 😉

    zanzaboonda
    Participant

    Hi there,

    I’m using Multisite. (I have another issue which no one has commented on that I really need help with.) I have 9 users on the subsite I’ve installed BP on, but only five of them show up in the members area. Two are admins, and seven are contributors. I cannot, for the life of me, figure out what the differences could be that only some show up and not others. My subsite is http://microcosmsfic.com.

    Also, I do show I have one pending user. However, when I click on it, I get the message “You do not have sufficient permissions to access this page.” This is with my superadmin ID. When I switch to another admin, it does not show a pending user. Also, the pending user is only shown on my subsite and not in my network users.

    Can anyone help? I would really appreciate it.

    Thanks and best wishes,
    Kristen

    1. Which version of WordPress are you running? 4.4

    2. Did you install WordPress as a directory or subdomain install? subdomain

    3. If a directory install, is it in root or in a subdirectory? Subdirectory (I think)

    4. Did you upgrade from a previous version of WordPress? If so, from which version? Previously, but I’ve since deactivated/uninstalled/reinstalled BuddyPress, and I’m having the same issues.

    5. Was WordPress functioning properly before installing/upgrading BuddyPress (BP)? e.g. permalinks, creating a new post, commenting. (yes, but n/a)

    6. Which version of BP are you running? 2.4.3

    7. Did you upgraded from a previous version of BP? If so, from which version? not that I recall

    8. Do you have any plugins other than BuddyPress installed and activated? If so, which ones? Yes. Notable, on this subsite: Askimet, Header and Footer Scripts, MyCred, Super Socializer, Wangard, WP ULike

    9. Are you using the standard WordPress theme or customized theme? standard (Farben Basic)

    10. Have you modified the core files in any way? No.

    11. Do you have any custom functions in bp-custom.php? No.

    12. If running bbPress, which version? Or did your BuddyPress install come with a copy of bbPress built-in? Built in.

    13. Please provide a list of any errors in your server’s log files. I’m not sure how to find this, sorry.

    14. Which company provides your hosting? Go Daddy (Yes, I know…)

    15. Is your server running Windows, or if Linux; Apache, nginx or something else? Linux

    #248293

    In reply to: WordPress User Table

    shanebp
    Moderator

    BuddyPress does not have its own user table.
    If BP is activated, all the users in the WP table are BP users.

    #248290
    wenlujon
    Participant

    thanks, but it seems it’s outdated and doesn’t support current buddypress, for example: it reports failure:

    
    Fatal error: Class 'BP_Group_Extension' not found in /var/www/html/wp-content/plugins/bp-edit-group-slug/bp-edit-group-slug.php on line 27
    #248289
    drmaves
    Participant

    Does BuddyPress use the WordPress user table for it’s users?

    #248288
    Murat
    Participant

    https://buddypress.org/support/topic/new-user-registration-problem-invalid-activation-key/

    I read this. It’s an issue of 2 years ago!

    I have a fresh install and I see that same problem still continues! This is unbelievable.

    #248285
    ibuddybook
    Participant

    Thank you for your reply Mr.Henry Wright…

    How to insert the code????? how to change the Parameters???. i am not understand. please tell me step by step…

    here is my code…
    /buddypress/bp-activity/bp-activity-notifications.php

    <?php
    /**
     * BuddyPress Activity Notifications.
     *
     * @package BuddyPress
     * @subpackage ActivityNotifications
     */
    
    // Exit if accessed directly.
    defined( 'ABSPATH' ) || exit;
    
    /* Emails *********************************************************************/
    
    /**
     * Send email and BP notifications when a user is mentioned in an update.
     *
     * @since 1.2.0
     *
     * @uses bp_notifications_add_notification()
     * @uses bp_get_user_meta()
     * @uses bp_core_get_user_displayname()
     * @uses bp_activity_get_permalink()
     * @uses bp_core_get_user_domain()
     * @uses bp_get_settings_slug()
     * @uses bp_activity_filter_kses()
     * @uses bp_core_get_core_userdata()
     * @uses wp_specialchars_decode()
     * @uses get_blog_option()
     * @uses bp_is_active()
     * @uses bp_is_group()
     * @uses bp_get_current_group_name()
     * @uses apply_filters() To call the 'bp_activity_at_message_notification_to' hook.
     * @uses apply_filters() To call the 'bp_activity_at_message_notification_subject' hook.
     * @uses apply_filters() To call the 'bp_activity_at_message_notification_message' hook.
     * @uses wp_mail()
     * @uses do_action() To call the 'bp_activity_sent_mention_email' hook.
     *
     * @param int $activity_id      The ID of the activity update.
     * @param int $receiver_user_id The ID of the user who is receiving the update.
     */
    
    function bp_activity_at_message_notification( $activity_id, $receiver_user_id ) {
    
    	// Don't leave multiple notifications for the same activity item.
    	$notifications = BP_Core_Notification::get_all_for_user( $receiver_user_id, 'all' );
    
    	foreach( $notifications as $notification ) {
    		if ( $activity_id == $notification->item_id ) {
    			return;
    		}
    	}
    
    	$activity = new BP_Activity_Activity( $activity_id );
    
    	$subject = '';
    	$message = '';
    	$content = '';
    
    	// Now email the user with the contents of the message (if they have enabled email notifications).
    	if ( 'no' != bp_get_user_meta( $receiver_user_id, 'notification_activity_new_mention', true ) ) {
    		$poster_name = bp_core_get_user_displayname( $activity->user_id );
    
    		$message_link  = bp_activity_get_permalink( $activity_id );
    		$settings_slug = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings';
    		$settings_link = bp_core_get_user_domain( $receiver_user_id ) . $settings_slug . '/notifications/';
    
    		$poster_name = stripslashes( $poster_name );
    		$content = bp_activity_filter_kses( strip_tags( stripslashes( $activity->content ) ) );
    
    		// Set up and send the message.
    		$ud       = bp_core_get_core_userdata( $receiver_user_id );
    		$to       = $ud->user_email;
    		$subject  = bp_get_email_subject( array( 'text' => sprintf( __( '%s mentioned you in an update', 'buddypress' ), $poster_name ) ) );
    
    		if ( bp_is_active( 'groups' ) && bp_is_group() ) {
    			$message = sprintf( __(
    '%1$s mentioned you in the group "%2$s":
    
    "%3$s"
    
    To view and respond to the message, log in and visit: %4$s
    
    ---------------------
    ', 'buddypress' ), $poster_name, bp_get_current_group_name(), $content, $message_link );
    		} else {
    			$message = sprintf( __(
    '%1$s mentioned you in an update:
    
    "%2$s"
    
    To view and respond to the message, log in and visit: %3$s
    
    ---------------------
    ', 'buddypress' ), $poster_name, $content, $message_link );
    		}
    
    		// Only show the disable notifications line if the settings component is enabled.
    		if ( bp_is_active( 'settings' ) ) {
    			$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
    		}
    
    		/**
    		 * Filters the user email that the @mention notification will be sent to.
    		 *
    		 * @since 1.2.0
    		 *
    		 * @param string $to User email the notification is being sent to.
    		 */
    		$to 	 = apply_filters( 'bp_activity_at_message_notification_to', $to );
    
    		/**
    		 * Filters the @mention notification subject that will be sent to user.
    		 *
    		 * @since 1.2.0
    		 *
    		 * @param string $subject     Email notification subject text.
    		 * @param string $poster_name Name of the person who made the @mention.
    		 */
    		$subject = apply_filters( 'bp_activity_at_message_notification_subject', $subject, $poster_name );
    
    		/**
    		 * Filters the @mention notification message that will be sent to user.
    		 *
    		 * @since 1.2.0
    		 *
    		 * @param string $message       Email notification message text.
    		 * @param string $poster_name   Name of the person who made the @mention.
    		 * @param string $content       Content of the @mention.
    		 * @param string $message_link  URL permalink for the activity message.
    		 * @param string $settings_link URL permalink for the user's notification settings area.
    		 */
    		$message = apply_filters( 'bp_activity_at_message_notification_message', $message, $poster_name, $content, $message_link, $settings_link );
    
    		wp_mail( $to, $subject, $message );
    	}
    
    	/**
    	 * Fires after the sending of an @mention email notification.
    	 *
    	 * @since 1.5.0
    	 *
    	 * @param BP_Activity_Activity $activity         Activity Item object.
    	 * @param string               $subject          Email notification subject text.
    	 * @param string               $message          Email notification message text.
    	 * @param string               $content          Content of the @mention.
    	 * @param int                  $receiver_user_id The ID of the user who is receiving the update.
    	 */
    	do_action( 'bp_activity_sent_mention_email', $activity, $subject, $message, $content, $receiver_user_id );
    }
    
    /**
     * Send email and BP notifications when an activity item receives a comment.
     *
     * @since 1.2.0
     *
     * @uses bp_get_user_meta()
     * @uses bp_core_get_user_displayname()
     * @uses bp_activity_get_permalink()
     * @uses bp_core_get_user_domain()
     * @uses bp_get_settings_slug()
     * @uses bp_activity_filter_kses()
     * @uses bp_core_get_core_userdata()
     * @uses wp_specialchars_decode()
     * @uses get_blog_option()
     * @uses bp_get_root_blog_id()
     * @uses apply_filters() To call the 'bp_activity_new_comment_notification_to' hook.
     * @uses apply_filters() To call the 'bp_activity_new_comment_notification_subject' hook.
     * @uses apply_filters() To call the 'bp_activity_new_comment_notification_message' hook.
     * @uses wp_mail()
     * @uses do_action() To call the 'bp_activity_sent_reply_to_update_email' hook.
     * @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_to' hook.
     * @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_subject' hook.
     * @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_message' hook.
     * @uses do_action() To call the 'bp_activity_sent_reply_to_reply_email' hook.
     *
     * @param int   $comment_id   The comment id.
     * @param int   $commenter_id The ID of the user who posted the comment.
     * @param array $params       {@link bp_activity_new_comment()}.
     * @return bool
     */
    function bp_activity_new_comment_notification( $comment_id = 0, $commenter_id = 0, $params = array() ) {
    
    	// Set some default parameters.
    	$activity_id = 0;
    	$parent_id   = 0;
    
    	extract( $params );
    
    	$original_activity = new BP_Activity_Activity( $activity_id );
    
    	if ( $original_activity->user_id != $commenter_id && 'no' != bp_get_user_meta( $original_activity->user_id, 'notification_activity_new_reply', true ) ) {
    		$poster_name   = bp_core_get_user_displayname( $commenter_id );
    		$thread_link   = bp_activity_get_permalink( $activity_id );
    		$settings_slug = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings';
    		$settings_link = bp_core_get_user_domain( $original_activity->user_id ) . $settings_slug . '/notifications/';
    
    		$poster_name = stripslashes( $poster_name );
    		$content = bp_activity_filter_kses( stripslashes($content) );
    
    		// Set up and send the message.
    		$ud      = bp_core_get_core_userdata( $original_activity->user_id );
    		$to      = $ud->user_email;
    		$subject = bp_get_email_subject( array( 'text' => sprintf( __( '%s replied to one of your updates', 'buddypress' ), $poster_name ) ) );
    		$message = sprintf( __(
    '%1$s replied to one of your updates:
    
    "%2$s"
    
    To view your original update and all comments, log in and visit: %3$s
    
    ---------------------
    ', 'buddypress' ), $poster_name, $content, $thread_link );
    
    		// Only show the disable notifications line if the settings component is enabled.
    		if ( bp_is_active( 'settings' ) ) {
    			$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
    		}
    
    		/**
    		 * Filters the user email that the new comment notification will be sent to.
    		 *
    		 * @since 1.2.0
    		 *
    		 * @param string $to User email the notification is being sent to.
    		 */
    		$to = apply_filters( 'bp_activity_new_comment_notification_to', $to );
    
    		/**
    		 * Filters the new comment notification subject that will be sent to user.
    		 *
    		 * @since 1.2.0
    		 *
    		 * @param string $subject     Email notification subject text.
    		 * @param string $poster_name Name of the person who made the comment.
    		 */
    		$subject = apply_filters( 'bp_activity_new_comment_notification_subject', $subject, $poster_name );
    
    		/**
    		 * Filters the new comment notification message that will be sent to user.
    		 *
    		 * @since 1.2.0
    		 *
    		 * @param string $message       Email notification message text.
    		 * @param string $poster_name   Name of the person who made the comment.
    		 * @param string $content       Content of the comment.
    		 * @param string $thread_link   URL permalink for the activity thread.
    		 * @param string $settings_link URL permalink for the user's notification settings area.
    		 */
    		$message = apply_filters( 'bp_activity_new_comment_notification_message', $message, $poster_name, $content, $thread_link, $settings_link );
    
    		wp_mail( $to, $subject, $message );
    
    		/**
    		 * Fires after the sending of a reply to an update email notification.
    		 *
    		 * @since 1.5.0
    		 *
    		 * @param int    $user_id      ID of the original activity item author.
    		 * @param string $subject      Email notification subject text.
    		 * @param string $message      Email notification message text.
    		 * @param int    $comment_id   ID for the newly received comment.
    		 * @param int    $commenter_id ID of the user who made the comment.
    		 * @param array  $params       Arguments used with the original activity comment.
    		 */
    		do_action( 'bp_activity_sent_reply_to_update_email', $original_activity->user_id, $subject, $message, $comment_id, $commenter_id, $params );
    	}
    
    	/*
    	 * If this is a reply to another comment, send an email notification to the
    	 * author of the immediate parent comment.
    	 */
    	if ( empty( $parent_id ) || ( $activity_id == $parent_id ) ) {
    		return false;
    	}
    
    	$parent_comment = new BP_Activity_Activity( $parent_id );
    
    	if ( $parent_comment->user_id != $commenter_id && $original_activity->user_id != $parent_comment->user_id && 'no' != bp_get_user_meta( $parent_comment->user_id, 'notification_activity_new_reply', true ) ) {
    		$poster_name   = bp_core_get_user_displayname( $commenter_id );
    		$thread_link   = bp_activity_get_permalink( $activity_id );
    		$settings_slug = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings';
    		$settings_link = bp_core_get_user_domain( $parent_comment->user_id ) . $settings_slug . '/notifications/';
    
    		// Set up and send the message.
    		$ud       = bp_core_get_core_userdata( $parent_comment->user_id );
    		$to       = $ud->user_email;
    		$subject = bp_get_email_subject( array( 'text' => sprintf( __( '%s replied to one of your comments', 'buddypress' ), $poster_name ) ) );
    
    		$poster_name = stripslashes( $poster_name );
    		$content = bp_activity_filter_kses( stripslashes( $content ) );
    
    $message = sprintf( __(
    '%1$s replied to one of your comments:
    
    "%2$s"
    
    To view the original activity, your comment and all replies, log in and visit: %3$s
    
    ---------------------
    ', 'buddypress' ), $poster_name, $content, $thread_link );
    
    		// Only show the disable notifications line if the settings component is enabled.
    		if ( bp_is_active( 'settings' ) ) {
    			$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
    		}
    
    		/**
    		 * Filters the user email that the new comment reply notification will be sent to.
    		 *
    		 * @since 1.2.0
    		 *
    		 * @param string $to User email the notification is being sent to.
    		 */
    		$to = apply_filters( 'bp_activity_new_comment_notification_comment_author_to', $to );
    
    		/**
    		 * Filters the new comment reply notification subject that will be sent to user.
    		 *
    		 * @since 1.2.0
    		 *
    		 * @param string $subject     Email notification subject text.
    		 * @param string $poster_name Name of the person who made the comment reply.
    		 */
    		$subject = apply_filters( 'bp_activity_new_comment_notification_comment_author_subject', $subject, $poster_name );
    
    		/**
    		 * Filters the new comment reply notification message that will be sent to user.
    		 *
    		 * @since 1.2.0
    		 *
    		 * @param string $message       Email notification message text.
    		 * @param string $poster_name   Name of the person who made the comment reply.
    		 * @param string $content       Content of the comment reply.
    		 * @param string $settings_link URL permalink for the user's notification settings area.
    		 * @param string $thread_link   URL permalink for the activity thread.
    		 */
    		$message = apply_filters( 'bp_activity_new_comment_notification_comment_author_message', $message, $poster_name, $content, $settings_link, $thread_link );
    
    		wp_mail( $to, $subject, $message );
    
    		/**
    		 * Fires after the sending of a reply to a reply email notification.
    		 *
    		 * @since 1.5.0
    		 *
    		 * @param int    $user_id      ID of the parent activity item author.
    		 * @param string $subject      Email notification subject text.
    		 * @param string $message      Email notification message text.
    		 * @param int    $comment_id   ID for the newly received comment.
    		 * @param int    $commenter_id ID of the user who made the comment.
    		 * @param array  $params       Arguments used with the original activity comment.
    		 */
    		do_action( 'bp_activity_sent_reply_to_reply_email', $parent_comment->user_id, $subject, $message, $comment_id, $commenter_id, $params );
    	}
    }
    
    /**
     * Helper method to map action arguments to function parameters.
     *
     * @since 1.9.0
     *
     * @param int   $comment_id ID of the comment being notified about.
     * @param array $params     Parameters to use with notification.
     */
    function bp_activity_new_comment_notification_helper( $comment_id, $params ) {
    	bp_activity_new_comment_notification( $comment_id, $params['user_id'], $params );
    }
    add_action( 'bp_activity_comment_posted', 'bp_activity_new_comment_notification_helper', 10, 2 );
    
    /** Notifications *************************************************************/
    
    /**
     * Format notifications related to activity.
     *
     * @since 1.5.0
     *
     * @uses bp_loggedin_user_domain()
     * @uses bp_get_activity_slug()
     * @uses bp_core_get_user_displayname()
     * @uses apply_filters() To call the 'bp_activity_multiple_at_mentions_notification' hook.
     * @uses apply_filters() To call the 'bp_activity_single_at_mentions_notification' hook.
     * @uses do_action() To call 'activity_format_notifications' hook.
     *
     * @param string $action            The type of activity item. Just 'new_at_mention' for now.
     * @param int    $item_id           The activity ID.
     * @param int    $secondary_item_id In the case of at-mentions, this is the mentioner's ID.
     * @param int    $total_items       The total number of notifications to format.
     * @param string $format            'string' to get a BuddyBar-compatible notification, 'array' otherwise.
     * @return string $return Formatted @mention notification.
     */
    function bp_activity_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) {
    
    	switch ( $action ) {
    		case 'new_at_mention':
    			$activity_id      = $item_id;
    			$poster_user_id   = $secondary_item_id;
    			$at_mention_link  = bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/';
    			$at_mention_title = sprintf( __( '@%s Mentions', 'buddypress' ), bp_get_loggedin_user_username() );
    			$amount = 'single';
    
    			if ( (int) $total_items > 1 ) {
    				$text = sprintf( __( 'You have %1$d new mentions', 'buddypress' ), (int) $total_items );
    				$amount = 'multiple';
    			} else {
    				$user_fullname = bp_core_get_user_displayname( $poster_user_id );
    				$text =  sprintf( __( '%1$s mentioned you', 'buddypress' ), $user_fullname );
    			}
    		break;
    	}
    
    	if ( 'string' == $format ) {
    
    		/**
    		 * Filters the @mention notification for the string format.
    		 *
    		 * This is a variable filter that is dependent on how many items
    		 * need notified about. The two possible hooks are bp_activity_single_at_mentions_notification
    		 * or bp_activity_multiple_at_mentions_notification.
    		 *
    		 * @since 1.5.0
    		 *
    		 * @param string $string          HTML anchor tag for the mention.
    		 * @param string $at_mention_link The permalink for the mention.
    		 * @param int    $total_items     How many items being notified about.
    		 * @param int    $activity_id     ID of the activity item being formatted.
    		 * @param int    $poster_user_id  ID of the user posting the mention.
    		 */
    		$return = apply_filters( 'bp_activity_' . $amount . '_at_mentions_notification', '<a href="' . esc_url( $at_mention_link ) . '" title="' . esc_attr( $at_mention_title ) . '">' . esc_html( $text ) . '</a>', $at_mention_link, (int) $total_items, $activity_id, $poster_user_id );
    	} else {
    
    		/**
    		 * Filters the @mention notification for any non-string format.
    		 *
    		 * This is a variable filter that is dependent on how many items need notified about.
    		 * The two possible hooks are bp_activity_single_at_mentions_notification
    		 * or bp_activity_multiple_at_mentions_notification.
    		 *
    		 * @since 1.5.0
    		 *
    		 * @param array  $array           Array holding the content and permalink for the mention notification.
    		 * @param string $at_mention_link The permalink for the mention.
    		 * @param int    $total_items     How many items being notified about.
    		 * @param int    $activity_id     ID of the activity item being formatted.
    		 * @param int    $poster_user_id  ID of the user posting the mention.
    		 */
    		$return = apply_filters( 'bp_activity_' . $amount . '_at_mentions_notification', array(
    			'text' => $text,
    			'link' => $at_mention_link
    		), $at_mention_link, (int) $total_items, $activity_id, $poster_user_id );
    	}
    
    	/**
    	 * Fires right before returning the formatted activity notifications.
    	 *
    	 * @since 1.2.0
    	 *
    	 * @param string $action            The type of activity item.
    	 * @param int    $item_id           The activity ID.
    	 * @param int    $secondary_item_id @mention mentioner ID.
    	 * @param int    $total_items       Total amount of items to format.
    	 */
    	do_action( 'activity_format_notifications', $action, $item_id, $secondary_item_id, $total_items );
    
    	return $return;
    }
    
    /**
     * Notify a member when their nicename is mentioned in an activity stream item.
     *
     * Hooked to the 'bp_activity_sent_mention_email' action, we piggy back off the
     * existing email code for now, since it does the heavy lifting for us. In the
     * future when we separate emails from Notifications, this will need its own
     * 'bp_activity_at_name_send_emails' equivalent helper function.
     *
     * @since 1.9.0
     *
     * @param object $activity           Activity object.
     * @param string $subject (not used) Notification subject.
     * @param string $message (not used) Notification message.
     * @param string $content (not used) Notification content.
     * @param int    $receiver_user_id   ID of user receiving notification.
     */
    function bp_activity_at_mention_add_notification( $activity, $subject, $message, $content, $receiver_user_id ) {
    	if ( bp_is_active( 'notifications' ) ) {
    		bp_notifications_add_notification( array(
    			'user_id'           => $receiver_user_id,
    			'item_id'           => $activity->id,
    			'secondary_item_id' => $activity->user_id,
    			'component_name'    => buddypress()->activity->id,
    			'component_action'  => 'new_at_mention',
    			'date_notified'     => bp_core_current_time(),
    			'is_new'            => 1,
    		) );
    	}
    }
    add_action( 'bp_activity_sent_mention_email', 'bp_activity_at_mention_add_notification', 10, 5 );
    
    /**
     * Mark at-mention notifications as read when users visit their Mentions page.
     *
     * @since 1.5.0
     *
     * @uses bp_notifications_mark_all_notifications_by_type()
     */
    function bp_activity_remove_screen_notifications() {
    	if ( ! bp_is_active( 'notifications' ) ) {
    		return;
    	}
    
    	// Only mark read if you're looking at your own mentions.
    	if ( ! bp_is_my_profile() ) {
    		return;
    	}
    
    	bp_notifications_mark_notifications_by_type( bp_loggedin_user_id(), buddypress()->activity->id, 'new_at_mention' );
    }
    add_action( 'bp_activity_screen_mentions', 'bp_activity_remove_screen_notifications' );
    
    /**
     * Mark at-mention notification as read when user visits the activity with the mention.
     *
     * @since 2.0.0
     *
     * @param BP_Activity_Activity $activity Activity object.
     */
    function bp_activity_remove_screen_notifications_single_activity_permalink( $activity ) {
    	if ( ! bp_is_active( 'notifications' ) ) {
    		return;
    	}
    
    	if ( ! is_user_logged_in() ) {
    		return;
    	}
    
    	// Mark as read any notifications for the current user related to this activity item.
    	bp_notifications_mark_notifications_by_item_id( bp_loggedin_user_id(), $activity->id, buddypress()->activity->id, 'new_at_mention' );
    }
    add_action( 'bp_activity_screen_single_activity_permalink', 'bp_activity_remove_screen_notifications_single_activity_permalink' );
    
    /**
     * Delete at-mention notifications when the corresponding activity item is deleted.
     *
     * @since 2.0.0
     *
     * @param array $activity_ids_deleted IDs of deleted activity items.
     */
    function bp_activity_at_mention_delete_notification( $activity_ids_deleted = array() ) {
    	// Let's delete all without checking if content contains any mentions
    	// to avoid a query to get the activity.
    	if ( bp_is_active( 'notifications' ) && ! empty( $activity_ids_deleted ) ) {
    		foreach ( $activity_ids_deleted as $activity_id ) {
    			bp_notifications_delete_all_notifications_by_type( $activity_id, buddypress()->activity->id );
    		}
    	}
    }
    add_action( 'bp_activity_deleted_activities', 'bp_activity_at_mention_delete_notification', 10 );
Viewing 25 results - 16,876 through 16,900 (of 94,565 total)
Skip to toolbar