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


PHP bp_get_profile_slug函数代码示例

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


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

示例1: bp_profile_slug

/**
 * Output the profile component slug.
 *
 * @since 2.4.0
 *
 * @uses bp_get_profile_slug()
 */
function bp_profile_slug()
{
    echo bp_get_profile_slug();
}
开发者ID:mawilliamson,项目名称:wordpress,代码行数:11,代码来源:bp-members-template.php

示例2: setup_nav

 /**
  * Set up fall-back component navigation if XProfile is inactive.
  *
  * @since 1.5.0
  *
  * @see BP_Component::setup_nav() for a description of arguments.
  *
  * @param array $main_nav Optional. See BP_Component::setup_nav() for
  *                        description.
  * @param array $sub_nav  Optional. See BP_Component::setup_nav() for
  *                        description.
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     // Bail if XProfile component is active.
     if (bp_is_active('xprofile')) {
         return;
     }
     // Don't set up navigation if there's no member.
     if (!is_user_logged_in() && !bp_is_user()) {
         return;
     }
     // Determine user to use.
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     $slug = bp_get_profile_slug();
     $profile_link = trailingslashit($user_domain . $slug);
     // Setup the main navigation.
     $main_nav = array('name' => _x('Profile', 'Member profile main navigation', 'buddypress'), 'slug' => $slug, 'position' => 20, 'screen_function' => 'bp_members_screen_display_profile', 'default_subnav_slug' => 'public', 'item_css_id' => buddypress()->profile->id);
     // Setup the subnav items for the member profile.
     $sub_nav[] = array('name' => _x('View', 'Member profile view', 'buddypress'), 'slug' => 'public', 'parent_url' => $profile_link, 'parent_slug' => $slug, 'screen_function' => 'bp_members_screen_display_profile', 'position' => 10);
     parent::setup_nav($main_nav, $sub_nav);
 }
开发者ID:enlacee,项目名称:anb.platicom.com.pe,代码行数:38,代码来源:bp-members-loader.php

示例3: setup_admin_bar

 /**
  * Set up the Toolbar
  */
 public function setup_admin_bar($wp_admin_nav = array())
 {
     // Menus for logged in user
     if (is_user_logged_in()) {
         // Profile link
         $profile_link = trailingslashit(bp_loggedin_user_domain() . bp_get_profile_slug());
         // Add the "Profile" sub menu
         $wp_admin_nav[] = array('parent' => buddypress()->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => _x('Profile', 'My Account Profile', 'buddypress'), 'href' => $profile_link);
         // View Profile
         $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-public', 'title' => _x('View', 'My Account Profile sub nav', 'buddypress'), 'href' => $profile_link);
         // Edit Profile
         $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-edit', 'title' => _x('Edit', 'My Account Profile sub nav', 'buddypress'), 'href' => trailingslashit($profile_link . 'edit'));
         // Edit Avatar
         if (buddypress()->avatar->show_avatars) {
             $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-change-avatar', 'title' => _x('Change Profile Photo', 'My Account Profile sub nav', 'buddypress'), 'href' => trailingslashit($profile_link . 'change-avatar'));
         }
     }
     parent::setup_admin_bar($wp_admin_nav);
 }
开发者ID:AceMedia,项目名称:BuddyPress,代码行数:22,代码来源:bp-xprofile-loader.php

示例4: bp_xprofile_updated_profile_activity

/**
 * Add an activity item when a user has updated his profile.
 *
 * @since 2.0.0
 *
 * @param int   $user_id    ID of the user who has updated his profile.
 * @param array $field_ids  IDs of the fields submitted.
 * @param bool  $errors     True if validation or saving errors occurred, otherwise false.
 * @param array $old_values Pre-save xprofile field values and visibility levels.
 * @param array $new_values Post-save xprofile field values and visibility levels.
 *
 * @return bool True on success, false on failure.
 */
function bp_xprofile_updated_profile_activity($user_id, $field_ids = array(), $errors = false, $old_values = array(), $new_values = array())
{
    // If there were errors, don't post.
    if (!empty($errors)) {
        return false;
    }
    // Bail if activity component is not active.
    if (!bp_is_active('activity')) {
        return false;
    }
    // Don't post if there have been no changes, or if the changes are
    // related solely to non-public fields.
    $public_changes = false;
    foreach ($new_values as $field_id => $new_value) {
        $old_value = isset($old_values[$field_id]) ? $old_values[$field_id] : '';
        // Don't register changes to private fields.
        if (empty($new_value['visibility']) || 'public' !== $new_value['visibility']) {
            continue;
        }
        // Don't register if there have been no changes.
        if ($new_value === $old_value) {
            continue;
        }
        // Looks like we have public changes - no need to keep checking.
        $public_changes = true;
        break;
    }
    // Bail if no public changes.
    if (empty($public_changes)) {
        return false;
    }
    // Throttle to one activity of this type per 2 hours.
    $existing = bp_activity_get(array('max' => 1, 'filter' => array('user_id' => $user_id, 'object' => buddypress()->profile->id, 'action' => 'updated_profile')));
    // Default throttle time is 2 hours. Filter to change (in seconds).
    if (!empty($existing['activities'])) {
        /**
         * Filters the throttle time, in seconds, used to prevent excessive activity posting.
         *
         * @since 2.0.0
         *
         * @param int $value Throttle time, in seconds.
         */
        $throttle_period = apply_filters('bp_xprofile_updated_profile_activity_throttle_time', HOUR_IN_SECONDS * 2);
        $then = strtotime($existing['activities'][0]->date_recorded);
        $now = strtotime(bp_core_current_time());
        // Bail if throttled.
        if ($now - $then < $throttle_period) {
            return false;
        }
    }
    // If we've reached this point, assemble and post the activity item.
    $profile_link = trailingslashit(bp_core_get_user_domain($user_id) . bp_get_profile_slug());
    return (bool) xprofile_record_activity(array('user_id' => $user_id, 'primary_link' => $profile_link, 'component' => buddypress()->profile->id, 'type' => 'updated_profile'));
}
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:67,代码来源:bp-xprofile-activity.php

示例5: test_bp_xprofile_format_activity_action_updated_profile

 /**
  * @group activity_action
  * @group bp_xprofile_format_activity_action_updated_profile
  */
 public function test_bp_xprofile_format_activity_action_updated_profile()
 {
     $u = $this->factory->user->create();
     $a = $this->factory->activity->create(array('component' => buddypress()->profile->id, 'type' => 'updated_profile', 'user_id' => $u));
     $expected = sprintf(__('%s&#8217;s profile was updated', 'buddypress'), '<a href="' . bp_core_get_user_domain($u) . bp_get_profile_slug() . '/">' . bp_core_get_user_displayname($u) . '</a>');
     $a_obj = new BP_Activity_Activity($a);
     $this->assertSame($expected, $a_obj->action);
 }
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:12,代码来源:activity.php

示例6: bp_edit_profile_button

/**
 * Render an edit profile button.
 *
 * @since 1.0.0
 */
function bp_edit_profile_button()
{
    bp_button(array('id' => 'edit_profile', 'component' => 'xprofile', 'must_be_logged_in' => true, 'block_self' => true, 'link_href' => trailingslashit(bp_displayed_user_domain() . bp_get_profile_slug() . '/edit'), 'link_class' => 'edit', 'link_text' => __('Edit Profile', 'buddypress')));
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:9,代码来源:bp-xprofile-template.php

示例7: xprofile_screen_edit_profile

/**
 * Handles the display of the profile edit page by loading the correct template file.
 * Also checks to make sure this can only be accessed for the logged in users profile.
 *
 * @package BuddyPress XProfile
 * @uses bp_is_my_profile() Checks to make sure the current user being viewed equals the logged in user
 * @uses bp_core_load_template() Looks for and loads a template file within the current member theme (folder/filename)
 */
function xprofile_screen_edit_profile()
{
    if (!bp_is_my_profile() && !bp_current_user_can('bp_moderate')) {
        return false;
    }
    // Make sure a group is set.
    if (!bp_action_variable(1)) {
        bp_core_redirect(trailingslashit(bp_displayed_user_domain() . bp_get_profile_slug() . '/edit/group/1'));
    }
    // Check the field group exists
    if (!bp_is_action_variable('group') || !xprofile_get_field_group(bp_action_variable(1))) {
        bp_do_404();
        return;
    }
    // No errors
    $errors = false;
    // Check to see if any new information has been submitted
    if (isset($_POST['field_ids'])) {
        // Check the nonce
        check_admin_referer('bp_xprofile_edit');
        // Check we have field ID's
        if (empty($_POST['field_ids'])) {
            bp_core_redirect(trailingslashit(bp_displayed_user_domain() . bp_get_profile_slug() . '/edit/group/' . bp_action_variable(1)));
        }
        // Explode the posted field IDs into an array so we know which
        // fields have been submitted
        $posted_field_ids = wp_parse_id_list($_POST['field_ids']);
        $is_required = array();
        // Loop through the posted fields formatting any datebox values
        // then validate the field
        foreach ((array) $posted_field_ids as $field_id) {
            if (!isset($_POST['field_' . $field_id])) {
                if (!empty($_POST['field_' . $field_id . '_day']) && !empty($_POST['field_' . $field_id . '_month']) && !empty($_POST['field_' . $field_id . '_year'])) {
                    // Concatenate the values
                    $date_value = $_POST['field_' . $field_id . '_day'] . ' ' . $_POST['field_' . $field_id . '_month'] . ' ' . $_POST['field_' . $field_id . '_year'];
                    // Turn the concatenated value into a timestamp
                    $_POST['field_' . $field_id] = date('Y-m-d H:i:s', strtotime($date_value));
                }
            }
            $is_required[$field_id] = xprofile_check_is_required_field($field_id);
            if ($is_required[$field_id] && empty($_POST['field_' . $field_id])) {
                $errors = true;
            }
        }
        // There are errors
        if (!empty($errors)) {
            bp_core_add_message(__('Please make sure you fill in all required fields in this profile field group before saving.', 'buddypress'), 'error');
            // No errors
        } else {
            // Reset the errors var
            $errors = false;
            // Now we've checked for required fields, lets save the values.
            $old_values = $new_values = array();
            foreach ((array) $posted_field_ids as $field_id) {
                // Certain types of fields (checkboxes, multiselects) may come through empty. Save them as an empty array so that they don't get overwritten by the default on the next edit.
                $value = isset($_POST['field_' . $field_id]) ? $_POST['field_' . $field_id] : '';
                $visibility_level = !empty($_POST['field_' . $field_id . '_visibility']) ? $_POST['field_' . $field_id . '_visibility'] : 'public';
                // Save the old and new values. They will be
                // passed to the filter and used to determine
                // whether an activity item should be posted
                $old_values[$field_id] = array('value' => xprofile_get_field_data($field_id, bp_displayed_user_id()), 'visibility' => xprofile_get_field_visibility_level($field_id, bp_displayed_user_id()));
                // Update the field data and visibility level
                xprofile_set_field_visibility_level($field_id, bp_displayed_user_id(), $visibility_level);
                $field_updated = xprofile_set_field_data($field_id, bp_displayed_user_id(), $value, $is_required[$field_id]);
                $value = xprofile_get_field_data($field_id, bp_displayed_user_id());
                $new_values[$field_id] = array('value' => $value, 'visibility' => xprofile_get_field_visibility_level($field_id, bp_displayed_user_id()));
                if (!$field_updated) {
                    $errors = true;
                } else {
                    /**
                     * Fires on each iteration of an XProfile field being saved with no error.
                     *
                     * @since BuddyPress (1.1.0)
                     *
                     * @param int    $field_id ID of the field that was saved.
                     * @param string $value    Value that was saved to the field.
                     */
                    do_action('xprofile_profile_field_data_updated', $field_id, $value);
                }
            }
            /**
             * Fires after all XProfile fields have been saved for the current profile.
             *
             * @since BuddyPress (1.0.0)
             *
             * @param int   $value            Displayed user ID.
             * @param array $posted_field_ids Array of field IDs that were edited.
             * @param bool  $errors           Whether or not any errors occurred.
             * @param array $old_values       Array of original values before updated.
             * @param array $new_values       Array of newly saved values after update.
             */
            do_action('xprofile_updated_profile', bp_displayed_user_id(), $posted_field_ids, $errors, $old_values, $new_values);
//.........这里部分代码省略.........
开发者ID:espellcaste,项目名称:BuddyPress,代码行数:101,代码来源:bp-xprofile-screens.php

示例8: amt_bp_get_profile_slug

function amt_bp_get_profile_slug()
{
    if (function_exists('bp_get_profile_slug')) {
        return bp_get_profile_slug();
    }
    return 'profile';
}
开发者ID:ashenkar,项目名称:sanga,代码行数:7,代码来源:amt-utils.php

示例9: setup_nav

 /**
  * Set up fall-back component navigation if XProfile is inactive.
  *
  * @since 1.5.0
  *
  * @see BP_Component::setup_nav() for a description of arguments.
  *
  * @param array $main_nav Optional. See BP_Component::setup_nav() for
  *                        description.
  * @param array $sub_nav  Optional. See BP_Component::setup_nav() for
  *                        description.
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     // Don't set up navigation if there's no member.
     if (!is_user_logged_in() && !bp_is_user()) {
         return;
     }
     $is_xprofile_active = bp_is_active('xprofile');
     // Bail if XProfile component is active and there's no custom front page for the user.
     if (!bp_displayed_user_has_front_template() && $is_xprofile_active) {
         return;
     }
     // Determine user to use.
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     // Set slug to profile in case the xProfile component is not active
     $slug = bp_get_profile_slug();
     // Defaults to empty navs
     $this->main_nav = array();
     $this->sub_nav = array();
     if (!$is_xprofile_active) {
         $this->main_nav = array('name' => _x('Profile', 'Member profile main navigation', 'buddypress'), 'slug' => $slug, 'position' => 20, 'screen_function' => 'bp_members_screen_display_profile', 'default_subnav_slug' => 'public', 'item_css_id' => buddypress()->profile->id);
     }
     /**
      * Setup the subnav items for the member profile.
      *
      * This is required in case there's a custom front or in case the xprofile component
      * is not active.
      */
     $this->sub_nav = array('name' => _x('View', 'Member profile view', 'buddypress'), 'slug' => 'public', 'parent_url' => trailingslashit($user_domain . $slug), 'parent_slug' => $slug, 'screen_function' => 'bp_members_screen_display_profile', 'position' => 10);
     /**
      * If there's a front template the members component nav
      * will be there to display the user's front page.
      */
     if (bp_displayed_user_has_front_template()) {
         $main_nav = array('name' => _x('Home', 'Member Home page', 'buddypress'), 'slug' => 'front', 'position' => 5, 'screen_function' => 'bp_members_screen_display_profile', 'default_subnav_slug' => 'public');
         // We need a dummy subnav for the front page to load.
         $front_subnav = $this->sub_nav;
         $front_subnav['parent_slug'] = 'front';
         // In case the subnav is displayed in the front template
         $front_subnav['parent_url'] = trailingslashit($user_domain . 'front');
         // Set the subnav
         $sub_nav[] = $front_subnav;
         /**
          * If the profile component is not active, we need to create a new
          * nav to display the WordPress profile.
          */
         if (!$is_xprofile_active) {
             add_action('bp_members_setup_nav', array($this, 'setup_profile_nav'));
         }
         /**
          * If there's no front template and xProfile is not active, the members
          * component nav will be there to display the WordPress profile
          */
     } else {
         $main_nav = $this->main_nav;
         $sub_nav[] = $this->sub_nav;
     }
     parent::setup_nav($main_nav, $sub_nav);
 }
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:76,代码来源:class-bp-members-component.php

示例10: bp_members_edit_profile_url

/**
 * Filter the user profile URL to point to BuddyPress profile edit.
 *
 * @since 1.6.0
 *
 * @param string $url     WP profile edit URL.
 * @param int    $user_id ID of the user.
 * @param string $scheme
 *
 * @return string
 */
function bp_members_edit_profile_url($url, $user_id, $scheme = 'admin')
{
    // If xprofile is active, use profile domain link
    if (!is_admin() && bp_is_active('xprofile')) {
        $profile_link = trailingslashit(bp_core_get_user_domain($user_id) . bp_get_profile_slug() . '/edit');
        // Default to $url
    } else {
        $profile_link = $url;
    }
    /**
     * Filters the user profile URL to point to BuddyPress profile edit.
     *
     * @since 1.5.2
     *
     * @param string $url WP profile edit URL.
     * @param int    $user_id ID of the user.
     * @param string $scheme Scheme to use.
     */
    return apply_filters('bp_members_edit_profile_url', $profile_link, $url, $user_id, $scheme);
}
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:31,代码来源:bp-members-filters.php

示例11: test_member_profile_change_avatar

 function test_member_profile_change_avatar()
 {
     $this->go_to(bp_core_get_user_domain(bp_loggedin_user_id()) . bp_get_profile_slug() . '/change-avatar');
     $this->assertTrue(bp_is_user_change_avatar());
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:5,代码来源:xprofile.php


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