本文整理汇总了PHP中bbp_is_user_home_edit函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_is_user_home_edit函数的具体用法?PHP bbp_is_user_home_edit怎么用?PHP bbp_is_user_home_edit使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_is_user_home_edit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_action
<?php
}
?>
<?php
do_action('bbp_user_edit_after');
?>
<fieldset class="submit">
<legend><?php
_e('Save Changes', 'bbpress');
?>
</legend>
<div>
<?php
bbp_edit_user_form_fields();
?>
<button type="submit" tabindex="<?php
bbp_tab_index();
?>
" id="bbp_user_edit_submit" name="bbp_user_edit_submit" class="button submit user-submit"><?php
bbp_is_user_home_edit() ? _e('Update Profile', 'bbpress') : _e('Update User', 'bbpress');
?>
</button>
</div>
</fieldset>
</form>
示例2: bbp_check_user_edit
/**
* Redirect if unathorized user is attempting to edit another user
*
* This is hooked to 'bbp_template_redirect' and controls the conditions under
* which a user can edit another user (or themselves.) If these conditions are
* met. We assume a user cannot perform this task, and look for ways they can
* earn the ability to access this template.
*
* @since bbPress (r3605)
*
* @uses bbp_is_topic_edit()
* @uses current_user_can()
* @uses bbp_get_topic_id()
* @uses wp_safe_redirect()
* @uses bbp_get_topic_permalink()
*/
function bbp_check_user_edit()
{
// Bail if not editing a topic
if (!bbp_is_single_user_edit()) {
return;
}
// Default to false
$redirect = true;
// Allow user to edit their own profile
if (bbp_is_user_home_edit()) {
$redirect = false;
// Allow if current user can edit the displayed user
} elseif (current_user_can('edit_user', bbp_get_displayed_user_id())) {
$redirect = false;
// Allow if user can manage network users, or edit-any is enabled
} elseif (current_user_can('manage_network_users') || apply_filters('enable_edit_any_user_configuration', false)) {
$redirect = false;
}
// Maybe redirect back to profile page
if (true === $redirect) {
wp_safe_redirect(bbp_get_user_profile_url(bbp_get_displayed_user_id()));
exit;
}
}
示例3: bbp_title
/**
* Custom page title for bbPress pages
*
* @since bbPress (r2788)
*
* @param string $title Optional. The title (not used).
* @param string $sep Optional, default is '»'. How to separate the
* various items within the page title.
* @param string $seplocation Optional. Direction to display title, 'right'.
* @uses bbp_is_single_user() To check if it's a user profile page
* @uses bbp_is_single_user_edit() To check if it's a user profile edit page
* @uses bbp_is_user_home() To check if the profile page is of the current user
* @uses get_query_var() To get the user id
* @uses get_userdata() To get the user data
* @uses bbp_is_single_forum() To check if it's a forum
* @uses bbp_get_forum_title() To get the forum title
* @uses bbp_is_single_topic() To check if it's a topic
* @uses bbp_get_topic_title() To get the topic title
* @uses bbp_is_single_reply() To check if it's a reply
* @uses bbp_get_reply_title() To get the reply title
* @uses is_tax() To check if it's the tag page
* @uses get_queried_object() To get the queried object
* @uses bbp_is_single_view() To check if it's a view
* @uses bbp_get_view_title() To get the view title
* @uses apply_filters() Calls 'bbp_raw_title' with the title
* @uses apply_filters() Calls 'bbp_profile_page_wp_title' with the title,
* separator and separator location
* @return string The tite
*/
function bbp_title($title = '', $sep = '»', $seplocation = '')
{
// Store original title to compare
$_title = $title;
/** Archives **************************************************************/
// Forum Archive
if (bbp_is_forum_archive()) {
$title = bbp_get_forum_archive_title();
// Topic Archive
} elseif (bbp_is_topic_archive()) {
$title = bbp_get_topic_archive_title();
/** Singles ***************************************************************/
// Forum page
} elseif (bbp_is_single_forum()) {
$title = sprintf(__('Forum: %s', 'bbpress'), bbp_get_forum_title());
// Topic page
} elseif (bbp_is_single_topic()) {
$title = sprintf(__('Topic: %s', 'bbpress'), bbp_get_topic_title());
// Replies
} elseif (bbp_is_single_reply()) {
$title = bbp_get_reply_title();
// Topic tag page (or edit)
} elseif (bbp_is_topic_tag() || bbp_is_topic_tag_edit() || get_query_var('bbp_topic_tag')) {
$term = get_queried_object();
$title = sprintf(__('Topic Tag: %s', 'bbpress'), $term->name);
/** Users *****************************************************************/
// Profile page
} elseif (bbp_is_single_user()) {
// Current users profile
if (bbp_is_user_home()) {
$title = __('Your Profile', 'bbpress');
// Other users profile
} else {
$userdata = get_userdata(bbp_get_user_id());
$title = sprintf(__('%s\'s Profile', 'bbpress'), $userdata->display_name);
}
// Profile edit page
} elseif (bbp_is_single_user_edit()) {
// Current users profile
if (bbp_is_user_home_edit()) {
$title = __('Edit Your Profile', 'bbpress');
// Other users profile
} else {
$userdata = get_userdata(bbp_get_user_id());
$title = sprintf(__('Edit %s\'s Profile', 'bbpress'), $userdata->display_name);
}
/** Views *****************************************************************/
// Views
} elseif (bbp_is_single_view()) {
$title = sprintf(__('View: %s', 'bbpress'), bbp_get_view_title());
}
// Filter the raw title
$title = apply_filters('bbp_raw_title', $title, $sep, $seplocation);
// Compare new title with original title
if ($title == $_title) {
return $title;
}
// Temporary separator, for accurate flipping, if necessary
$t_sep = '%WP_TITILE_SEP%';
$prefix = '';
if (!empty($title)) {
$prefix = " {$sep} ";
}
// sep on right, so reverse the order
if ('right' == $seplocation) {
$title_array = explode($t_sep, $title);
$title_array = array_reverse($title_array);
$title = implode(" {$sep} ", $title_array) . $prefix;
// sep on left, do not reverse
} else {
$title_array = explode($t_sep, $title);
//.........这里部分代码省略.........
示例4: bbp_profile_update_role
/**
* Helper function hooked to 'bbp_profile_update' action to save or
* update user roles and capabilities.
*
* @since bbPress (r4235)
*
* @param int $user_id
* @uses bbp_reset_user_caps() to reset caps
* @usse bbp_save_user_caps() to save caps
*/
function bbp_profile_update_role($user_id = 0)
{
// Bail if no user ID was passed
if (empty($user_id)) {
return;
}
// Bail if no role
if (!isset($_POST['bbp-forums-role'])) {
return;
}
// Fromus role we want the user to have
$new_role = sanitize_text_field($_POST['bbp-forums-role']);
$forums_role = bbp_get_user_role($user_id);
// Bail if no role change
if ($new_role === $forums_role) {
return;
}
// Bail if trying to set their own role
if (bbp_is_user_home_edit()) {
return;
}
// Bail if current user cannot promote the passing user
if (!current_user_can('promote_user', $user_id)) {
return;
}
// Set the new forums role
bbp_set_user_role($user_id, $new_role);
}
示例5: do_action
<?php
}
?>
<?php
do_action('bbp_user_edit_after');
?>
<fieldset class="submit">
<legend><?php
esc_html_e('Save Changes', 'monsoon');
?>
</legend>
<div>
<?php
bbp_edit_user_form_fields();
?>
<button type="submit" tabindex="<?php
bbp_tab_index();
?>
" id="bbp_user_edit_submit" name="bbp_user_edit_submit" class="button submit user-submit"><?php
bbp_is_user_home_edit() ? esc_html_e('Update Profile', 'monsoon') : esc_html_e('Update User', 'monsoon');
?>
</button>
</div>
</fieldset>
</form>
示例6: do_action
<?php
}
?>
<?php
do_action('bbp_user_edit_after');
?>
<fieldset class="submit">
<legend><?php
_e('Save changes', 'govintranet');
?>
</legend>
<div>
<?php
bbp_edit_user_form_fields();
?>
<label for="bbp_user_edit_submit" class="sr-only"><?php
bbp_is_user_home_edit() ? _e('Update profile', 'govintranet') : _e('Update user', 'govintranet');
?>
</label>
<input type="submit" id="bbp_user_edit_submit" name="bbp_user_edit_submit" class="button submit user-submit" value="<?php
bbp_is_user_home_edit() ? _e('Update profile', 'govintranet') : _e('Update user', 'govintranet');
?>
" />
</div>
</fieldset>
</form>
示例7: bbp_title
//.........这里部分代码省略.........
// Reply edit page
} elseif (bbp_is_reply_edit()) {
$new_title['text'] = bbp_get_reply_title();
$new_title['format'] = esc_attr__('Reply Edit: %s', 'bbpress');
// Topic tag edit page
} elseif (bbp_is_topic_tag_edit()) {
$new_title['text'] = bbp_get_topic_tag_name();
$new_title['format'] = esc_attr__('Topic Tag Edit: %s', 'bbpress');
/** Singles ***************************************************************/
// Forum page
} elseif (bbp_is_single_forum()) {
$new_title['text'] = bbp_get_forum_title();
$new_title['format'] = esc_attr__('Forum: %s', 'bbpress');
// Topic page
} elseif (bbp_is_single_topic()) {
$new_title['text'] = bbp_get_topic_title();
$new_title['format'] = esc_attr__('Topic: %s', 'bbpress');
// Replies
} elseif (bbp_is_single_reply()) {
$new_title['text'] = bbp_get_reply_title();
// Topic tag page
} elseif (bbp_is_topic_tag() || get_query_var('bbp_topic_tag')) {
$new_title['text'] = bbp_get_topic_tag_name();
$new_title['format'] = esc_attr__('Topic Tag: %s', 'bbpress');
/** Users *****************************************************************/
// Profile page
} elseif (bbp_is_single_user()) {
// User is viewing their own profile
if (bbp_is_user_home()) {
$new_title['text'] = esc_attr_x('Your', 'User viewing his/her own profile', 'bbpress');
// User is viewing someone else's profile (so use their display name)
} else {
$new_title['text'] = sprintf(esc_attr_x("%s's", 'User viewing another users profile', 'bbpress'), get_userdata(bbp_get_user_id())->display_name);
}
// User topics created
if (bbp_is_single_user_topics()) {
$new_title['format'] = esc_attr__("%s Topics", 'bbpress');
// User rueplies created
} elseif (bbp_is_single_user_replies()) {
$new_title['format'] = esc_attr__("%s Replies", 'bbpress');
// User favorites
} elseif (bbp_is_favorites()) {
$new_title['format'] = esc_attr__("%s Favorites", 'bbpress');
// User subscriptions
} elseif (bbp_is_subscriptions()) {
$new_title['format'] = esc_attr__("%s Subscriptions", 'bbpress');
// User "home"
} else {
$new_title['format'] = esc_attr__("%s Profile", 'bbpress');
}
// Profile edit page
} elseif (bbp_is_single_user_edit()) {
// Current user
if (bbp_is_user_home_edit()) {
$new_title['text'] = esc_attr__('Edit Your Profile', 'bbpress');
// Other user
} else {
$new_title['text'] = get_userdata(bbp_get_user_id())->display_name;
$new_title['format'] = esc_attr__("Edit %s's Profile", 'bbpress');
}
/** Views *****************************************************************/
// Views
} elseif (bbp_is_single_view()) {
$new_title['text'] = bbp_get_view_title();
$new_title['format'] = esc_attr__('View: %s', 'bbpress');
/** Search ****************************************************************/
// Search
} elseif (bbp_is_search()) {
$new_title['text'] = bbp_get_search_title();
}
// This filter is deprecated. Use 'bbp_before_title_parse_args' instead.
$new_title = apply_filters('bbp_raw_title_array', $new_title);
// Set title array defaults
$new_title = bbp_parse_args($new_title, array('text' => $title, 'format' => '%s'), 'title');
// Get the formatted raw title
$new_title = sprintf($new_title['format'], $new_title['text']);
// Filter the raw title
$new_title = apply_filters('bbp_raw_title', $new_title, $sep, $seplocation);
// Compare new title with original title
if ($new_title === $title) {
return $title;
}
// Temporary separator, for accurate flipping, if necessary
$t_sep = '%WP_TITILE_SEP%';
$prefix = '';
if (!empty($new_title)) {
$prefix = " {$sep} ";
}
// sep on right, so reverse the order
if ('right' === $seplocation) {
$new_title_array = array_reverse(explode($t_sep, $new_title));
$new_title = implode(" {$sep} ", $new_title_array) . $prefix;
// sep on left, do not reverse
} else {
$new_title_array = explode($t_sep, $new_title);
$new_title = $prefix . implode(" {$sep} ", $new_title_array);
}
// Filter and return
return apply_filters('bbp_title', $new_title, $sep, $seplocation);
}
示例8: do_action
<?php
}
?>
<?php
do_action('bbp_user_edit_after');
?>
<fieldset class="submit">
<legend><?php
_e('Save Changes', 'firmasite');
?>
</legend>
<div>
<?php
bbp_edit_user_form_fields();
?>
<button type="submit" class="btn btn-primary" tabindex="<?php
bbp_tab_index();
?>
" id="bbp_user_edit_submit" name="bbp_user_edit_submit" class="button submit user-submit"><?php
bbp_is_user_home_edit() ? _e('Update Profile', 'firmasite') : _e('Update User', 'firmasite');
?>
</button>
</div>
</fieldset>
</form>
示例9: bbp_notice_edit_user_is_super_admin
/**
* Super admin privileges notice
*
* @since 2.0.0 bbPress (r2688)
*
* @uses is_multisite() To check if the blog is multisite
* @uses bbp_is_single_user() To check if it's the profile page
* @uses bbp_is_single_user_edit() To check if it's the profile edit page
* @uses current_user_can() To check if the current user can manage network
* options
* @uses bbp_get_displayed_user_id() To get the displayed user id
* @uses is_super_admin() To check if the user is super admin
* @uses bbp_is_user_home() To check if it's the user home
* @uses bbp_is_user_home_edit() To check if it's the user home edit
*/
function bbp_notice_edit_user_is_super_admin()
{
if (is_multisite() && (bbp_is_single_user() || bbp_is_single_user_edit()) && current_user_can('manage_network_options') && is_super_admin(bbp_get_displayed_user_id())) {
?>
<div class="bbp-template-notice important">
<ul>
<li><?php
bbp_is_user_home() || bbp_is_user_home_edit() ? esc_html_e('You have super admin privileges.', 'bbpress') : esc_html_e('This user has super admin privileges.', 'bbpress');
?>
</li>
</ul>
</div>
<?php
}
}
示例10: do_action
?>
</fieldset>
<?php
}
?>
<?php
do_action('bbp_user_edit_after');
?>
<fieldset class="submit">
<legend><?php
esc_html_e('Save Changes', 'bbpress');
?>
</legend>
<div>
<?php
bbp_edit_user_form_fields();
?>
<button type="submit" id="bbp_user_edit_submit" name="bbp_user_edit_submit" class="button submit user-submit"><?php
bbp_is_user_home_edit() ? esc_html_e('Update Profile', 'bbpress') : esc_html_e('Update User', 'bbpress');
?>
</button>
</div>
</fieldset>
</form>
示例11: bbp_check_user_edit
/**
* Redirect if unathorized user is attempting to edit another user
*
* This is hooked to 'bbp_template_redirect' and controls the conditions under
* which a user can edit another user (or themselves.) If these conditions are
* met, we assume a user cannot perform this task, and look for ways they can
* earn the ability to access this template.
*
* @since 2.1.0 bbPress (r3605)
*
* @uses bbp_is_single_user_edit()
* @uses current_user_can()
* @uses bbp_get_displayed_user_id()
* @uses bbp_redirect()
* @uses bbp_get_user_profile_url()
*/
function bbp_check_user_edit()
{
// Bail if not editing a user
if (!bbp_is_single_user_edit()) {
return;
}
// Default to false
$redirect = true;
$user_id = bbp_get_displayed_user_id();
// Allow user to edit their own profile
if (bbp_is_user_home_edit()) {
$redirect = false;
// Allow if current user can edit the displayed user
} elseif (current_user_can('edit_user', $user_id)) {
$redirect = false;
// Allow if user can manage network users, or edit-any is enabled
} elseif (current_user_can('manage_network_users') || apply_filters('enable_edit_any_user_configuration', false)) {
$redirect = false;
}
// Allow conclusion to be overridden
$redirect = (bool) apply_filters('bbp_check_user_edit', $redirect, $user_id);
// Bail if not redirecting
if (false === $redirect) {
return;
}
// Filter redirect URL
$profile_url = bbp_get_user_profile_url($user_id);
$redirect_to = apply_filters('bbp_check_user_edit_redirect_to', $profile_url, $user_id);
// Redirect
bbp_redirect($redirect_to);
}
示例12: bbpress_user_profile
/**
* Form to display on the bbPress user profile edit screen
*
* @since 1.0.0
*/
public function bbpress_user_profile()
{
if (!bbp_is_user_home_edit()) {
return;
}
$user_id = get_current_user_id();
$profileuser = get_userdata($user_id);
echo '<div>';
echo '<label for="basic-local-avatar">' . __('Avatar', 'basic-user-avatars') . '</label>';
echo '<fieldset class="bbp-form avatar">';
echo get_avatar($profileuser->ID);
$options = get_option('basic_user_avatars_caps');
if (empty($options['basic_user_avatars_caps']) || current_user_can('upload_files')) {
// Nonce security ftw
wp_nonce_field('basic_user_avatar_nonce', '_basic_user_avatar_nonce', false);
// File upload input
echo '<br /><input type="file" name="basic-user-avatar" id="basic-local-avatar" /><br />';
if (empty($profileuser->basic_user_avatar)) {
echo '<span class="description" style="margin-left:0;">' . __('No local avatar is set. Use the upload field to add a local avatar.', 'basic-user-avatars') . '</span>';
} else {
echo '<input type="checkbox" name="basic-user-avatar-erase" value="1" style="width:auto" /> ' . __('Delete local avatar', 'basic-user-avatars') . '<br />';
echo '<span class="description" style="margin-left:0;">' . __('Replace the local avatar by uploading a new avatar, or erase the local avatar (falling back to a gravatar) by checking the delete option.', 'basic-user-avatars') . '</span>';
}
} else {
if (empty($profileuser->basic_user_avatar)) {
echo '<span class="description" style="margin-left:0;">' . __('No local avatar is set. Set up your avatar at Gravatar.com.', 'basic-user-avatars') . '</span>';
} else {
echo '<span class="description" style="margin-left:0;">' . __('You do not have media management permissions. To change your local avatar, contact the site administrator.', 'basic-user-avatars') . '</span>';
}
}
echo '</fieldset>';
echo '</div>';
?>
<script type="text/javascript">var form = document.getElementById('bbp-your-profile');form.encoding = 'multipart/form-data';form.setAttribute('enctype', 'multipart/form-data');</script>
<?php
}
示例13: bp_registration_bbpress_allowed_areas
/**
* Check if on an allowed bbPress component
*
* @since 4.2.0
*
* @return boolean true if an allowed component, false otherwise
*/
function bp_registration_bbpress_allowed_areas()
{
if (!function_exists('bbp_is_user_home')) {
return false;
}
if (bbp_is_user_home() || bbp_is_user_home_edit()) {
return true;
}
return false;
}
示例14: _e
?>
" />
<span class="description"><?php
_e('Type your new password again.', 'bbpress');
?>
</span><br />
</p>
<?php
do_action('bbp_user_edit_after_account');
?>
<?php
if (current_user_can('edit_users') && !bbp_is_user_home_edit()) {
?>
<h2 class="entry-title"><?php
_e('User Role', 'bbpress');
?>
</h2>
<?php
do_action('bbp_user_edit_before_role');
?>
<?php
if (is_multisite() && is_super_admin() && current_user_can('manage_network_options')) {
?>
示例15: do_action
<?php
do_action('bbp_user_edit_after_role');
?>
</fieldset>
<?php
}
?>
<?php
do_action('bbp_user_edit_after');
?>
</div>
<div class="panel-footer">
<?php
bbp_edit_user_form_fields();
?>
<button type="submit" tabindex="<?php
bbp_tab_index();
?>
" id="bbp_user_edit_submit" name="bbp_user_edit_submit" class="button submit user-submit"><?php
bbp_is_user_home_edit() ? _e('Update Profile', 'omega-td') : _e('Update User', 'omega-td');
?>
</button>
</div>
</div>
</form>