当前位置: 首页>>代码示例>>PHP>>正文


PHP bp_core_get_username函数代码示例

本文整理汇总了PHP中bp_core_get_username函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_core_get_username函数的具体用法?PHP bp_core_get_username怎么用?PHP bp_core_get_username使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bp_core_get_username函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: format_like_notifications

 /**
  * 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;
     }
 }
开发者ID:quyip8818,项目名称:wps,代码行数:37,代码来源:RTMediaLikeNotification.php

示例2: format_comment_notifications

 /**
  * 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;
     }
 }
开发者ID:fs-contributor,项目名称:rtMedia,代码行数:30,代码来源:RTMediaCommentNotification.php

示例3: format_like_notifications

 /**
  * 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;
         }
     }
 }
开发者ID:rtCamp,项目名称:rtMedia,代码行数:40,代码来源:RTMediaLikeNotification.php

示例4: dpw_do_keyword_replacement

/**
 * 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;
}
开发者ID:hscale,项目名称:webento,代码行数:17,代码来源:welcome-pack-filters.php

示例5: buddystreamCreateActivity

/**
 * 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;
}
开发者ID:BonoboDesigns,项目名称:buddystream,代码行数:60,代码来源:BuddyStreamCore.php

示例6: bppp_get_caption

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);
}
开发者ID:NitinPrakash,项目名称:buddypress-force-profile-completion,代码行数:11,代码来源:buddypress_force_profile_completion_template.php

示例7: action_mark_unmark_spammer

 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 = "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));
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:18,代码来源:bpModBackendActions.php

示例8: get_activity

 /**
  * 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;
 }
开发者ID:Ritesh-patel,项目名称:BP-API,代码行数:27,代码来源:bp-api-activity.php

示例9: bp_core_delete_account

/**
 * 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);
    }
}
开发者ID:hornetalcala,项目名称:trunk,代码行数:38,代码来源:bp-members-functions.php

示例10: bp_get_loggedin_user_username

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);
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:10,代码来源:bp-members-template.php

示例11: bp_core_members_shortlink_redirector

/**
 * 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);
}
开发者ID:buddypress,项目名称:BuddyPress-build,代码行数:35,代码来源:bp-core-catchuri.php

示例12: bp_core_get_user_domain

/**
 * 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);
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:27,代码来源:bp-members-functions.php

示例13: bp_get_send_private_message_link

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)));
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:8,代码来源:bp-messages-template.php

示例14: bp_get_send_private_message_link

/**
 * 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())));
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:19,代码来源:bp-messages-template.php

示例15: bebop_create_buffer_item

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;
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:60,代码来源:bebop-core.php


注:本文中的bp_core_get_username函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。