示例#1
0
 /**
  * Format string and media url for notification
  * 
  * @param   array           $params array ('action', 'post_id', 'initiator_id', 'total_items', 'format' )
  * @return string/array     format notification as $params['format'] request
  */
 function format_like_notifications($params)
 {
     $action = $params['action'];
     $post_id = $params['post_id'];
     if ($this->component_action . $post_id == $action) {
         $initiator_id = $params['initiator_id'];
         $total_items = $params['total_items'];
         $format = $params['format'];
         $liked_list = $this->fetch_media_like_stats(rtmedia_id($post_id));
         $liked_by = bp_core_get_username($liked_list[0]->user_id);
         $like_count = get_rtmedia_like($post_id);
         $link = get_rtmedia_permalink(rtmedia_id($post_id));
         $media_type = rtmedia_type(rtmedia_id($post_id));
         if ($like_count == 0) {
             $this->delete_notification_by_item_id($initiator_id, $post_id);
         } elseif ($like_count == 1) {
             $text = $liked_by . ' ' . __('liked your', 'rtmedia') . ' ' . $media_type;
         } elseif ($like_count == 2) {
             $text = $liked_by . ' ' . __('and one more friend liked your', 'rtmedia') . ' ' . $media_type;
         } else {
             $count = $like_count - 1;
             $text = $liked_by . ' ' . __('and', 'rtmedia') . ' ' . $count . ' ' . __('other friends liked your', 'rtmedia') . ' ' . $media_type;
         }
         if ($format == 'string') {
             $return = apply_filters('rtmedia_before_like_notification', '<a href="' . $link . '">' . $text . '</a>', (int) $total_items);
         } else {
             $return = apply_filters('rtmedia_before_like_notification', array('link' => $link, 'text' => $text), (int) $total_items);
         }
         return $return;
     }
 }
 /**
  * format the new notification in String or array
  * @param array         $params
  * @return array/string  As per $format 
  */
 function format_comment_notifications($params)
 {
     $action = $params['action'];
     $post_id = $params['post_id'];
     if ($this->component_action . $post_id == $action) {
         $initiator_id = $params['initiator_id'];
         $total_items = $params['total_items'];
         $format = $params['format'];
         $comment_author = bp_core_get_username($initiator_id);
         $media_url = get_rtmedia_permalink(rtmedia_id($post_id));
         $media_type = rtmedia_type(rtmedia_id($post_id));
         if ($total_items == 1) {
             $text = $comment_author . ' ' . __('commented on your', 'buddypress-media') . ' ' . $media_type;
         } else {
             $text = $total_items . ' ' . __('new comments on your', 'buddypress-media') . ' ' . $media_type;
         }
         $link = $media_url;
         if ($format == 'string') {
             $return = apply_filters('rtmedia_before_comment_notification', '<a href="' . $link . '">' . $text . '</a>', (int) $total_items);
         } else {
             $return = apply_filters('rtmedia_before_comment_notification', array('link' => $link, 'text' => $text), (int) $total_items);
         }
         return $return;
     }
 }
 /**
  * Format string and media url for notification
  *
  * @param   array $params array ('action', 'post_id', 'initiator_id', 'total_items', 'format' )
  *
  * @return string/array     format notification as $params['format'] request
  */
 function format_like_notifications($params)
 {
     $action = $params['action'];
     $post_id = intval($params['post_id']);
     if ($this->component_action . $post_id === $action) {
         $initiator_id = $params['initiator_id'];
         $total_items = $params['total_items'];
         $format = $params['format'];
         $rtmedia_id = rtmedia_id($post_id);
         $liked_list = $this->fetch_media_like_stats($rtmedia_id);
         $liked_by = bp_core_get_username($liked_list[0]->user_id);
         $like_count = get_rtmedia_like($post_id);
         $link = esc_url(get_rtmedia_permalink($rtmedia_id));
         $media_type = rtmedia_type($rtmedia_id);
         $text = null;
         if (0 === intval($like_count)) {
             $this->delete_notification_by_item_id($initiator_id, $post_id);
         } elseif (1 === intval($like_count)) {
             $text = $liked_by . ' ' . __('liked your', 'buddypress-media') . ' ' . $media_type;
         } elseif (2 === intval($like_count)) {
             $text = $liked_by . ' ' . __('and one more friend liked your', 'buddypress-media') . ' ' . $media_type;
         } else {
             $count = $like_count - 1;
             $text = $liked_by . ' ' . __('and', 'buddypress-media') . ' ' . $count . ' ' . __('other friends liked your', 'buddypress-media') . ' ' . $media_type;
         }
         $return = apply_filters('rtmedia_before_like_notification', array('link' => $link, 'text' => $text), (int) $total_items);
         if ('string' === $format) {
             return '<a href="' . esc_url($return['link']) . '">' . esc_html($return['text']) . '</a>';
         } else {
             return $return;
         }
     }
 }
示例#4
0
/**
 * Basic keyword substitution routine for welcome message and start page values.
 *
 * @param string $text
 * @param int $user_id
 * @since 2.0
 */
function dpw_do_keyword_replacement($text, $user_id)
{
    // [admin]
    $text = str_replace("USERNAME", bp_core_get_username($user_id), $text);
    // [Admin McAdmin]
    $text = str_replace("NICKNAME", bp_core_get_user_displayname($user_id), $text);
    // http://www.example.com/members/[admin]/
    $text = str_replace("USER_URL", bp_core_get_user_domain($user_id), $text);
    return $text;
}
/**
 * Create a activity item
 * @param $params
 * @return string
 */
function buddystreamCreateActivity($params)
{
    global $bp, $wpdb;
    $buddyStreamExtensions = new BuddyStreamExtensions();
    $buddyStreamFilters = new BuddyStreamFilters();
    /**
     * buddystreamCreateActivity(array(
     *     'user_id'    => $user_meta->user_id,
     *     'extension'  => 'facebook',
     *     'type'       => 'photo',
     *     'content'    => $content,
     *     'item_id'    => $item['id'],
     *     'raw_date'   => $item['created_time'],
     *     'actionlink' => 'url_to_original_item')
     *  ));
     *
     */
    if (is_array($params)) {
        //load config of extension
        $originalText = $params['content'];
        foreach ($buddyStreamExtensions->getExtensionsConfigs() as $extension) {
            if (isset($extension['hashtag'])) {
                $originalText = str_replace($extension['hashtag'], "", $originalText);
                $originalText = trim($originalText);
            }
        }
        //set the content
        $content = "";
        $content = '<div class="buddystream_activity_container ' . $params['extension'] . '">' . $originalText . '</div>';
        if (!buddyStreamCheckImportLog($params['user_id'], $params['item_id'], $params['extension']) && !buddyStreamCheckExistingContent($content) && !buddyStreamCheckExistingContent($originalText)) {
            buddyStreamAddToImportLog($params['user_id'], $params['item_id'], $params['extension']);
            remove_filter('bp_activity_action_before_save', 'bp_activity_filter_kses', 1);
            $activity = new BP_Activity_Activity();
            $activity->user_id = $params['user_id'];
            $activity->component = $params['extension'];
            $activity->type = $params['extension'];
            $activity->content = $content;
            $activity->item_id = $params['item_id'];
            $activity->secondary_item_id = '';
            $activity->date_recorded = $params['raw_date'];
            $activity->hide_sitewide = 0;
            $activity->action .= '<a href="' . bp_core_get_user_domain($params['user_id']) . '" title="' . bp_core_get_username($params['user_id']) . '">' . bp_core_get_user_displayname($params['user_id']) . '</a>';
            $activity->action .= ' ' . __('posted&nbsp;a', 'buddystream_lang') . ' ';
            $activity->action .= '<a href="' . $params['actionlink'] . '" target="_blank" rel="external"> ' . __($params['type'], 'buddystream_' . $extension['name']);
            $activity->action .= '</a>: ';
            $activity->primary_link = $params['actionlink'];
            if (!preg_match("/" . $params['item_id'] . "/i", get_user_meta($params['user_id'], 'buddystream_blacklist_ids', 1))) {
                $activity->save();
                $buddyStreamFilters->updateDayLimitByOne($params['extension'], $params['user_id']);
                return true;
            }
        }
    }
    return false;
}
function bppp_get_caption($user_id = false)
{
    $user_id = bppp_get_user_id($user_id);
    $percent = bppp_get_user_progression_percent($user_id);
    if ($user_id == get_current_user_id()) {
        $caption = sprintf(__("Your Profile is %1d%% complete", "bppp"), $percent);
    } else {
        $caption = sprintf(__("%2s's Profile is %1d%% complete", "bppp"), $percent, bp_core_get_username($user_id));
    }
    return apply_filters('bppp_caption', $caption, $user_id, $percent);
}
 function action_mark_unmark_spammer($successes, $errors, $is_spam)
 {
     $query_arg = $is_spam ? 'marked_spammer' : 'unmarked_spammer';
     $arg_value = count($successes);
     if (1 == $arg_value) {
         //with only one is nicer to display the name
         $username = bp_core_get_username($successes[0]);
         if (is_numeric($username)) {
             $username = "******";
         }
         $arg_value = empty($successes[0]) ? 0 : $username;
     }
     $args = array($query_arg => $arg_value);
     if (!empty($errors)) {
         $args['err_ids'] = join(',', $errors);
     }
     bp_core_redirect(add_query_arg($args, $this->redir));
 }
示例#8
0
 /**
  * get_activity function.
  * 
  * @access public
  * @param mixed $filter
  * @return void
  */
 public function get_activity($filter)
 {
     $args = $filter;
     if (bp_has_activities($args)) {
         while (bp_activities()) {
             bp_the_activity();
             $activity = array('avatar' => bp_core_fetch_avatar(array('html' => false, 'item_id' => bp_get_activity_id())), 'action' => bp_get_activity_action(), 'content' => bp_get_activity_content_body(), 'activity_id' => bp_get_activity_id(), 'activity_username' => bp_core_get_username(bp_get_activity_user_id()), 'user_id' => bp_get_activity_user_id(), 'comment_count' => bp_activity_get_comment_count(), 'can_comment' => bp_activity_can_comment(), 'can_favorite' => bp_activity_can_favorite(), 'is_favorite' => bp_get_activity_is_favorite(), 'can_delete' => bp_activity_user_can_delete());
             $activity = apply_filters('bp_json_prepare_activity', $activity);
             $activities[] = $activity;
         }
         $data = array('activity' => $activities, 'has_more_items' => bp_activity_has_more_items());
         $data = apply_filters('bp_json_prepare_activities', $data);
     } else {
         return new WP_Error('bp_json_activity', __('No Activity Found.', 'buddypress'), array('status' => 200));
     }
     $response = new WP_REST_Response();
     $response->set_data($data);
     $response = rest_ensure_response($response);
     return $response;
 }
/**
 * Allows a user to completely remove their account from the system
 *
 * @package BuddyPress Core
 * @global object $bp Global BuddyPress settings object
 * @uses is_super_admin() Checks to see if the user is a site administrator.
 * @uses wpmu_delete_user() Deletes a user from the system on multisite installs.
 * @uses wp_delete_user() Deletes a user from the system on singlesite installs.
 */
function bp_core_delete_account($user_id = 0)
{
    global $bp, $wp_version;
    if (!$user_id) {
        $user_id = $bp->loggedin_user->id;
    }
    // Make sure account deletion is not disabled
    if (!empty($bp->site_options['bp-disable-account-deletion']) && !$bp->loggedin_user->is_super_admin) {
        return false;
    }
    // Site admins cannot be deleted
    if (is_super_admin(bp_core_get_username($user_id))) {
        return false;
    }
    // Specifically handle multi-site environment
    if (is_multisite()) {
        if ($wp_version >= '3.0') {
            require ABSPATH . '/wp-admin/includes/ms.php';
        } else {
            require ABSPATH . '/wp-admin/includes/mu.php';
        }
        require ABSPATH . '/wp-admin/includes/user.php';
        return wpmu_delete_user($user_id);
        // Single site user deletion
    } else {
        require ABSPATH . '/wp-admin/includes/user.php';
        return wp_delete_user($user_id);
    }
}
function bp_get_loggedin_user_username()
{
    global $bp;
    if (!empty($bp->loggedin_user->id)) {
        $username = bp_core_get_username($bp->loggedin_user->id, $bp->loggedin_user->userdata->user_nicename, $bp->loggedin_user->userdata->user_login);
    } else {
        $username = '';
    }
    return apply_filters('bp_get_loggedin_user_username', $username);
}
/**
 * Members user shortlink redirector.
 *
 * Redirects x.com/members/me/* to x.com/members/{LOGGED_IN_USER_SLUG}/*
 *
 * @since 2.6.0
 *
 * @param string $member_slug The current member slug.
 * @return string $member_slug The current member slug.
 */
function bp_core_members_shortlink_redirector($member_slug)
{
    /**
     * Shortlink slug to redirect to logged-in user.
     *
     * The x.com/members/me/* url will redirect to x.com/members/{LOGGED_IN_USER_SLUG}/*
     *
     * @since 2.6.0
     *
     * @param string $slug Defaults to 'me'.
     */
    $me_slug = apply_filters('bp_core_members_shortlink_slug', 'me');
    // Check if we're on our special shortlink slug. If not, bail.
    if ($me_slug !== $member_slug) {
        return $member_slug;
    }
    // If logged out, redirect user to login.
    if (false === is_user_logged_in()) {
        // Add our login redirector hook.
        add_action('template_redirect', 'bp_core_no_access', 0);
        return $member_slug;
    }
    $user = wp_get_current_user();
    return bp_core_get_username($user->ID, $user->user_nicename, $user->user_login);
}
/**
 * Returns the domain for the passed user: e.g. http://domain.com/members/andy/
 *
 * @package BuddyPress Core
 * @global $current_user WordPress global variable containing current logged in user information
 * @param user_id The ID of the user.
 */
function bp_core_get_user_domain($user_id, $user_nicename = false, $user_login = false)
{
    if (empty($user_id)) {
        return;
    }
    if (!($domain = wp_cache_get('bp_user_domain_' . $user_id, 'bp'))) {
        $username = bp_core_get_username($user_id, $user_nicename, $user_login);
        if (bp_is_username_compatibility_mode()) {
            $username = rawurlencode($username);
        }
        $after_domain = bp_core_enable_root_profiles() ? $username : bp_get_members_root_slug() . '/' . $username;
        $domain = trailingslashit(bp_get_root_domain() . '/' . $after_domain);
        $domain = apply_filters('bp_core_get_user_domain_pre_cache', $domain, $user_id, $user_nicename, $user_login);
        // Cache the link
        if (!empty($domain)) {
            wp_cache_set('bp_user_domain_' . $user_id, $domain, 'bp');
        }
    }
    return apply_filters('bp_core_get_user_domain', $domain, $user_id, $user_nicename, $user_login);
}
示例#13
0
function bp_get_send_private_message_link()
{
    global $bp;
    if (bp_is_my_profile() || !is_user_logged_in()) {
        return false;
    }
    return apply_filters('bp_get_send_private_message_link', nxt_nonce_url($bp->loggedin_user->domain . $bp->messages->slug . '/compose/?r=' . bp_core_get_username($bp->displayed_user->id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login)));
}
/**
 * Generate the URL for the Private Message link in member profile headers.
 *
 * @return bool|string False on failure, otherwise the URL.
 */
function bp_get_send_private_message_link()
{
    if (bp_is_my_profile() || !is_user_logged_in()) {
        return false;
    }
    /**
     * Filters the URL for the Private Message link in member profile headers.
     *
     * @since 1.2.10
     *
     * @param string $value URL for the Private Message link in member profile headers.
     */
    return apply_filters('bp_get_send_private_message_link', wp_nonce_url(bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . bp_core_get_username(bp_displayed_user_id())));
}
示例#15
0
function bebop_create_buffer_item($params)
{
    global $bp, $wpdb;
    if (is_array($params)) {
        if (!bebop_tables::check_existing_content_id($params['user_id'], $params['extension'], $params['item_id'])) {
            $original_text = $params['content'];
            if (!bebop_tables::bebop_check_existing_content_buffer($params['user_id'], $params['extension'], $original_text)) {
                $content = '';
                if ($params['content_oembed'] == true) {
                    $content = $original_text;
                } else {
                    $content = '<div class="bebop_activity_container ' . $params['extension'] . '">' . $original_text . '</div>';
                }
                $action = '<a href="' . bp_core_get_user_domain($params['user_id']) . '" title="' . bp_core_get_username($params['user_id']) . '">' . bp_core_get_user_displayname($params['user_id']) . '</a>';
                $action .= ' ' . __('posted a', 'bebop');
                $action .= '<a href="' . $params['actionlink'] . '" target="_blank" rel="external"> ' . __($params['type'], 'bebop_' . $params['extension']);
                $action .= '</a>: ';
                $date_imported = gmdate('Y-m-d H:i:s', time());
                //extra check to be sure we don't have an empty activity
                $clean_comment = '';
                $clean_comment = trim(strip_tags($content));
                //controls how user content is verified.
                $should_users_verify_content = bebop_tables::get_option_value('bebop_' . $params['extension'] . '_content_user_verification');
                if ($should_users_verify_content == 'no') {
                    $oer_status = 'verified';
                } else {
                    $oer_status = 'unverified';
                }
                $hide_sitewide = bebop_tables::get_option_value('bebop_' . $params['extension'] . '_hide_sitewide');
                if ($hide_sitewide == 'yes') {
                    $oer_hide_sitewide = 1;
                } else {
                    $oer_hide_sitewide = 0;
                }
                if (!empty($clean_comment)) {
                    if (bebop_filters::day_increase($params['extension'], $params['user_id'], $params['username'])) {
                        if ($wpdb->query($wpdb->prepare('INSERT INTO ' . bp_core_get_table_prefix() . 'bp_bebop_oer_manager ( user_id, status, type, action, content, secondary_item_id, date_imported, date_recorded, hide_sitewide ) VALUES ( %s, %s, %s, %s, %s, %s, %s, %s, %s )', $wpdb->escape($params['user_id']), $oer_status, $wpdb->escape($params['extension']), $wpdb->escape($action), $wpdb->escape($content), $wpdb->escape($params['item_id']), $wpdb->escape($date_imported), $wpdb->escape($params['raw_date']), $wpdb->escape($oer_hide_sitewide)))) {
                            $id = $wpdb->insert_id;
                            //if users shouldn't verify content, add it to the activity stream immediately.
                            if ($should_users_verify_content == 'no') {
                                $new_activity_item = array('user_id' => $params['user_id'], 'component' => 'bebop_oer_plugin', 'type' => $params['extension'], 'action' => $action, 'content' => $content, 'item_id' => $id, 'date_recorded' => $date_imported, 'hide_sitewide' => $oer_hide_sitewide);
                                if (bp_activity_add($new_activity_item)) {
                                    bebop_tables::update_oer_data($id, 'activity_stream_id', $activity_stream_id = $wpdb->insert_id);
                                }
                            }
                            return true;
                        } else {
                            bebop_tables::log_error(__('Importer', 'bebop'), __('Import query error', 'bebop'));
                        }
                    } else {
                        bebop_tables::log_error(__('Importer', 'bebop'), __('Could not import as a daycounter could not be found.', 'bebop'));
                    }
                } else {
                    bebop_tables::log_error(__('Importer', 'bebop'), __('Could not import, content already exists.', 'bebop'));
                }
            }
        }
    }
    return false;
}
/**
 * Return the domain for the passed user: e.g. http://example.com/members/andy/.
 *
 * @since 1.0.0
 *
 * @param int         $user_id       The ID of the user.
 * @param string|bool $user_nicename Optional. user_nicename of the user.
 * @param string|bool $user_login    Optional. user_login of the user.
 * @return string
 */
function bp_core_get_user_domain($user_id = 0, $user_nicename = false, $user_login = false)
{
    if (empty($user_id)) {
        return;
    }
    $username = bp_core_get_username($user_id, $user_nicename, $user_login);
    if (bp_is_username_compatibility_mode()) {
        $username = rawurlencode($username);
    }
    $after_domain = bp_core_enable_root_profiles() ? $username : bp_get_members_root_slug() . '/' . $username;
    $domain = trailingslashit(bp_get_root_domain() . '/' . $after_domain);
    // Don't use this filter.  Subject to removal in a future release.
    // Use the 'bp_core_get_user_domain' filter instead.
    $domain = apply_filters('bp_core_get_user_domain_pre_cache', $domain, $user_id, $user_nicename, $user_login);
    /**
     * Filters the domain for the passed user.
     *
     * @since 1.0.1
     *
     * @param string $domain        Domain for the passed user.
     * @param int    $user_id       ID of the passed user.
     * @param string $user_nicename User nicename of the passed user.
     * @param string $user_login    User login of the passed user.
     */
    return apply_filters('bp_core_get_user_domain', $domain, $user_id, $user_nicename, $user_login);
}
示例#17
0
function filter_message_button_link($link)
{
    $link = wp_nonce_url(bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . bp_core_get_username(bp_get_member_user_id()));
    return $link;
}
function bp_get_send_private_message_link()
{
    if (bp_is_my_profile() || !is_user_logged_in()) {
        return false;
    }
    return apply_filters('bp_get_send_private_message_link', wp_nonce_url(bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . bp_core_get_username(bp_displayed_user_id())));
}
示例#19
0
/**
 * Returns the public message link for displayed user
 *
 * @since 1.2.0
 *
 * @global object $bp BuddyPress global settings
 * @uses bp_is_my_profile()
 * @uses is_user_logged_in()
 * @uses nxt_nonce_url()
 * @uses bp_loggedin_user_domain()
 * @uses bp_get_activity_slug()
 * @uses bp_core_get_username()
 * @uses apply_filters() To call the 'bp_get_send_public_message_link' hook
 *
 * @return string The public message link for displayed user
 */
function bp_get_send_public_message_link()
{
    global $bp;
    if (bp_is_my_profile() || !is_user_logged_in()) {
        return false;
    }
    return apply_filters('bp_get_send_public_message_link', nxt_nonce_url(bp_loggedin_user_domain() . bp_get_activity_slug() . '/?r=' . bp_core_get_username($bp->displayed_user->id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login)));
}
/**
 * Add activity notifications settings to the notifications settings page
 *
 * @since BuddyPress (1.2)
 *
 * @uses bp_get_user_meta()
 * @uses bp_core_get_username()
 * @uses do_action() To call the 'bp_activity_screen_notification_settings' hook
 */
function bp_activity_screen_notification_settings()
{
    if (bp_activity_do_mentions()) {
        if (!($mention = bp_get_user_meta(bp_displayed_user_id(), 'notification_activity_new_mention', true))) {
            $mention = 'yes';
        }
    }
    if (!($reply = bp_get_user_meta(bp_displayed_user_id(), 'notification_activity_new_reply', true))) {
        $reply = 'yes';
    }
    ?>

	<table class="notification-settings" id="activity-notification-settings">
		<thead>
			<tr>
				<th class="icon">&nbsp;</th>
				<th class="title"><?php 
    _e('Activity', 'buddypress');
    ?>
</th>
				<th class="yes"><?php 
    _e('Yes', 'buddypress');
    ?>
</th>
				<th class="no"><?php 
    _e('No', 'buddypress');
    ?>
</th>
			</tr>
		</thead>

		<tbody>
			<?php 
    if (bp_activity_do_mentions()) {
        ?>
				<tr id="activity-notification-settings-mentions">
					<td>&nbsp;</td>
					<td><?php 
        printf(__('A member mentions you in an update using "@%s"', 'buddypress'), bp_core_get_username(bp_displayed_user_id()));
        ?>
</td>
					<td class="yes"><input type="radio" name="notifications[notification_activity_new_mention]" value="yes" <?php 
        checked($mention, 'yes', true);
        ?>
/></td>
					<td class="no"><input type="radio" name="notifications[notification_activity_new_mention]" value="no" <?php 
        checked($mention, 'no', true);
        ?>
/></td>
				</tr>
			<?php 
    }
    ?>

			<tr id="activity-notification-settings-replies">
				<td>&nbsp;</td>
				<td><?php 
    _e("A member replies to an update or comment you've posted", 'buddypress');
    ?>
</td>
				<td class="yes"><input type="radio" name="notifications[notification_activity_new_reply]" value="yes" <?php 
    checked($reply, 'yes', true);
    ?>
/></td>
				<td class="no"><input type="radio" name="notifications[notification_activity_new_reply]" value="no" <?php 
    checked($reply, 'no', true);
    ?>
/></td>
			</tr>

			<?php 
    do_action('bp_activity_screen_notification_settings');
    ?>
		</tbody>
	</table>

<?php 
}
 /**
  * new_response_screen( $vars )
  *
  * Hooks into screen_handler
  * Adds a UI to add new responses.
  *
  * @param Array $vars a set of variables received for this screen template
  * @return Array $vars a set of variable passed to this screen template
  */
 function new_response_screen($vars)
 {
     global $bp;
     $nonce_name = 'add_response';
     $form_results = null;
     if (!$this->has_student_caps($bp->loggedin_user->id) && !is_super_admin() || !bp_group_is_member($bp->groups->current_group)) {
         $vars['die'] = __('BuddyPress Courseware Error while forbidden user tried to add a new response.', 'bpsp');
         return $vars;
     }
     // Save new response
     if (isset($_POST['response']) && $this->current_assignment->ID == $_POST['response']['parent_id'] && isset($_POST['_wpnonce'])) {
         $new_response = $_POST['response'];
         $new_response_quiz = !empty($_POST['frmb']) ? $_POST['frmb'] : null;
         $is_nonce = wp_verify_nonce($_POST['_wpnonce'], $nonce_name);
         $response = $this->has_response();
         if (true != $is_nonce) {
             $vars['error'] = __('Nonce Error while adding a response.', 'bpsp');
         }
         if (!empty($response)) {
             $vars['response'] = $response;
             $vars['error'] = __('You already sent your response.', 'bpsp');
             $this->single_response_screen($vars);
         } else {
             if ($new_response_quiz) {
                 $new_response['title'] = bp_core_get_username($bp->loggedin_user->id) . __(' on ', 'bpsp') . $this->current_assignment->post_title;
                 $new_response['content'] = __('Your quiz results: ', 'bpsp');
                 $form_results = $this->check_quiz($new_response_quiz, $this->current_assignment->form_data);
                 $new_response['content'] .= (isset($form_results['correct']) ? $form_results['correct'] : 0) . '/' . $form_results['total'];
             }
             if (isset($new_response['title']) && isset($new_response['content'])) {
                 $new_response['title'] = strip_tags($new_response['title']);
                 $new_response_id = wp_insert_post(array('post_author' => $bp->loggedin_user->id, 'post_title' => $new_response['title'], 'post_content' => $new_response['content'], 'post_status' => 'publish', 'post_type' => 'response', 'post_parent' => $this->current_assignment->ID));
                 if ($new_response_id) {
                     // Save author id in assignment post_meta so we don't have to query it all over
                     add_post_meta($this->current_assignment->ID, 'responded_author', $bp->loggedin_user->id);
                     add_post_meta($new_response_id, 'form_values', $form_results);
                     $vars = $this->single_response_screen($vars);
                     // Leave this for imediate results preview
                     $vars['response']->form_values = $form_results;
                     if (!$this->group_responses_status()) {
                         $vars['public'] = true;
                     }
                     do_action('courseware_response_added', $vars);
                     $vars['message'] = __('New response was added.', 'bpsp');
                     return $vars;
                 } else {
                     $vars['error'] = __('New response could not be added (fill the title/content).', 'bpsp');
                 }
             }
         }
     }
     $vars['name'] = 'add_response';
     $vars['parent_assignment'] = $this->current_assignment;
     $vars['user_id'] = $bp->loggedin_user->id;
     $vars['nonce'] = wp_nonce_field($nonce_name, '_wpnonce', true, false);
     $vars['trail'] = array($this->current_assignment->lecture->post_title => $this->current_assignment->lecture->permalink, $this->current_assignment->post_title => $this->current_assignment->permalink, __('New Response', 'bpsp') => '');
     return $vars;
 }
示例#22
0
 /**
  * Prints HTML with meta information for current post: categories, tags, permalink, author, and date.
  * Create your own kleo_entry_meta() to override in a child theme.
  * @since 1.0
  */
 function kleo_entry_meta($echo = true, $att = array())
 {
     global $kleo_config;
     $meta_list = array();
     $author_links = '';
     $meta_elements = sq_option('blog_meta_elements', $kleo_config['blog_meta_defaults']);
     // Translators: used between list items, there is a space after the comma.
     if (in_array('categories', $meta_elements)) {
         $categories_list = get_the_category_list(__(', ', 'kleo_framework'));
     }
     // Translators: used between list items, there is a space after the comma.
     if (in_array('tags', $meta_elements)) {
         $tag_list = get_the_tag_list('', __(', ', 'kleo_framework'));
     }
     $date = sprintf('<a href="%1$s" rel="bookmark" class="post-time">' . '<time class="entry-date" datetime="%2$s">%3$s</time>' . '<time class="modify-date hide hidden updated" datetime="%4$s">%5$s</time>' . '</a>', esc_url(get_permalink()), esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_html(get_the_modified_date('c')), esc_html(get_the_modified_date()));
     if (is_array($meta_elements) && !empty($meta_elements)) {
         if (in_array('author_link', $meta_elements) || in_array('avatar', $meta_elements)) {
             /* If buddypress is active then create a link to Buddypress profile instead */
             if (function_exists('bp_is_active')) {
                 $author_link = esc_url(bp_core_get_userlink(get_the_author_meta('ID'), $no_anchor = false, $just_link = true));
                 $author_title = esc_attr(sprintf(__('View %s\'s profile', 'kleo_framework'), get_the_author()));
             } else {
                 $author_link = esc_url(get_author_posts_url(get_the_author_meta('ID')));
                 $author_title = esc_attr(sprintf(__('View all POSTS by %s', 'kleo_framework'), get_the_author()));
             }
             $author = sprintf('<a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s %4$s</a>', $author_link, $author_title, in_array('avatar', $meta_elements) ? get_avatar(get_the_author_meta('ID'), 50) : '', in_array('author_link', $meta_elements) ? '<span class="author-name">' . get_the_author() . '</span>' : '');
             $meta_list[] = '<small class="meta-author author vcard">' . $author . '</small>';
         }
         if (function_exists('bp_is_active')) {
             if (in_array('profile', $meta_elements)) {
                 $author_links .= '<a href="' . bp_core_get_userlink(get_the_author_meta('ID'), $no_anchor = false, $just_link = true) . '">' . '<i class="icon-user-1 hover-tip" ' . 'data-original-title="' . esc_attr(sprintf(__('View profile', 'kleo_framework'), get_the_author())) . '"' . 'data-toggle="tooltip"' . 'data-placement="top"></i>' . '</a>';
             }
             if (bp_is_active('messages')) {
                 if (in_array('message', $meta_elements)) {
                     $author_links .= '<a href="' . wp_nonce_url(bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . bp_core_get_username(get_the_author_meta('ID'))) . '">' . '<i class="icon-mail hover-tip" ' . 'data-original-title="' . esc_attr(sprintf(__('Contact %s', 'kleo_framework'), get_the_author())) . '" ' . 'data-toggle="tooltip" ' . 'data-placement="top"></i>' . '</a>';
                 }
             }
         }
         if (in_array('archive', $meta_elements)) {
             $author_links .= '<a href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . '<i class="icon-docs hover-tip" ' . 'data-original-title="' . esc_attr(sprintf(__('View all posts by %s', 'kleo_framework'), get_the_author())) . '" ' . 'data-toggle="tooltip" ' . 'data-placement="top"></i>' . '</a>';
         }
     }
     if ($author_links != '') {
         $meta_list[] = '<small class="meta-links">' . $author_links . '</small>';
     }
     if (in_array('date', $meta_elements)) {
         $meta_list[] = '<small>' . $date . '</small>';
     }
     $cat_tag = array();
     if (isset($categories_list) && $categories_list) {
         $cat_tag[] = $categories_list;
     }
     if (isset($tag_list) && $tag_list) {
         $cat_tag[] = $tag_list;
     }
     if (!empty($cat_tag)) {
         $meta_list[] = '<small class="meta-category">' . implode(", ", $cat_tag) . '</small>';
     }
     //comments
     if ((!isset($att['comments']) || isset($att['comments']) && $att['comments'] !== false) && in_array('comments', $meta_elements)) {
         $meta_list[] = '<small class="meta-comment-count"><a href="' . get_permalink() . '#comments">' . get_comments_number() . ' <i class="icon-chat-1 hover-tip" ' . 'data-original-title="' . sprintf(_n('This article has one comment', 'This article has %1$s comments', get_comments_number(), 'kleo_framework'), number_format_i18n(get_comments_number())) . '" ' . 'data-toggle="tooltip" ' . 'data-placement="top"></i>' . '</a></small>';
     }
     $meta_separator = isset($att['separator']) ? $att['separator'] : sq_option('blog_meta_sep', ', ');
     if ($echo) {
         echo implode($meta_separator, $meta_list);
     } else {
         return implode($meta_separator, $meta_list);
     }
 }
/**
 * Gets the avatar of the owner
 *
 * @param int $user_id the user id
 * @param string $width the width of the avatar
 * @param string $height the height of the avatar
 * @uses buddydrive_get_owner_id() to get the user id
 * @uses bp_core_get_username() to get the username of the owner
 * @uses bp_core_fetch_avatar() to get the avatar of the owner
 * @return string avatar of the owner
 */
function buddydrive_get_show_owner_avatar($user_id = false, $width = '32', $height = '32')
{
    if (empty($user_id)) {
        $user_id = buddydrive_get_owner_id();
    }
    $username = bp_core_get_username($user_id);
    $avatar = bp_core_fetch_avatar(array('item_id' => $user_id, 'object' => 'user', 'type' => 'thumb', 'avatar_dir' => 'avatars', 'alt' => sprintf(__('User Avatar of %s', 'buddydrive'), $username), 'width' => $width, 'height' => $height, 'title' => $username));
    return apply_filters('buddydrive_get_show_owner_avatar', $avatar, $user_id, $username);
}
示例#24
0
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	<?php do_action('bp_activity_mentions_feed'); ?>
>

<channel>
	<title><?php echo bp_site_name() ?> | <?php echo $bp->displayed_user->fullname; ?> | <?php _e( 'Mentions', 'buddypress' ) ?></title>
	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
	<link><?php echo site_url( BP_ACTIVITY_SLUG . '/#mentions/' ) ?></link>
	<description><?php echo $bp->displayed_user->fullname; ?> - <?php _e( 'Mentions', 'buddypress' ) ?></description>
	<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
	<generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
	<language><?php echo get_option('rss_language'); ?></language>
	<?php do_action('bp_activity_mentions_feed_head'); ?>

	<?php if ( bp_has_activities( 'max=50&display_comments=stream&search_terms=@' . bp_core_get_username( $bp->displayed_user->id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login ) ) ) : ?>
		<?php while ( bp_activities() ) : bp_the_activity(); ?>
			<item>
				<guid><?php bp_activity_thread_permalink() ?></guid>
				<title><![CDATA[<?php bp_activity_feed_item_title() ?>]]></title>
				<link><?php echo bp_activity_thread_permalink() ?></link>
				<pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>

				<description>
					<![CDATA[
					<?php bp_activity_feed_item_description() ?>

					<?php if ( bp_activity_can_comment() ) : ?>
						<p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
					<?php endif; ?>
/**
 * Get the username of the logged-in user.
 *
 * @return string
 */
function bp_get_loggedin_user_username()
{
    $bp = buddypress();
    if (bp_loggedin_user_id()) {
        $username = bp_core_get_username(bp_loggedin_user_id(), $bp->loggedin_user->userdata->user_nicename, $bp->loggedin_user->userdata->user_login);
    } else {
        $username = '';
    }
    /**
     * Filters the username of the logged-in user.
     *
     * @since 1.2.0
     *
     * @param string $username Username of the logged-in user.
     */
    return apply_filters('bp_get_loggedin_user_username', $username);
}
/**
 * Load a user's @mentions feed.
 *
 * @since 1.2.0
 *
 * @uses bp_is_user_activity()
 * @uses bp_is_current_action()
 * @uses bp_is_action_variable()
 * @uses status_header()
 *
 * @return bool False on failure.
 */
function bp_activity_action_mentions_feed()
{
    if (!bp_activity_do_mentions()) {
        return false;
    }
    if (!bp_is_user_activity() || !bp_is_current_action('mentions') || !bp_is_action_variable('feed', 0)) {
        return false;
    }
    // Setup the feed.
    buddypress()->activity->feed = new BP_Activity_Feed(array('id' => 'mentions', 'title' => sprintf(__('%1$s | %2$s | Mentions', 'buddypress'), bp_get_site_name(), bp_get_displayed_user_fullname()), 'link' => bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions/', 'description' => sprintf(__("Activity feed mentioning %s.", 'buddypress'), bp_get_displayed_user_fullname()), 'activity_args' => array('search_terms' => '@' . bp_core_get_username(bp_displayed_user_id()))));
}
示例#27
0
/**
 * Return the domain for the passed user: e.g. http://domain.com/members/andy/.
 *
 * @param int $user_id The ID of the user.
 * @param string $user_nicename Optional. user_nicename of the user.
 * @param string $user_login Optional. user_login of the user.
 */
function bp_core_get_user_domain($user_id = 0, $user_nicename = false, $user_login = false)
{
    if (empty($user_id)) {
        return;
    }
    $username = bp_core_get_username($user_id, $user_nicename, $user_login);
    if (bp_is_username_compatibility_mode()) {
        $username = rawurlencode($username);
    }
    $after_domain = bp_core_enable_root_profiles() ? $username : bp_get_members_root_slug() . '/' . $username;
    $domain = trailingslashit(bp_get_root_domain() . '/' . $after_domain);
    // Don't use this filter.  Subject to removal in a future release.
    // Use the 'bp_core_get_user_domain' filter instead.
    $domain = apply_filters('bp_core_get_user_domain_pre_cache', $domain, $user_id, $user_nicename, $user_login);
    return apply_filters('bp_core_get_user_domain', $domain, $user_id, $user_nicename, $user_login);
}
示例#28
0
 function wplms_download_mod_stats()
 {
     $id = $_POST['id'];
     $post_type = $_POST['type'];
     if (!isset($_POST['security']) || !wp_verify_nonce($_POST['security'], 'security')) {
         echo __('Security check failed !', 'vibe');
         die;
     }
     if (!current_user_can('edit_posts') || !is_numeric($id)) {
         echo __('User does not have capability to download stats !', 'vibe');
         die;
     }
     $fields = json_decode(stripslashes($_POST['fields']));
     $type = stripslashes($_POST['select']);
     if (!isset($type)) {
         die;
     }
     $users = array();
     $csv = array();
     $csv_title = array();
     global $wpdb, $bp;
     if (in_array($post_type, array('quiz', 'wplms-assignment'))) {
         switch ($type) {
             case 'all_students':
                 $users = $wpdb->get_results($wpdb->prepare("SELECT meta_key as user_id FROM {$wpdb->postmeta} WHERE post_id = %d AND meta_key REGEXP '^[0-9]+\$' AND meta_value REGEXP '^[0-9]+\$'", $id), ARRAY_A);
                 break;
             case 'finished_students':
                 $users = $wpdb->get_results($wpdb->prepare("SELECT meta_key as user_id FROM {$wpdb->postmeta} WHERE post_id = %d AND meta_value REGEXP '^[0-9]+\$'  AND meta_key IN (SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key = %d AND meta_value < %d)", $id, 0, $id, time()), ARRAY_A);
                 break;
         }
     }
     if ($post_type == 'question') {
         $users = $wpdb->get_results($wpdb->prepare("SELECT user_id as user_id FROM {$wpdb->comments} WHERE comment_post_ID = %d AND comment_approved = %d", $id, 1), ARRAY_A);
     }
     if (count($users)) {
         foreach ($users as $user) {
             if (is_numeric($user['user_id']) && $user['user_id']) {
                 $user_id = $user['user_id'];
                 $i = 0;
                 foreach ($fields as $k => $field) {
                     switch ($field) {
                         case 'stats_student_start_date':
                             $title = __('START DATE', 'vibe');
                             if (!in_array($title, $csv_title)) {
                                 $csv_title[$i] = $title;
                             }
                             if (in_array($post_type, array('quiz', 'wplms-assignment'))) {
                                 $dtype = 'start_' . $post_type;
                                 if ($post_type == 'wplms-assignment') {
                                     $dtype = 'assignment_started';
                                 }
                                 $date = $wpdb->get_results($wpdb->prepare("SELECT date_recorded FROM {$bp->activity->table_name} WHERE type=%s AND user_id = %d and item_id = %d", $dtype, $user_id, $id));
                             } else {
                                 if ($post_type == 'question') {
                                     $date = $wpdb->get_results($wpdb->prepare("SELECT comment_date as date_recorded FROM {$wpdb->comments} WHERE comment_approved= %d AND user_id = %d and comment_post_ID = %d", 1, $user_id, $id));
                                 }
                             }
                             if (is_array($date) && is_object($date[0]) && isset($date[0]->date_recorded)) {
                                 $csv[$i][] = $date[0]->date_recorded;
                             } else {
                                 $csv[$i][] = __('N.A', 'vibe');
                             }
                             break;
                         case 'stats_student_finish_date':
                             $title = __('COMPLETION DATE', 'vibe');
                             if (!in_array($title, $csv_title)) {
                                 $csv_title[$i] = $title;
                             }
                             if (in_array($post_type, array('quiz', 'wplms-assignment'))) {
                                 $dtype = 'submit_' . $post_type;
                                 if ($post_type == 'wplms-assignment') {
                                     $dtype = 'assignment_submitted';
                                 }
                                 $date = $wpdb->get_results($wpdb->prepare("SELECT date_recorded FROM {$bp->activity->table_name} WHERE type=%s AND user_id = %d and item_id = %d", $dtype, $user_id, $id));
                             } else {
                                 if ($post_type == 'question') {
                                     $date = $wpdb->get_results($wpdb->prepare("SELECT comment_date as date_recorded FROM {$wpdb->comments} WHERE comment_approved= %d AND user_id = %d and comment_post_ID = %d", 1, $user_id, $id));
                                 }
                             }
                             if (is_array($date) && is_object($date[0]) && isset($date[0]->date_recorded)) {
                                 $csv[$i][] = $date[0]->date_recorded;
                             } else {
                                 $csv[$i][] = __('N.A', 'vibe');
                             }
                             break;
                         case 'stats_student_id':
                             $title = __('ID', 'vibe');
                             if (!in_array($title, $csv_title)) {
                                 $csv_title[$i] = $title;
                             }
                             $csv[$i][] = $user_id;
                             break;
                         case 'stats_student_name':
                             $title = __('NAME', 'vibe');
                             if (!in_array($title, $csv_title)) {
                                 $csv_title[$i] = $title;
                             }
                             $csv[$i][] = bp_core_get_username($user_id);
                             break;
                         case 'stats_question_scores':
                             $quiz_dynamic = get_post_meta($id, 'vibe_quiz_dynamic', true);
                             if (!vibe_validate($quiz_dynamic)) {
                                 $questions = vibe_sanitize(get_post_meta($id, 'vibe_quiz_questions', true));
                                 $i_bkup = $i;
                                 if (is_array($questions) && is_array($questions['ques'])) {
                                     foreach ($questions['ques'] as $m => $question) {
                                         $title = get_the_title($question) . ' (' . $questions['marks'][$m] . ') ';
                                         if (!in_array($title, $csv_title)) {
                                             $csv_title[$i_bkup] = $title;
                                             $i_bkup++;
                                         }
                                     }
                                     foreach ($questions['ques'] as $m => $question) {
                                         $marks = $wpdb->get_results($wpdb->prepare("SELECT meta_value as score FROM {$wpdb->commentmeta} WHERE meta_key = %s AND comment_id IN ( SELECT comment_ID FROM {$wpdb->comments} WHERE comment_approved= %d AND user_id = %d and comment_post_ID = %d )", 'marks', 1, $user_id, $id));
                                         if (isset($marks) && is_array($marks) && is_object($marks[0]) && isset($marks[0]->score)) {
                                             $csv[$i][] = $marks[0]->score;
                                         } else {
                                             $csv[$i][] = 0;
                                         }
                                     }
                                 }
                             }
                             break;
                         case 'stats_student_marks':
                             $title = __('SCORE', 'vibe');
                             if (!in_array($title, $csv_title)) {
                                 $csv_title[$i] = $title;
                             }
                             if (in_array($post_type, array('quiz', 'wplms-assignment'))) {
                                 $score = get_post_meta($id, $user_id, true);
                                 $csv[$i][] = $score;
                             } else {
                                 if ($post_type == 'question') {
                                     $marks = $wpdb->get_results($wpdb->prepare("SELECT meta_value as score FROM {$wpdb->commentmeta} WHERE meta_key = %s AND comment_id IN ( SELECT comment_ID FROM {$wpdb->comments} WHERE comment_approved= %d AND user_id = %d and comment_post_ID = %d )", 'marks', 1, $user_id, $id));
                                     if (isset($marks) && is_array($marks) && is_object($marks[0]) && isset($marks[0]->score)) {
                                         $csv[$i][] = $marks[0]->score;
                                     } else {
                                         $csv[$i][] = 0;
                                     }
                                 }
                             }
                             break;
                         default:
                             do_action_ref_array('wplms_mod_stats_process', array(&$csv_title, &$csv, &$i, &$id, &$user_id, &$field, &$post_type));
                             break;
                     }
                     $i++;
                 }
             }
         }
     }
     $dir = wp_upload_dir();
     $user_id = get_current_user_id();
     $file_name = 'download_' . $id . '_' . $user_id . '.csv';
     $filepath = $dir['basedir'] . '/stats/';
     if (!file_exists($filepath)) {
         mkdir($filepath, 0755);
     }
     $file = $filepath . $file_name;
     if (file_exists($file)) {
         unlink($file);
     }
     if (($handle = fopen($file, "w")) !== FALSE) {
         fputcsv($handle, $csv_title);
         $rows = count($csv[0]);
         for ($i = 0; $i < $rows; $i++) {
             $arr = array();
             foreach ($csv as $key => $f) {
                 $arr[] = $f[$i];
             }
             fputcsv($handle, $arr);
         }
     }
     fclose($handle);
     //$query=$wpdb->prepare("SELECT * INTO OUTFILE %s FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\n' FROM {$wpdb->postmeta} WHERE post_id = %d AND meta_key REGEXP '^[0-9]+$' AND meta_value REGEXP '^[0-9]+$'",$file,$course_id);
     //$check = $wpdb->get_results($query);
     //print_r($check);
     $file_url = $dir['baseurl'] . '/stats/' . $file_name;
     echo $file_url;
     die;
 }
/**
 * Add activity notifications settings to the notifications settings page.
 *
 * @since 1.2.0
 *
 * @uses bp_get_user_meta()
 * @uses bp_core_get_username()
 * @uses do_action() To call the 'bp_activity_screen_notification_settings' hook.
 */
function bp_activity_screen_notification_settings()
{
    if (bp_activity_do_mentions()) {
        if (!($mention = bp_get_user_meta(bp_displayed_user_id(), 'notification_activity_new_mention', true))) {
            $mention = 'yes';
        }
    }
    if (!($reply = bp_get_user_meta(bp_displayed_user_id(), 'notification_activity_new_reply', true))) {
        $reply = 'yes';
    }
    ?>

	<table class="notification-settings" id="activity-notification-settings">
		<thead>
			<tr>
				<th class="icon">&nbsp;</th>
				<th class="title"><?php 
    _e('Activity', 'buddypress');
    ?>
</th>
				<th class="yes"><?php 
    _e('Yes', 'buddypress');
    ?>
</th>
				<th class="no"><?php 
    _e('No', 'buddypress');
    ?>
</th>
			</tr>
		</thead>

		<tbody>
			<?php 
    if (bp_activity_do_mentions()) {
        ?>
				<tr id="activity-notification-settings-mentions">
					<td>&nbsp;</td>
					<td><?php 
        printf(__('A member mentions you in an update using "@%s"', 'buddypress'), bp_core_get_username(bp_displayed_user_id()));
        ?>
</td>
					<td class="yes"><input type="radio" name="notifications[notification_activity_new_mention]" id="notification-activity-new-mention-yes" value="yes" <?php 
        checked($mention, 'yes', true);
        ?>
/><label for="notification-activity-new-mention-yes" class="bp-screen-reader-text"><?php 
        _e('Yes, send email', 'buddypress');
        ?>
</label></td>
					<td class="no"><input type="radio" name="notifications[notification_activity_new_mention]" id="notification-activity-new-mention-no" value="no" <?php 
        checked($mention, 'no', true);
        ?>
/><label for="notification-activity-new-mention-no" class="bp-screen-reader-text"><?php 
        _e('No, do not send email', 'buddypress');
        ?>
</label></td>
				</tr>
			<?php 
    }
    ?>

			<tr id="activity-notification-settings-replies">
				<td>&nbsp;</td>
				<td><?php 
    _e("A member replies to an update or comment you've posted", 'buddypress');
    ?>
</td>
				<td class="yes"><input type="radio" name="notifications[notification_activity_new_reply]" id="notification-activity-new-reply-yes" value="yes" <?php 
    checked($reply, 'yes', true);
    ?>
/><label for="notification-activity-new-reply-yes" class="bp-screen-reader-text"><?php 
    _e('Yes, send email', 'buddypress');
    ?>
</label></td>
				<td class="no"><input type="radio" name="notifications[notification_activity_new_reply]" id="notification-activity-new-reply-no" value="no" <?php 
    checked($reply, 'no', true);
    ?>
/><label for="notification-activity-new-reply-no" class="bp-screen-reader-text"><?php 
    _e('No, do not send email', 'buddypress');
    ?>
</label></td>
			</tr>

			<?php 
    /**
     * Fires inside the closing </tbody> tag for activity screen notification settings.
     *
     * @since 1.2.0
     */
    do_action('bp_activity_screen_notification_settings');
    ?>
		</tbody>
	</table>

<?php 
}
示例#30
0
 function show_message_icon($meta, $instructor_id)
 {
     if (is_numeric($instructor_id) && is_singular('course') && is_user_logged_in()) {
         $meta .= '<ul class="instructor_meta">';
         if (is_user_logged_in()) {
             $user_id = get_current_user_id();
             if ($user_id != $instructor_id && function_exists('bp_get_messages_slug')) {
                 $link = wp_nonce_url(bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . bp_core_get_username($instructor_id));
                 $meta .= '<li><a href="' . $link . '" class="button tip" title="' . __('Send Message', 'vibe-customtypes') . '"><i class="icon-email"></i></a></li>';
             }
         }
         $user_info = get_userdata($instructor_id);
         $meta .= '<li><a href="mailto:' . $user_info->user_email . '" class="button tip" title="' . __('Send Email', 'vibe-customtypes') . '"><i class="icon-at-email"></i></a></li>';
         $meta .= '</ul>';
     }
     return $meta;
 }