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


PHP bp_activity_user_can_delete函数代码示例

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


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

示例1: update_activity_privacy_option

 /**
  * Hooked to `bp_activity_entry_meta`
  *
  * Show privacy dropdown inside activity loop along with activity meta buttons.
  */
 function update_activity_privacy_option()
 {
     if (function_exists('bp_activity_user_can_delete') && bp_activity_user_can_delete() && is_rtmedia_privacy_enable() && is_rtmedia_privacy_user_overide() && apply_filters('rtm_load_bp_activity_privacy_update_ui', true)) {
         global $activities_template;
         $selected = 0;
         if (isset($activities_template->activity->privacy)) {
             $selected = intval($activities_template->activity->privacy);
         }
         //todo strict standard error
         self::select_privacy_ui(true, 'rtm-ac-privacy-' . $activities_template->activity->id, array('rtm-activity-privacy-opt'), $selected);
     }
 }
开发者ID:neerukoul,项目名称:rtMedia,代码行数:17,代码来源:RTMediaPrivacy.php

示例2: test_user_can_delete_for_nonadmin

 /**
  * Test if a non-admin can delete their own activity.
  */
 public function test_user_can_delete_for_nonadmin()
 {
     // save the current user and override logged-in user
     $old_user = get_current_user_id();
     $u = $this->factory->user->create();
     $this->set_current_user($u);
     // create an activity update for the user
     $this->factory->activity->create(array('component' => buddypress()->activity->id, 'type' => 'activity_update', 'user_id' => $u));
     // start the activity loop
     bp_has_activities(array('user_id' => $u));
     while (bp_activities()) {
         bp_the_activity();
         // assert!
         $this->assertTrue(bp_activity_user_can_delete());
     }
     // reset
     $this->set_current_user($old_user);
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:21,代码来源:template.php

示例3: 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

示例4: bp_dtheme_delete_activity

function bp_dtheme_delete_activity()
{
    global $bp;
    // Check the nonce
    check_admin_referer('bp_activity_delete_link');
    if (!is_user_logged_in() || empty($_POST['id']) || !is_numeric($_POST['id'])) {
        echo '-1';
        return false;
    }
    $activity = new BP_Activity_Activity((int) $_POST['id']);
    // Check access
    if (empty($activity->user_id) || !bp_activity_user_can_delete($activity)) {
        echo '-1';
        return false;
    }
    // Call the action before the delete so plugins can still fetch information about it
    do_action('bp_activity_before_action_delete_activity', $activity->id, $activity->user_id);
    if (!bp_activity_delete(array('id' => $activity->id, 'user_id' => $activity->user_id))) {
        echo '-1<div id="message" class="error"><p>' . __('There was a problem when deleting. Please try again.', 'buddypress') . '</p></div>';
        return false;
    }
    do_action('bp_activity_action_delete_activity', $activity->id, $activity->user_id);
    return true;
}
开发者ID:hscale,项目名称:webento,代码行数:24,代码来源:ajax.php

示例5: _e

            ?>
"><?php 
            _e('Remove Favorite', 'firmasite');
            ?>
</a>

					<?php 
        }
        ?>

				<?php 
    }
    ?>

				<?php 
    if (bp_activity_user_can_delete()) {
        bp_activity_delete_link();
    }
    ?>

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

			</div>

		<?php 
}
?>

	</div>
开发者ID:paulmedwal,项目名称:edxforumspublic,代码行数:31,代码来源:entry.php

示例6: bp_legacy_theme_delete_activity

/**
 * Deletes an Activity item received via a POST request.
 *
 * @return mixed String on error, void on success
 * @since BuddyPress (1.2)
 */
function bp_legacy_theme_delete_activity()
{
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    // Check the nonce
    check_admin_referer('bp_activity_delete_link');
    if (!is_user_logged_in()) {
        exit('-1');
    }
    if (empty($_POST['id']) || !is_numeric($_POST['id'])) {
        exit('-1');
    }
    $activity = new BP_Activity_Activity((int) $_POST['id']);
    // Check access
    if (!bp_activity_user_can_delete($activity)) {
        exit('-1');
    }
    /** This action is documented in bp-activity/bp-activity-actions.php */
    do_action('bp_activity_before_action_delete_activity', $activity->id, $activity->user_id);
    if (!bp_activity_delete(array('id' => $activity->id, 'user_id' => $activity->user_id))) {
        exit('-1<div id="message" class="error bp-ajax-message"><p>' . __('There was a problem when deleting. Please try again.', 'buddypress') . '</p></div>');
    }
    /** This action is documented in bp-activity/bp-activity-actions.php */
    do_action('bp_activity_action_delete_activity', $activity->id, $activity->user_id);
    exit;
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:34,代码来源:buddypress-functions.php

示例7: bp_dtheme_delete_activity

/**
 * Deletes an Activity item received via a POST request.
 *
 * @return mixed String on error, void on success
 * @since BuddyPress (1.2)
 */
function bp_dtheme_delete_activity()
{
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    // Check the nonce
    check_admin_referer('bp_activity_delete_link');
    if (!is_user_logged_in()) {
        exit('-1');
    }
    if (empty($_POST['id']) || !is_numeric($_POST['id'])) {
        exit('-1');
    }
    $activity = new BP_Activity_Activity((int) $_POST['id']);
    // Check access
    if (empty($activity->user_id) || !bp_activity_user_can_delete($activity)) {
        exit('-1');
    }
    // Call the action before the delete so plugins can still fetch information about it
    do_action('bp_activity_before_action_delete_activity', $activity->id, $activity->user_id);
    if (!bp_activity_delete(array('id' => $activity->id, 'user_id' => $activity->user_id))) {
        exit('-1<div id="message" class="error"><p>' . __('There was a problem when deleting. Please try again.', 'logicalboneshug') . '</p></div>');
    }
    do_action('bp_activity_action_delete_activity', $activity->id, $activity->user_id);
    exit;
}
开发者ID:raminjan,项目名称:logicalbones_hug,代码行数:33,代码来源:ajax.php

示例8: show_comment_form

	function show_comment_form() {
		$activity_id = get_post_meta($this->id, 'bp_media_child_activity', true);
		if (bp_has_activities(array(
				'display_comments' => 'stream',
				'include' => $activity_id,
				'max' => 1
			))) :
			while (bp_activities()) : bp_the_activity();
				do_action('bp_before_activity_entry');
				?>
				<div class="activity">
					<ul id="activity-stream" class="activity-list item-list">
						<li class="activity activity_update" id="activity-<?php echo $activity_id; ?>">
							<div class="activity-content">
								<?php do_action('bp_activity_entry_content'); ?>
								<?php if (is_user_logged_in()) : ?>
									<div class="activity-meta no-ajax">
										<?php if (bp_activity_can_comment()) : ?>
											<a href="<?php bp_get_activity_comment_link(); ?>" class="button acomment-reply bp-primary-action" id="acomment-comment-<?php bp_activity_id(); ?>"><?php printf(__('Comment <span>%s</span>', 'buddypress'), bp_activity_get_comment_count()); ?></a>
										<?php endif; ?>
										<?php if (bp_activity_can_favorite()) : ?>
											<?php if (!bp_get_activity_is_favorite()) : ?>
												<a href="<?php bp_activity_favorite_link(); ?>" class="button fav bp-secondary-action" title="<?php esc_attr_e('Mark as Favorite', 'buddypress'); ?>"><?php _e('Favorite', 'buddypress') ?></a>
											<?php else : ?>
												<a href="<?php bp_activity_unfavorite_link(); ?>" class="button unfav bp-secondary-action" title="<?php esc_attr_e('Remove Favorite', 'buddypress'); ?>"><?php _e('Remove Favorite', 'buddypress') ?></a>
											<?php endif; ?>
										<?php endif; ?>
										<?php if (bp_activity_user_can_delete()) bp_activity_delete_link(); ?>
										<?php do_action('bp_activity_entry_meta'); ?>
									</div>
								<?php endif; ?>
							</div>
							<?php do_action('bp_before_activity_entry_comments'); ?>
							<?php if (( is_user_logged_in() && bp_activity_can_comment() ) || bp_activity_get_comment_count()) : ?>
								<div class="activity-comments">
									<?php bp_activity_comments(); ?>
									<?php if (is_user_logged_in()) : ?>
										<form action="<?php bp_activity_comment_form_action(); ?>" method="post" id="ac-form-<?php bp_activity_id(); ?>" class="ac-form"<?php bp_activity_comment_form_nojs_display(); ?>>
											<div class="ac-reply-avatar"><?php bp_loggedin_user_avatar('width=' . BP_AVATAR_THUMB_WIDTH . '&height=' . BP_AVATAR_THUMB_HEIGHT); ?></div>
											<div class="ac-reply-content">
												<div class="ac-textarea">
													<textarea id="ac-input-<?php bp_activity_id(); ?>" class="ac-input" name="ac_input_<?php bp_activity_id(); ?>"></textarea>
												</div>
												<input type="submit" name="ac_form_submit" value="<?php _e('Post', 'buddypress'); ?>" /> &nbsp; <?php _e('or press esc to cancel.', 'buddypress'); ?>
												<input type="hidden" name="comment_form_id" value="<?php bp_activity_id(); ?>" />
											</div>
											<?php do_action('bp_activity_entry_comments'); ?>
											<?php wp_nonce_field('new_activity_comment', '_wpnonce_new_activity_comment'); ?>
										</form>
									<?php endif; ?>
								</div>
							<?php endif; ?>
							<?php do_action('bp_after_activity_entry_comments'); ?>
						</li>
					</ul>
				</div>
				<?php
			endwhile;
		else: ?>
			<div class="activity">
					<ul id="activity-stream" class="activity-list item-list">
						<li class="activity activity_update" id="activity-<?php echo $activity_id; ?>">
							<div class="activity-content">
								<?php do_action('bp_activity_entry_content'); ?>
								<?php if (is_user_logged_in()) : ?>
									<div class="activity-meta no-ajax">
																				
										<a href="<?php echo $this->get_delete_url(); ?>" class="button item-button bp-secondary-action delete-activity-single confirm" rel="nofollow">Delete</a>
									</div>
								<?php endif; ?>
							</div>
						</li>
					</ul>
				</div>
			<?
		endif;
	}
开发者ID:rolandinsh,项目名称:buddypress-media,代码行数:77,代码来源:bp-media-class-wordpress.php

示例9: bp_activity_action_delete_activity

/**
 * Delete specific activity item and redirect to previous page.
 *
 * @since 1.1.0
 *
 * @uses bp_is_activity_component()
 * @uses bp_is_current_action()
 * @uses bp_action_variable()
 * @uses check_admin_referer()
 * @uses bp_activity_user_can_delete()
 * @uses do_action() Calls 'bp_activity_before_action_delete_activity' hook to allow actions to be taken before the activity is deleted.
 * @uses bp_activity_delete()
 * @uses bp_core_add_message()
 * @uses do_action() Calls 'bp_activity_action_delete_activity' hook to allow actions to be taken after the activity is deleted.
 * @uses bp_core_redirect()
 *
 * @param int $activity_id Activity id to be deleted. Defaults to 0.
 * @return bool False on failure.
 */
function bp_activity_action_delete_activity($activity_id = 0)
{
    // Not viewing activity or action is not delete.
    if (!bp_is_activity_component() || !bp_is_current_action('delete')) {
        return false;
    }
    if (empty($activity_id) && bp_action_variable(0)) {
        $activity_id = (int) bp_action_variable(0);
    }
    // Not viewing a specific activity item.
    if (empty($activity_id)) {
        return false;
    }
    // Check the nonce.
    check_admin_referer('bp_activity_delete_link');
    // Load up the activity item.
    $activity = new BP_Activity_Activity($activity_id);
    // Check access.
    if (!bp_activity_user_can_delete($activity)) {
        return false;
    }
    /**
     * Fires before the deletion so plugins can still fetch information about it.
     *
     * @since 1.5.0
     *
     * @param int $activity_id The activity ID.
     * @param int $user_id     The user associated with the activity.
     */
    do_action('bp_activity_before_action_delete_activity', $activity_id, $activity->user_id);
    // Delete the activity item and provide user feedback.
    if (bp_activity_delete(array('id' => $activity_id, 'user_id' => $activity->user_id))) {
        bp_core_add_message(__('Activity deleted successfully', 'buddypress'));
    } else {
        bp_core_add_message(__('There was an error when deleting that activity', 'buddypress'), 'error');
    }
    /**
     * Fires after the deletion so plugins can act afterwards based on the activity.
     *
     * @since 1.1.0
     *
     * @param int $activity_id The activity ID.
     * @param int $user_id     The user associated with the activity.
     */
    do_action('bp_activity_action_delete_activity', $activity_id, $activity->user_id);
    // Check for the redirect query arg, otherwise let WP handle things.
    if (!empty($_GET['redirect_to'])) {
        bp_core_redirect(esc_url($_GET['redirect_to']));
    } else {
        bp_core_redirect(wp_get_referer());
    }
}
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:71,代码来源:bp-activity-actions.php

示例10: bp_activity_action_delete_activity

/**
 * Delete specific activity item and redirect to previous page.
 *
 * @since BuddyPress (1.1)
 *
 * @param int $activity_id Activity id to be deleted. Defaults to 0.
 *
 * @uses bp_is_activity_component()
 * @uses bp_is_current_action()
 * @uses bp_action_variable()
 * @uses check_admin_referer()
 * @uses bp_activity_user_can_delete()
 * @uses do_action() Calls 'bp_activity_before_action_delete_activity' hook to allow actions to be taken before the activity is deleted.
 * @uses bp_activity_delete()
 * @uses bp_core_add_message()
 * @uses do_action() Calls 'bp_activity_action_delete_activity' hook to allow actions to be taken after the activity is deleted.
 * @uses bp_core_redirect()
 *
 * @return bool False on failure.
 */
function bp_activity_action_delete_activity($activity_id = 0)
{
    // Not viewing activity or action is not delete
    if (!bp_is_activity_component() || !bp_is_current_action('delete')) {
        return false;
    }
    if (empty($activity_id) && bp_action_variable(0)) {
        $activity_id = (int) bp_action_variable(0);
    }
    // Not viewing a specific activity item
    if (empty($activity_id)) {
        return false;
    }
    // Check the nonce
    check_admin_referer('bp_activity_delete_link');
    // Load up the activity item
    $activity = new BP_Activity_Activity($activity_id);
    // Check access
    if (!bp_activity_user_can_delete($activity)) {
        return false;
    }
    // Call the action before the delete so plugins can still fetch information about it
    do_action('bp_activity_before_action_delete_activity', $activity_id, $activity->user_id);
    // Delete the activity item and provide user feedback
    if (bp_activity_delete(array('id' => $activity_id, 'user_id' => $activity->user_id))) {
        bp_core_add_message(__('Activity deleted successfully', 'buddypress'));
    } else {
        bp_core_add_message(__('There was an error when deleting that activity', 'buddypress'), 'error');
    }
    do_action('bp_activity_action_delete_activity', $activity_id, $activity->user_id);
    // Check for the redirect query arg, otherwise let WP handle things
    if (!empty($_GET['redirect_to'])) {
        bp_core_redirect(esc_url($_GET['redirect_to']));
    } else {
        bp_core_redirect(wp_get_referer());
    }
}
开发者ID:eresyyl,项目名称:mk,代码行数:57,代码来源:bp-activity-actions.php

示例11: gears_get_activity_stream

 /**
  * @deprecated gears_get_activity_stream
  */
 function gears_get_activity_stream()
 {
     $output = '';
     $output .= '<li class="' . bp_get_activity_css_class() . '" id="activity-' . bp_get_activity_id() . '">';
     $output .= '<div class="activity-avatar">';
     $output .= '<a class="gears-activity-avatar" title="' . __('View Profile', 'gears') . '" href="' . bp_get_activity_user_link() . '">';
     $output .= bp_get_activity_avatar();
     $output .= '</a>';
     $output .= '</div>';
     // activity content
     $output .= '<div class="activity-content">';
     $output .= '<div class="activity-header">';
     $output .= bp_get_activity_action();
     $output .= '</div>';
     $output .= '<div class="activity-inner">';
     if (bp_activity_has_content()) {
         $output .= bp_get_activity_content_body();
     }
     $output .= '</div>';
     do_action('bp_activity_entry_content');
     $output .= '<div class="activity-meta">';
     if (bp_get_activity_type() == 'activity_comment') {
         $output .= '<a href="' . bp_get_activity_thread_permalink() . '" class="view bp-secondary-action" title="' . __('View Conversation', 'gears') . '">' . __('View Conversation', 'gears') . '</a>';
     }
     if (is_user_logged_in()) {
         if (bp_activity_can_favorite()) {
             if (!bp_get_activity_is_favorite()) {
                 $output .= '<a href="' . bp_get_activity_favorite_link() . '" class="fav bp-secondary-action" title="' . esc_attr(__('Mark as Favorite', 'gears')) . '">' . __('Favorite', 'gears') . '</a>';
             } else {
                 $output .= '<a href="' . bp_get_activity_unfavorite_link() . '" class="unfav bp-secondary-action" title="' . esc_attr(__('Remove Favorite', 'gears')) . '">' . __('Remove Favorite', 'gears') . '</a>';
             }
         }
         if (bp_activity_user_can_delete()) {
             $output .= bp_get_activity_delete_link();
         }
         do_action('bp_activity_entry_meta');
     }
     $output .= '</div>';
     if (bp_get_activity_type() == 'activity_comment') {
         $output .= '<a href="' . bp_get_activity_thread_permalink() . '" class="view bp-secondary-action" title="' . __('View Conversation', 'gears') . '">' . __('View Conversation', 'gears');
     }
     // end bp_get_activity_type()
     $output .= '</div>';
     // end activity content
     $output .= '</li>';
     return $output;
 }
开发者ID:poweronio,项目名称:mbsite,代码行数:50,代码来源:library.php

示例12: _clean_up_content_images

 /**
  * Callback for activity images removal
  * @param  string $content Shortcode content parsed for images
  * @param  BP_Activity_Activity Activity which contains the shortcode - used for privilege check 
  * @return bool
  */
 private function _clean_up_content_images($content, $activity)
 {
     if (!Bpfb_Data::get('cleanup_images')) {
         return false;
     }
     if (!bp_activity_user_can_delete($activity)) {
         return false;
     }
     $images = BpfbCodec::extract_images($content);
     if (empty($images)) {
         return false;
     }
     foreach ($images as $image) {
         $info = pathinfo(trim($image));
         // Make sure we have the info we need
         if (empty($info['filename']) || empty($info['extension'])) {
             continue;
         }
         // Make sure we're dealing with the image
         $ext = strtolower($info['extension']);
         if (!in_array($ext, self::_get_supported_image_extensions())) {
             continue;
         }
         // Construct the filenames
         $thumbnail = bpfb_get_image_dir($activity_blog_id) . $info['filename'] . '-bpfbt.' . $ext;
         $full = bpfb_get_image_dir($activity_blog_id) . trim($image);
         // Actually remove the images
         if (file_exists($thumbnail) && is_writable($thumbnail)) {
             @unlink($thumbnail);
         }
         if (file_exists($full) && is_writable($full)) {
             @unlink($full);
         }
     }
     return true;
 }
开发者ID:pausaura,项目名称:agora_nodes,代码行数:42,代码来源:class_bpfb_binder.php


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