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


PHP bp_get_members_root_slug函数代码示例

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


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

示例1: bp_em_record_activity_booking_save

/**
 * @param boolean $result
 * @param EM_Booking $EM_Booking
 * @return boolean
 */
function bp_em_record_activity_booking_save($result, $EM_Booking)
{
    if ($result) {
        $rejected_statuses = array(0, 2, 3);
        //these statuses apply to rejected/cancelled bookings
        $user = $EM_Booking->person;
        $member_slug = function_exists('bp_get_members_root_slug') ? bp_get_members_root_slug() : BP_MEMBERS_SLUG;
        $member_link = trailingslashit(bp_get_root_domain()) . $member_slug . '/' . $user->user_login;
        $user_link = "<a href='" . $member_link . "/'>" . $user->display_name . "</a>";
        $event_link = $EM_Booking->get_event()->output('#_EVENTLINK');
        $status = $EM_Booking->booking_status;
        $EM_Event = $EM_Booking->get_event();
        if (empty($EM_Event->group_id)) {
            if ($status == 1 || !get_option('dbem_bookings_approval') && $status < 2) {
                $action = sprintf(__('%s is attending %s.', 'dbem'), $user_link, $event_link);
            } elseif (($EM_Booking->previous_status == 1 || !get_option('dbem_bookings_approval') && $EM_Booking->previous_status < 2) && in_array($status, $rejected_statuses)) {
                $action = sprintf(__('%s will not be attending %s anymore.', 'dbem'), $user_link, $event_link);
            }
        } else {
            $group = new BP_Groups_Group($EM_Event->group_id);
            $group_link = '<a href="' . bp_get_group_permalink($group) . '">' . bp_get_group_name($group) . '</a>';
            if ($status == 1 || !get_option('dbem_bookings_approval') && $status < 2) {
                $action = sprintf(__('%s is attending %s of the group %s.', 'dbem'), $user_link, $event_link, $group_link);
            } elseif (($EM_Booking->previous_status == 1 || !get_option('dbem_bookings_approval') && $EM_Booking->previous_status < 2) && in_array($status, $rejected_statuses)) {
                $action = sprintf(__('%s will not be attending %s of group %s anymore.', 'dbem'), $user_link, $event_link, $group_link);
            }
        }
        if (!empty($action)) {
            bp_em_record_activity(array('user_id' => $EM_Booking->person->ID, 'action' => $action, 'primary_link' => $EM_Event->output('#_EVENTURL'), 'type' => 'new_booking', 'item_id' => $EM_Event->event_id, 'secondary_item_id' => $EM_Booking->booking_id, 'hide_sitewide' => $EM_Event->event_private));
            //group activity
            if (!empty($EM_Event->group_id)) {
                //tis a group event
                bp_em_record_activity(array('component' => 'groups', 'item_id' => $EM_Event->group_id, 'user_id' => $EM_Booking->person->ID, 'action' => $action, 'primary_link' => $EM_Event->output('#_EVENTURL'), 'type' => 'new_booking', 'secondary_item_id' => $EM_Booking->booking_id, 'hide_sitewide' => $EM_Event->event_private));
            }
        }
    }
    return $result;
}
开发者ID:rajankz,项目名称:webspace,代码行数:43,代码来源:bp-em-activity.php

示例2: huddle_bp_get_the_profile_field_value

function huddle_bp_get_the_profile_field_value($value, $type = '', $id = '')
{
    global $field;
    if (substr_count(strtolower($field->name), 'twitter')) {
        if (!substr_count($field->data->value, 'twitter.com')) {
            $value = 'http://twitter.com/' . $value;
        }
    } elseif (substr_count(strtolower($field->name), 'about')) {
    } else {
        $values = explode(',', $value);
        if ($values) {
            foreach ((array) $values as $value) {
                $value = trim($value);
                // If the value is a URL, skip it and just make it clickable.
                if (preg_match('@(https?://([-\\w\\.]+)+(:\\d+)?(/([\\w/_\\.]*(\\?\\S+)?)?)?)@', $value)) {
                    $new_values[] = make_clickable($value);
                } else {
                    if (count(explode(' ', $value)) > 5) {
                        $new_values[] = $value;
                    } else {
                        $new_values[] = '<a href="' . site_url(bp_get_members_root_slug()) . '/?s=' . strip_tags($value) . '" rel="nofollow">' . $value . '</a>';
                    }
                }
            }
            $value = implode(', ', $new_values);
        }
    }
    return $value;
}
开发者ID:nxtclass,项目名称:NXTClass-themes,代码行数:29,代码来源:functions.php

示例3: do_action

			<?php 
do_action('bp_before_directory_members_content');
?>

			<div id="members-dir-search" class="dir-search" role="search">

				<?php 
bp_directory_members_search_form();
?>

			</div><!-- #members-dir-search -->

			<div class="item-list-tabs" role="navigation">
				<ul>
					<li class="selected" id="members-all"><a href="<?php 
echo trailingslashit(bp_get_root_domain() . '/' . bp_get_members_root_slug());
?>
"><?php 
printf(__('All %1s <span>%2s</span>', 'buddypress'), ucfirst(buatp_get_dir_name()), bp_get_total_member_count());
?>
</a></li>

					<?php 
if (is_user_logged_in() && bp_is_active('friends') && bp_get_total_friend_count(bp_loggedin_user_id())) {
    ?>

						<li id="members-personal"><a href="<?php 
    echo bp_loggedin_user_domain() . bp_get_friends_slug() . '/my-friends/';
    ?>
"><?php 
    printf(__('My Friends <span>%s</span>', 'buddypress'), bp_get_total_friend_count(bp_loggedin_user_id()));
开发者ID:jfeliweb,项目名称:BuddyPress-User-Account-Type,代码行数:31,代码来源:index.php

示例4: bp_get_the_topic_last_poster_name

/**
 * Return the linked name of the user who last posted to the current topic in the loop.
 *
 * @return string HTML link to the profile of the user who last posted
 *         to the current topic.
 */
function bp_get_the_topic_last_poster_name()
{
    global $forum_template;
    $domain = bp_core_get_user_domain($forum_template->topic->topic_last_poster, $forum_template->topic->topic_last_poster_nicename, $forum_template->topic->topic_last_poster_login);
    // In the case where no user is found, bp_core_get_user_domain() may return the URL
    // of the Members directory
    if (!$domain || $domain == bp_core_get_root_domain() . '/' . bp_get_members_root_slug() . '/') {
        return __('Deleted User', 'buddypress');
    }
    return apply_filters('bp_get_the_topic_last_poster_name', '<a href="' . $domain . '">' . $forum_template->topic->topic_last_poster_displayname . '</a>');
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:17,代码来源:bp-forums-template.php

示例5: bp_core_get_user_domain

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

示例6: bp_adminbar_random_menu

function bp_adminbar_random_menu()
{
    global $bp;
    ?>

	<li class="align-right" id="bp-adminbar-visitrandom-menu">
		<a href="#"><?php 
    _e('Visit', 'buddypress');
    ?>
</a>
		<ul class="random-list">
			<li><a href="<?php 
    echo trailingslashit(bp_get_root_domain() . '/' . bp_get_members_root_slug()) . '?random-member';
    ?>
" rel="nofollow"><?php 
    _e('Random Member', 'buddypress');
    ?>
</a></li>

			<?php 
    if (bp_is_active('groups')) {
        ?>

				<li class="alt"><a href="<?php 
        echo trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug()) . '?random-group';
        ?>
"  rel="nofollow"><?php 
        _e('Random Group', 'buddypress');
        ?>
</a></li>

			<?php 
    }
    ?>

			<?php 
    if (is_multisite() && bp_is_active('blogs')) {
        ?>

				<li><a href="<?php 
        echo trailingslashit(bp_get_root_domain() . '/' . bp_get_blogs_root_slug()) . '?random-blog';
        ?>
"  rel="nofollow"><?php 
        _e('Random Site', 'buddypress');
        ?>
</a></li>

			<?php 
    }
    ?>

			<?php 
    do_action('bp_adminbar_random_menu');
    ?>

		</ul>
	</li>

	<?php 
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:60,代码来源:bp-core-buddybar.php

示例7: strip_mentions_on_edit

 /**
  * Strip out BuddyPress activity at-name HTML on topic/reply edit
  *
  * Copied from bp_forums_strip_mentions_on_post_edit() in case forums
  * component is not active or is not loaded in yet.
  *
  * @since bbPress (r3475)
  * @param type $content Optional
  * @uses bp_get_root_domain()
  * @uses bp_get_members_root_slug()
  * @return string
  */
 public function strip_mentions_on_edit($content = '')
 {
     // Backwards compat for members root slug
     if (function_exists('bp_get_members_root_slug')) {
         $members_root = bp_get_members_root_slug();
     } elseif (defined('BP_MEMBERS_SLUG')) {
         $members_root = BP_MEMBERS_SLUG;
     } else {
         $members_root = 'members';
     }
     $pattern = "|<a href=&#039;" . bp_get_root_domain() . "/" . $members_root . "/[A-Za-z0-9-_\\.]+/&#039; rel=&#039;nofollow&#039;>(@[A-Za-z0-9-_\\.@]+)</a>|";
     $content = preg_replace($pattern, "\$1", htmlspecialchars_decode($content));
     return $content;
 }
开发者ID:hscale,项目名称:webento,代码行数:26,代码来源:activity.php

示例8: ass_digest_get_user_domain

/**
 * Get user domain.
 *
 * Do not use this outside of digests!
 *
 * This is almost a duplicate of bp_core_get_user_domain(), but references
 * our already-fetched mass-userdata array to avoid pinging the DB over and
 * over again in a foreach loop.
 */
function ass_digest_get_user_domain($user_id)
{
    global $bp;
    if (empty($bp->ass->massdata)) {
        return false;
    }
    $mass_userdata = $bp->ass->massdata;
    $username = bp_is_username_compatibility_mode() ? $mass_userdata[$user_id]['user_login'] : $mass_userdata[$user_id]['user_nicename'];
    if (bp_core_enable_root_profiles()) {
        $after_domain = $username;
    } else {
        $after_domain = bp_get_members_root_slug() . '/';
        $after_domain .= bp_is_username_compatibility_mode() ? rawurlencode($username) : $username;
    }
    $domain = trailingslashit(bp_get_root_domain() . '/' . $after_domain);
    $domain = apply_filters('bp_core_get_user_domain_pre_cache', $domain, $user_id, $mass_userdata[$user_id]['user_nicename'], $mass_userdata[$user_id]['user_login']);
    return apply_filters('bp_core_get_user_domain', $domain, $user_id, $mass_userdata[$user_id]['user_nicename'], $mass_userdata[$user_id]['user_login']);
}
开发者ID:pausaura,项目名称:agora_nodes,代码行数:27,代码来源:bp-activity-subscription-digest.php

示例9: rw_bp_docs_set_the_doc_relatetd_group

function rw_bp_docs_set_the_doc_relatetd_group()
{
    $d_doc_id = $folder_id = $group_id = 0;
    $group = new stdClass();
    $url = '#';
    $description = '';
    if (bp_docs_is_existing_doc()) {
        $d_doc_id = get_queried_object_id();
        $folder_id = bp_docs_get_doc_folder($d_doc_id);
        if ($folder_id) {
            $group_id = bp_docs_get_folder_group($folder_id);
            if ($group_id) {
                $group = groups_get_group(array('group_id' => $group_id));
                buddypress()->groups->current_group = $group;
                if (!bp_disable_group_avatar_uploads()) {
                    $url = bp_get_groups_root_slug() . '/' . $group->slug;
                }
                $avatar = bp_get_group_avatar('type=thumb&width=250&height=250');
                $description = $group->description;
                $name = $group->name;
            }
        } else {
            $post = get_post($d_doc_id);
            $user = get_userdata($post->post_author);
            $name = $user->display_name;
            $avatar = bp_core_fetch_avatar(array('type' => 'thumb', 'width' => 250, 'height' => 250, 'item_id' => $user->ID));
            $description = '';
            $url = bp_get_members_root_slug() . '/' . $user->nice_name;
        }
    }
    ?>
	<div id="bp_docs_sitebar_info">
		<h2><a href="/<?php 
    echo $url;
    ?>
"><?php 
    echo $name;
    ?>
</a></h2>
		<div class="group-avatar">
			<a href="/<?php 
    echo $url;
    ?>
"><?php 
    echo $avatar;
    ?>
</a>
		</div>
		
		<div class="group-info">
			<p><?php 
    echo $description;
    ?>
</p>
		</div>
	</div>
	<hr>
	<?php 
}
开发者ID:rpi-virtuell,项目名称:rw-social-learner,代码行数:59,代码来源:rw_functions.php

示例10: bp_profile_updated

 /**
  * Handles BP profile saving action
  *
  * @global object $current_user
  * @param int $user_id
  * @param array $posted_field_ids
  * @param array $errors
  * @author korotkov@UD
  */
 static function bp_profile_updated($user_id, $posted_field_ids, $errors)
 {
     global $current_user, $bp;
     if (is_admin()) {
         return;
     }
     //** Get new user_data from POST */
     $user_data = $_REQUEST['wp_crm']['user_data'];
     //** user_id is required */
     $user_data['user_id'][0]['value'] = $user_id;
     //** user_email is required */
     if (!array_key_exists('user_email', $user_data)) {
         $user_data['user_email'][0]['value'] = $current_user->user_email;
     }
     //** Change display name if xprofile full name exists */
     $fullname_field_name = bp_xprofile_fullname_field_name();
     $fullname_field_id = xprofile_get_field_id_from_name($fullname_field_name);
     if (in_array($fullname_field_id, $posted_field_ids)) {
         $display_name = xprofile_get_field_data($fullname_field_name, $user_id);
         $user_data['display_name'] = $display_name;
     }
     //** Save user data */
     $user_id = wp_crm_save_user_data($user_data);
     //** Determine if user changed nicename (display name in URL). peshkov@UD */
     if ($user_id && isset($user_data['user_nicename'])) {
         $user_domain = bp_displayed_user_domain();
         $userdata = get_userdata($user_id);
         $user_nicename = $userdata->data->user_nicename;
         $needle = bp_get_members_root_slug() . '/' . $user_nicename . '/';
         $pos = strpos($user_domain, $needle);
         if ($pos === false) {
             //** Looks like user_nicename was changed so redirect to the new profile's URL. */
             $user_domain = str_replace($bp->displayed_user->userdata->user_nicename, $user_nicename, $user_domain);
             if ($errors) {
                 bp_core_add_message(__('There was a problem updating some of your profile information, please try again.', ud_get_wp_crm()->domain), 'error');
             } else {
                 bp_core_add_message(__('Changes saved.', ud_get_wp_crm()->domain));
             }
             //* Redirect back to the edit screen to display the updates and message */
             bp_core_redirect(trailingslashit($user_domain . $bp->profile->slug . '/edit/group/' . bp_action_variable(1)));
         }
     }
 }
开发者ID:Finzy,项目名称:stageDB,代码行数:52,代码来源:buddypress.php

示例11: about_screen

        /**
         * Output the about screen.
         *
         * @since BuddyPress (1.7.0)
         */
        public function about_screen()
        {
            global $wp_rewrite;
            $is_new_install = !empty($_GET['is_new_install']);
            $pretty_permalinks_enabled = !empty($wp_rewrite->permalink_structure);
            $image_base = buddypress()->plugin_url . 'bp-core/images/bp20/';
            list($display_version) = explode('-', bp_get_version());
            ?>

		<div class="wrap about-wrap">
			<h1><?php 
            printf(__('Welcome to BuddyPress %s', 'buddypress'), $display_version);
            ?>
</h1>
			<div class="about-text">
				<?php 
            if ($is_new_install) {
                ?>
					<?php 
                printf(__('It&#8217;s a great time to use BuddyPress! With a focus on speed, admin tools, and developer enhancements, %s is our leanest and most powerful version yet.', 'buddypress'), $display_version);
                ?>
				<?php 
            } else {
                ?>
					<?php 
                printf(__('Thanks for updating! With a focus on speed, admin tools, and developer enhancements, BuddyPress %s is our leanest and most powerful version yet.', 'buddypress'), $display_version);
                ?>
				<?php 
            }
            ?>
			</div>

			<div class="bp-badge"></div>

			<h2 class="nav-tab-wrapper">
				<a class="nav-tab nav-tab-active" href="<?php 
            echo esc_url(bp_get_admin_url(add_query_arg(array('page' => 'bp-about'), 'index.php')));
            ?>
">
					<?php 
            _e('What&#8217;s New', 'buddypress');
            ?>
				</a><a class="nav-tab" href="<?php 
            echo esc_url(bp_get_admin_url(add_query_arg(array('page' => 'bp-credits'), 'index.php')));
            ?>
">
					<?php 
            _e('Credits', 'buddypress');
            ?>
				</a>
			</h2>

			<?php 
            if ($is_new_install) {
                ?>
			<h3><?php 
                _e('Getting Started', 'buddypress');
                ?>
</h3>

				<div class="feature-section">
					<h4><?php 
                _e('Your Default Setup', 'buddypress');
                ?>
</h4>

					<?php 
                if (bp_is_active('members') && bp_is_active('activity') && current_user_can($this->capability)) {
                    ?>
						<p><?php 
                    printf(__('BuddyPress&#8217;s powerful features help your users connect and collaborate. To help get your community started, we&#8217;ve activated two of the most commonly used tools in BP: <strong>Extended Profiles</strong> and <strong>Activity Streams</strong>. See these components in action at the %1$s and %2$s directories, and be sure to spend a few minutes <a href="%3$s">configuring user profiles</a>. Want to explore more of BP&#8217;s features? Visit the <a href="%4$s">Components panel</a>.', 'buddypress'), $pretty_permalinks_enabled ? '<a href="' . trailingslashit(bp_get_root_domain() . '/' . bp_get_members_root_slug()) . '">' . __('Members', 'buddypress') . '</a>' : __('Members', 'buddypress'), $pretty_permalinks_enabled ? '<a href="' . trailingslashit(bp_get_root_domain() . '/' . bp_get_activity_root_slug()) . '">' . __('Activity', 'buddypress') . '</a>' : __('Activity', 'buddypress'), bp_get_admin_url(add_query_arg(array('page' => 'bp-profile-setup'), 'users.php')), bp_get_admin_url(add_query_arg(array('page' => 'bp-components'), $this->settings_page)));
                    ?>
</p>

					<?php 
                } else {
                    ?>
						<p><?php 
                    printf(__('BuddyPress&#8217;s powerful features help your users connect and collaborate. Want to explore BP&#8217;s features? Visit the <a href="%s">Components panel</a>.', 'buddypress'), bp_get_admin_url(add_query_arg(array('page' => 'bp-components'), $this->settings_page)));
                    ?>
</p>

					<?php 
                }
                ?>

					<h4><?php 
                _e('Community and Support', 'buddypress');
                ?>
</h4>
					<p><?php 
                _e('Looking for help? The <a href="http://codex.buddypress.org/">BuddyPress Codex</a> has you covered, with dozens of user-contributed guides on how to configure and use your BP site. Can&#8217;t find what you need? Stop by <a href="http://buddypress.org/support/">our support forums</a>, where a vibrant community of BuddyPress users and developers is waiting to share tips, show off their sites, talk about the future of BuddyPress, and much more.', 'buddypress');
                ?>
</p>
				</div>
//.........这里部分代码省略.........
开发者ID:danielcoats,项目名称:schoolpress,代码行数:101,代码来源:bp-core-admin.php

示例12: bp_core_get_user_domain

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

示例13: apoc_title

?>
">
				<h1 class="post-title"><?php 
apoc_title();
?>
</h1>
				<p class="post-byline"><?php 
apoc_description();
?>
</p>
			</header>

			<nav id="directory-nav" class="dir-list-tabs" role="navigation">
				<ul id="directory-actions" class="directory-tabs">
					<li class="selected" id="members-all"><a href="<?php 
echo trailingslashit(SITEURL . '/' . bp_get_members_root_slug());
?>
">All Members<span><?php 
echo bp_get_total_member_count();
?>
</span></a></li>
					<?php 
if (is_user_logged_in()) {
    ?>
					<li id="members-personal"><a href="<?php 
    echo bp_loggedin_user_domain() . bp_get_friends_slug() . '/my-friends/';
    ?>
">My Friends<span><?php 
    echo bp_get_total_friend_count();
    ?>
</span></a></li>
开发者ID:tamriel-foundry,项目名称:apoc2,代码行数:31,代码来源:index.php

示例14: kleo_pmpro_restrict_rules

 /**
  * Applies restrictions based on the Theme options -> Memberships
  * @return void
  * @since 2.0
  */
 function kleo_pmpro_restrict_rules()
 {
     //if PMPRO is not activated
     if (!function_exists('pmpro_url')) {
         return;
     }
     //if buddypress is not activated
     if (!function_exists('bp_is_active')) {
         return;
     }
     //full current url
     $actual_link = kleo_full_url();
     //our request uri
     $home_url = home_url();
     //WPML support
     if (defined('ICL_SITEPRESS_VERSION')) {
         global $sitepress;
         $home_url = $sitepress->language_url(ICL_LANGUAGE_CODE);
     }
     $home_url = str_replace("www.", "", $home_url);
     $uri = str_replace(untrailingslashit($home_url), "", $actual_link);
     //restriction match array
     $final = array();
     $allowed_chars = apply_filters('kleo_pmpro_allowed_chars', "a-z 0-9~%.:_\\-");
     $restrict_options = kleo_memberships();
     $members_slug = str_replace('/', '\\/', bp_get_members_root_slug());
     /*-----------------------------------------------------------------------------------*/
     /* Preg match rules
     	/*-----------------------------------------------------------------------------------*/
     //members directory restriction rule
     $final["/^\\/" . $members_slug . "\\/?\$/"] = array('name' => 'members_dir', 'type' => $restrict_options['members_dir']['type'], 'levels' => isset($restrict_options['members_dir']['levels']) ? $restrict_options['members_dir']['levels'] : array());
     //members single profile restriction rule
     $final["/^\\/" . $members_slug . "\\/[" . $allowed_chars . "\\/]+\\/?\$/"] = array('name' => 'view_profiles', 'type' => $restrict_options['view_profiles']['type'], 'levels' => isset($restrict_options['view_profiles']['levels']) ? $restrict_options['view_profiles']['levels'] : array());
     if (function_exists('bp_get_groups_root_slug')) {
         $groups_slug = str_replace('/', '\\/', bp_get_groups_root_slug());
         //groups directory restriction rule
         $final["/^\\/" . $groups_slug . "\\/?\$/"] = array('name' => 'groups_dir', 'type' => $restrict_options['groups_dir']['type'], 'levels' => isset($restrict_options['groups_dir']['levels']) ? $restrict_options['groups_dir']['levels'] : array());
         //groups single page restriction rule
         $final["/^\\/" . $groups_slug . "\\/[" . $allowed_chars . "\\/]+\\/?\$/"] = array('name' => 'view_groups', 'type' => $restrict_options['view_groups']['type'], 'levels' => isset($restrict_options['view_groups']['levels']) ? $restrict_options['view_groups']['levels'] : array());
     }
     if (function_exists('bp_get_activity_root_slug')) {
         $activity_slug = str_replace('/', '\\/', bp_get_activity_root_slug());
         //activity page restriction rule
         $final["/^\\/" . $activity_slug . "\\/?\$/"] = array('name' => 'show_activity', 'type' => $restrict_options['show_activity']['type'], 'levels' => isset($restrict_options['show_activity']['levels']) ? $restrict_options['show_activity']['levels'] : array());
     }
     /* You can add extra restrictions using this filter */
     $final = apply_filters('kleo_pmpro_match_rules', $final);
     //no redirection for super-admin
     if (is_super_admin()) {
         return false;
     } elseif (is_user_logged_in()) {
         //restrict media
         if (preg_match("/^\\/" . $members_slug . "\\/" . bp_get_loggedin_user_username() . "\\/media\\/?/", $uri) || preg_match("/^\\/" . $members_slug . "\\/" . bp_get_loggedin_user_username() . "\\/album\\/?/", $uri)) {
             kleo_check_access('add_media', $restrict_options);
         } elseif (preg_match("/^\\/" . $members_slug . "\\/" . bp_get_loggedin_user_username() . "\\/messages\\/compose\\/?/", $uri) || preg_match("/^\\/" . $members_slug . "\\/" . bp_get_loggedin_user_username() . "\\/messages\\/view\\/[" . $allowed_chars . "\\/]?\\/?/", $uri)) {
             kleo_check_access('pm', $restrict_options);
         }
         /* Add other restrictions for own profile */
         do_action('kleo_pmro_extra_restriction_before_my_profile', $restrict_options);
         //allow me to view other parts of my profile
         if (bp_is_my_profile()) {
             return false;
         }
     }
     //loop trought remaining restrictions
     foreach ($final as $rk => $rv) {
         if (preg_match($rk, $uri)) {
             kleo_check_access($rv['name'], $restrict_options);
         }
     }
     do_action('kleo_pmro_extra_restriction_rules', $restrict_options);
 }
开发者ID:6226,项目名称:wp,代码行数:77,代码来源:config.php

示例15: bp_core_screen_activation

/**
 * Handle the loading of the Activate screen.
 */
function bp_core_screen_activation()
{
    global $bp;
    if (!bp_is_current_component('activate')) {
        return false;
    }
    // If the user is logged in, redirect away from here
    if (is_user_logged_in()) {
        if (bp_is_component_front_page('activate')) {
            $redirect_to = trailingslashit(bp_get_root_domain() . '/' . bp_get_members_root_slug());
        } else {
            $redirect_to = trailingslashit(bp_get_root_domain());
        }
        bp_core_redirect(apply_filters('bp_loggedin_activate_page_redirect_to', $redirect_to));
        return;
    }
    // Check if an activation key has been passed
    if (isset($_GET['key'])) {
        // Activate the signup
        $user = apply_filters('bp_core_activate_account', bp_core_activate_signup($_GET['key']));
        // If there were errors, add a message and redirect
        if (!empty($user->errors)) {
            bp_core_add_message($user->get_error_message(), 'error');
            bp_core_redirect(trailingslashit(bp_get_root_domain() . '/' . $bp->pages->activate->slug));
        }
        $hashed_key = wp_hash($_GET['key']);
        // Check if the avatar folder exists. If it does, move rename it, move
        // it and delete the signup avatar dir
        if (file_exists(bp_core_avatar_upload_path() . '/avatars/signups/' . $hashed_key)) {
            @rename(bp_core_avatar_upload_path() . '/avatars/signups/' . $hashed_key, bp_core_avatar_upload_path() . '/avatars/' . $user);
        }
        bp_core_add_message(__('Your account is now active!', 'buddypress'));
        $bp->activation_complete = true;
    }
    bp_core_load_template(apply_filters('bp_core_template_activate', array('activate', 'registration/activate')));
}
开发者ID:eresyyl,项目名称:mk,代码行数:39,代码来源:bp-members-screens.php


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