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


PHP bp_loggedin_user_id函数代码示例

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


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

示例1: get_follow_button

/**
 * Follow button
 */
function get_follow_button()
{
    if (bp_follow_is_following(array('leader_id' => get_the_author_meta('ID'), 'follower_id' => bp_loggedin_user_id()))) {
        $link_text = __('Unfollow', 'artgorae');
    } else {
        $link_text = __('Follow', 'artgorae');
    }
    $args = array('leader_id' => get_the_author_meta('ID'), 'follower_id' => bp_loggedin_user_id(), 'link_text' => $link_text, 'link_class' => 'button alt', 'wrapper' => '');
    echo bp_follow_get_add_follow_button($args);
}
开发者ID:Artgorae,项目名称:wp-artgorae,代码行数:13,代码来源:functions.php

示例2: bp_follow_blogs_add_activity_scope_filter

/**
 * Filter the activity loop.
 *
 * Specifically, when on the activity directory and clicking on the "Followed
 * Sites" tab.
 *
 * @param str $qs The querystring for the BP loop
 * @param str $object The current object for the querystring
 * @return str Modified querystring
 */
function bp_follow_blogs_add_activity_scope_filter($qs, $object)
{
    // not on the blogs object? stop now!
    if ($object != 'activity') {
        return $qs;
    }
    // parse querystring into an array
    $r = wp_parse_args($qs);
    if (bp_is_current_action(constant('BP_FOLLOW_BLOGS_USER_ACTIVITY_SLUG'))) {
        $r['scope'] = 'followblogs';
    }
    if (!isset($r['scope'])) {
        return $qs;
    }
    if ('followblogs' !== $r['scope']) {
        return $qs;
    }
    // get blog IDs that the user is following
    $following_ids = bp_get_following_ids(array('user_id' => bp_displayed_user_id() ? bp_displayed_user_id() : bp_loggedin_user_id(), 'follow_type' => 'blogs'));
    // if $following_ids is empty, pass a negative number so no blogs can be found
    $following_ids = empty($following_ids) ? -1 : $following_ids;
    $args = array('user_id' => 0, 'object' => 'blogs', 'primary_id' => $following_ids);
    // make sure we add a separator if we have an existing querystring
    if (!empty($qs)) {
        $qs .= '&';
    }
    // add our follow parameters to the end of the querystring
    $qs .= build_query($args);
    // support BP Groupblog
    // We need to filter the WHERE SQL conditions to do this
    if (function_exists('bp_groupblog_init')) {
        add_filter('bp_activity_get_where_conditions', 'bp_follow_blogs_groupblog_activity_where_conditions', 10, 2);
    }
    return $qs;
}
开发者ID:wesavetheworld,项目名称:buddypress-followers,代码行数:45,代码来源:blogs-backpat.php

示例3: upload_dir_filter

 /**
  * Set the directory when uploading a file.
  *
  * @since 2.4.0
  *
  * @param array $upload_dir The original Uploads dir.
  * @return array $value Upload data (path, url, basedir...).
  */
 public function upload_dir_filter($upload_dir = array())
 {
     // Default values are for profiles.
     $object_id = bp_displayed_user_id();
     if (empty($object_id)) {
         $object_id = bp_loggedin_user_id();
     }
     $object_directory = 'members';
     // We're in a group, edit default values.
     if (bp_is_group() || bp_is_group_create()) {
         $object_id = bp_get_current_group_id();
         $object_directory = 'groups';
     }
     // Set the subdir.
     $subdir = '/' . $object_directory . '/' . $object_id . '/cover-image';
     /**
      * Filters the cover image upload directory.
      *
      * @since 2.4.0
      *
      * @param array $value      Array containing the path, URL, and other helpful settings.
      * @param array $upload_dir The original Uploads dir.
      */
     return apply_filters('bp_attachments_cover_image_upload_dir', array('path' => $this->upload_path . $subdir, 'url' => $this->url . $subdir, 'subdir' => $subdir, 'basedir' => $this->upload_path, 'baseurl' => $this->url, 'error' => false), $upload_dir);
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:33,代码来源:class-bp-attachment-cover-image.php

示例4: bp_follow_add_activity_scope_filter

/**
 * Filter the activity loop when we're on a "Following" page
 *
 * This is done:
 *   - On the activity directory and clicking on the "Following" tab
 *   - On a user's "Activity > Following" page
 *
 * @since 1.0.0
 *
 * @param string|array Current activity querystring
 * @param string $object The current object or component
 * @return array
 */
function bp_follow_add_activity_scope_filter($qs, $object)
{
    global $bp;
    // not on the activity object? stop now!
    if ($object != 'activity') {
        return $qs;
    }
    $set = false;
    // activity directory
    // can't use bp_is_activity_directory() yet since that's a BP 2.0 function
    if (!bp_displayed_user_id() && bp_is_activity_component() && !bp_current_action()) {
        // check if activity scope is following before manipulating
        if (isset($_COOKIE['bp-activity-scope']) && 'following' === $_COOKIE['bp-activity-scope']) {
            $set = true;
        }
        // user's activity following page
    } elseif (bp_is_user_activity() && bp_is_current_action('following')) {
        $set = true;
    }
    // not on a user page? stop now!
    if (!$set) {
        return $qs;
    }
    // set internal marker noting that our activity scope is applied
    $bp->follow->activity_scope_set = 1;
    $qs = wp_parse_args($qs);
    $following_ids = bp_get_following_ids(array('user_id' => bp_displayed_user_id() ? bp_displayed_user_id() : bp_loggedin_user_id()));
    // if $following_ids is empty, pass a negative number so no activity can be found
    $following_ids = empty($following_ids) ? -1 : $following_ids;
    $qs['user_id'] = $following_ids;
    return apply_filters('bp_follow_add_activity_scope_filter', $qs, false);
}
开发者ID:wesavetheworld,项目名称:buddypress-followers,代码行数:45,代码来源:activity-scope.php

示例5: bcg_current_user_can_post

/**
 * Can the current user post to group blog
 * @global type $bp
 * @return type 
 */
function bcg_current_user_can_post()
{
    $user_id = bp_loggedin_user_id();
    $group_id = bp_get_current_group_id();
    $can_post = is_user_logged_in() && (groups_is_user_admin($user_id, $group_id) || groups_is_user_mod($user_id, $group_id));
    return apply_filters('bcg_current_user_can_post', $can_post, $group_id, $user_id);
}
开发者ID:WP--plugins,项目名称:blog-categories-for-groups,代码行数:12,代码来源:bcg-permissions.php

示例6: friends_action_remove_friend

/**
 * Catch and process Remove Friendship requests.
 *
 * @since 1.0.1
 */
function friends_action_remove_friend()
{
    if (!bp_is_friends_component() || !bp_is_current_action('remove-friend')) {
        return false;
    }
    if (!($potential_friend_id = (int) bp_action_variable(0))) {
        return false;
    }
    if ($potential_friend_id == bp_loggedin_user_id()) {
        return false;
    }
    $friendship_status = BP_Friends_Friendship::check_is_friend(bp_loggedin_user_id(), $potential_friend_id);
    if ('is_friend' == $friendship_status) {
        if (!check_admin_referer('friends_remove_friend')) {
            return false;
        }
        if (!friends_remove_friend(bp_loggedin_user_id(), $potential_friend_id)) {
            bp_core_add_message(__('Friendship could not be canceled.', 'buddypress'), 'error');
        } else {
            bp_core_add_message(__('Friendship canceled', 'buddypress'));
        }
    } elseif ('is_friends' == $friendship_status) {
        bp_core_add_message(__('You are not yet friends with this user', 'buddypress'), 'error');
    } else {
        bp_core_add_message(__('You have a pending friendship request with this user', 'buddypress'), 'error');
    }
    bp_core_redirect(wp_get_referer());
    return false;
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:34,代码来源:bp-friends-actions.php

示例7: bp_media_show_upload_form_multiple

function bp_media_show_upload_form_multiple()
{
    global $bp, $bp_media_default_excerpts;
    ?>
<div id="bp-media-album-prompt" title="Select Album"><select id="bp-media-selected-album"><?php 
    $albums = new WP_Query(array('post_type' => 'bp_media_album', 'posts_per_page' => -1, 'author' => get_current_user_id()));
    if (isset($albums->posts) && is_array($albums->posts) && count($albums->posts) > 0) {
        foreach ($albums->posts as $album) {
            if ($album->post_title == 'Wall Posts') {
                echo '<option value="' . $album->ID . '" selected="selected">' . $album->post_title . '</option>';
            } else {
                echo '<option value="' . $album->ID . '">' . $album->post_title . '</option>';
            }
        }
    } else {
        $album = new BP_Media_Album();
        $album->add_album('Wall Posts', bp_loggedin_user_id());
        echo '<option value="' . $album->get_id() . '" selected="selected">' . $album->get_title() . '</option>';
    }
    ?>
</select></div>
<div id="bp-media-album-new" title="Create New Album"><label for="bp_media_album_name">Album Name</label><input id="bp_media_album_name" type="text" name="bp_media_album_name" /></div>
<div id="bp-media-upload-ui" class="hide-if-no-js drag-drop">
	<div id="drag-drop-area">
		<div class="drag-drop-inside">
		<p class="drag-drop-info">Drop files here</p>
		<p>or</p>
		<p class="drag-drop-buttons"><input id="bp-media-upload-browse-button" type="button" value="Select Files" class="button" /></p>
		</div>
	</div>
</div>
<div id="bp-media-uploaded-files"></div>
	<?php 
}
开发者ID:nitun,项目名称:buddypress-media,代码行数:34,代码来源:bp-media-template-functions.php

示例8: test_bp_has_activities_favorites_action_filter

 /**
  * Make sure that action filters ('activity_update', etc) work when
  * limiting query to user favorites
  *
  * @ticket BP4872
  * @group scope
  */
 public function test_bp_has_activities_favorites_action_filter()
 {
     $user_id = $this->factory->user->create(array('role' => 'subscriber'));
     $now = time();
     $a1 = $this->factory->activity->create(array('type' => 'activity_update', 'recorded_time' => date('Y-m-d H:i:s', $now)));
     $a2 = $this->factory->activity->create(array('type' => 'joined_group', 'recorded_time' => date('Y-m-d H:i:s', $now - 100)));
     $current_user = bp_loggedin_user_id();
     $this->set_current_user($user_id);
     bp_activity_add_user_favorite($a1, $user_id);
     bp_activity_add_user_favorite($a2, $user_id);
     $this->set_current_user($current_user);
     // groan. It sucks that you have to invoke the global
     global $activities_template;
     // Case 1: no action filter
     bp_has_activities(array('user_id' => $user_id, 'scope' => 'favorites'));
     // The formatting of $activities_template->activities is messed
     // up, so we're just going to look at the IDs. This should be
     // fixed in BP at some point
     $ids = wp_list_pluck($activities_template->activities, 'id');
     $this->assertEquals(array($a1, $a2), $ids);
     $activities_template = null;
     // Case 2: action filter
     bp_has_activities(array('user_id' => $user_id, 'scope' => 'favorites', 'action' => 'activity_update'));
     $ids = wp_list_pluck($activities_template->activities, 'id');
     $this->assertEquals(array($a1), $ids);
     $activities_template = null;
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:34,代码来源:template.php

示例9: friends_screen_requests

function friends_screen_requests()
{
    if (bp_is_action_variable('accept', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_accept_friendship');
        if (friends_accept_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship accepted', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be accepted', 'buddypress'), 'error');
        }
        bp_core_redirect(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action());
    } elseif (bp_is_action_variable('reject', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_reject_friendship');
        if (friends_reject_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship rejected', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be rejected', 'buddypress'), 'error');
        }
        bp_core_redirect(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action());
    }
    do_action('friends_screen_requests');
    if (isset($_GET['new'])) {
        bp_core_delete_notifications_by_type(bp_loggedin_user_id(), 'friends', 'friendship_request');
    }
    bp_core_load_template(apply_filters('friends_template_requests', 'members/single/home'));
}
开发者ID:hornetalcala,项目名称:trunk,代码行数:27,代码来源:bp-friends-screens.php

示例10: __construct

 /**
  * BP_Groups_Invite_Template constructor.
  *
  * @since 1.5.0
  *
  * @param array $args
  */
 public function __construct($args = array())
 {
     // Backward compatibility with old method of passing arguments.
     if (!is_array($args) || func_num_args() > 1) {
         _deprecated_argument(__METHOD__, '2.0.0', sprintf(__('Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress'), __METHOD__, __FILE__));
         $old_args_keys = array(0 => 'user_id', 1 => 'group_id');
         $func_args = func_get_args();
         $args = bp_core_parse_args_array($old_args_keys, $func_args);
     }
     $r = wp_parse_args($args, array('page' => 1, 'per_page' => 10, 'page_arg' => 'invitepage', 'user_id' => bp_loggedin_user_id(), 'group_id' => bp_get_current_group_id()));
     $this->pag_arg = sanitize_key($r['page_arg']);
     $this->pag_page = bp_sanitize_pagination_arg($this->pag_arg, $r['page']);
     $this->pag_num = bp_sanitize_pagination_arg('num', $r['per_page']);
     $iquery = new BP_Group_Member_Query(array('group_id' => $r['group_id'], 'type' => 'first_joined', 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'is_confirmed' => false, 'inviter_id' => $r['user_id']));
     $this->invite_data = $iquery->results;
     $this->total_invite_count = $iquery->total_users;
     $this->invites = array_values(wp_list_pluck($this->invite_data, 'ID'));
     $this->invite_count = count($this->invites);
     // If per_page is set to 0 (show all results), don't generate
     // pag_links.
     if (!empty($this->pag_num)) {
         $this->pag_links = paginate_links(array('base' => add_query_arg($this->pag_arg, '%#%'), 'format' => '', 'total' => ceil($this->total_invite_count / $this->pag_num), 'current' => $this->pag_page, 'prev_text' => '&larr;', 'next_text' => '&rarr;', 'mid_size' => 1, 'add_args' => array()));
     } else {
         $this->pag_links = '';
     }
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:33,代码来源:class-bp-groups-invite-template.php

示例11: bp_core_delete_notification

/**
 * Delete a specific notification by its ID
 *
 * @since BuddyPress (1.0)
 * @param int $id
 * @return boolean True on success, false on fail
 */
function bp_core_delete_notification($id)
{
    if (!bp_core_check_notification_access(bp_loggedin_user_id(), $id)) {
        return false;
    }
    return BP_Core_Notification::delete($id);
}
开发者ID:httvncoder,项目名称:151722441,代码行数:14,代码来源:bp-members-notifications.php

示例12: dln_get_notifications_objects

function dln_get_notifications_objects()
{
    if (!is_user_logged_in()) {
        return false;
    }
    $notifications = BP_Notifications_Notification::get(array('user_id' => bp_loggedin_user_id(), 'is_new' => '1', 'component_name' => bp_notifications_get_registered_components()));
    if (!$notifications) {
        return;
    }
    $count_m = $count_f = $count_a = 0;
    $arr_m = $arr_f = $arr_a = array();
    foreach ($notifications as $i => $nof) {
        switch ($nof->component_name) {
            case 'messages':
                $count_m++;
                $arr_m[] = $nof;
                break;
            case 'friends':
                $count_f++;
                $arr_f[] = $nof;
                break;
        }
    }
    $result = array();
    $result['messages'] = array('nof_count' => $count_m, 'nof_arr' => $arr_m);
    $result['friends'] = array('nof_type' => 'friends', 'nof_count' => $count_f, 'nof_arr' => $arr_f);
    return $result;
}
开发者ID:httvncoder,项目名称:151722441,代码行数:28,代码来源:functions.php

示例13: friends_clear_friend_notifications

function friends_clear_friend_notifications()
{
    global $bp;
    if (isset($_GET['new'])) {
        bp_core_delete_notifications_by_type(bp_loggedin_user_id(), $bp->friends->id, 'friendship_accepted');
    }
}
开发者ID:newington,项目名称:buddypress,代码行数:7,代码来源:bp-friends-cache.php

示例14: friends_screen_requests

/**
 * Catch and process the Requests page.
 */
function friends_screen_requests()
{
    if (bp_is_action_variable('accept', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_accept_friendship');
        if (friends_accept_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship accepted', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be accepted', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    } elseif (bp_is_action_variable('reject', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_reject_friendship');
        if (friends_reject_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship rejected', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be rejected', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    } elseif (bp_is_action_variable('cancel', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_withdraw_friendship');
        if (friends_withdraw_friendship(bp_loggedin_user_id(), bp_action_variable(1))) {
            bp_core_add_message(__('Friendship request withdrawn', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship request could not be withdrawn', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    }
    do_action('friends_screen_requests');
    bp_core_load_template(apply_filters('friends_template_requests', 'members/single/home'));
}
开发者ID:eresyyl,项目名称:mk,代码行数:36,代码来源:bp-friends-screens.php

示例15: bp_forums_directory_forums_setup

/**
 * Load the Forums directory.
 */
function bp_forums_directory_forums_setup()
{
    // Get BuddyPress once
    $bp = buddypress();
    if (bp_is_forums_component() && (!bp_current_action() || 'tag' == bp_current_action() && bp_action_variables()) && !bp_current_item()) {
        if (!bp_forums_has_directory()) {
            return false;
        }
        if (!bp_forums_is_installed_correctly()) {
            bp_core_add_message(__('The forums component has not been set up yet.', 'buddypress'), 'error');
            bp_core_redirect(bp_get_root_domain());
        }
        bp_update_is_directory(true, 'forums');
        do_action('bbpress_init');
        // Check to see if the user has posted a new topic from the forums page.
        if (isset($_POST['submit_topic']) && bp_is_active('forums')) {
            check_admin_referer('bp_forums_new_topic');
            $bp->groups->current_group = groups_get_group(array('group_id' => $_POST['topic_group_id']));
            if (!empty($bp->groups->current_group->id)) {
                // Auto join this user if they are not yet a member of this group
                if (!bp_current_user_can('bp_moderate') && 'public' == $bp->groups->current_group->status && !groups_is_user_member(bp_loggedin_user_id(), $bp->groups->current_group->id)) {
                    groups_join_group($bp->groups->current_group->id);
                }
                $error_message = '';
                $forum_id = groups_get_groupmeta($bp->groups->current_group->id, 'forum_id');
                if (!empty($forum_id)) {
                    if (empty($_POST['topic_title'])) {
                        $error_message = __('Please provide a title for your forum topic.', 'buddypress');
                    } else {
                        if (empty($_POST['topic_text'])) {
                            $error_message = __('Forum posts cannot be empty. Please enter some text.', 'buddypress');
                        }
                    }
                    if ($error_message) {
                        bp_core_add_message($error_message, 'error');
                        $redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum';
                    } else {
                        if (!($topic = groups_new_group_forum_topic($_POST['topic_title'], $_POST['topic_text'], $_POST['topic_tags'], $forum_id))) {
                            bp_core_add_message(__('There was an error when creating the topic', 'buddypress'), 'error');
                            $redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum';
                        } else {
                            bp_core_add_message(__('The topic was created successfully', 'buddypress'));
                            $redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum/topic/' . $topic->topic_slug . '/';
                        }
                    }
                    bp_core_redirect($redirect);
                } else {
                    bp_core_add_message(__('Please pick the group forum where you would like to post this topic.', 'buddypress'), 'error');
                    bp_core_redirect(add_query_arg('new', '', bp_get_forums_directory_permalink()));
                }
            } else {
                bp_core_add_message(__('Please pick the group forum where you would like to post this topic.', 'buddypress'), 'error');
                bp_core_redirect(add_query_arg('new', '', bp_get_forums_directory_permalink()));
            }
        }
        do_action('bp_forums_directory_forums_setup');
        bp_core_load_template(apply_filters('bp_forums_template_directory_forums_setup', 'forums/index'));
    }
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:62,代码来源:bp-forums-screens.php


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