本文整理汇总了PHP中bp_core_current_time函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_core_current_time函数的具体用法?PHP bp_core_current_time怎么用?PHP bp_core_current_time使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_core_current_time函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: record_activity
private static function record_activity($args = array())
{
// Default activity args
$activity = array_merge(array('id' => null, 'user_id' => get_current_user_id(), 'type' => '', 'action' => '', 'item_id' => '', 'secondary_item_id' => '', 'content' => '', 'primary_link' => '', 'component' => 'dln-product-component', 'recorded_time' => bp_core_current_time(), 'hide_sitewide' => false), $args);
// Add the activity
return bp_activity_add($activity);
}
示例2: create_item
/**
* Create a single message
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|WP_REST_Response
*/
public function create_item($request)
{
if (!empty($request['id'])) {
return new WP_Error('bp_json_message_exists', __('Cannot create existing message.', BP_API_PLUGIN_SLUG), array('status' => 400));
}
$message = $this->prepare_item_for_database($request);
$message_id = messages_new_message(array('sender_id' => $message->sender_id ? $message->sender_id : bp_loggedin_user_id(), 'thread_id' => $message->thread_id, 'recipients' => $message->recipients, 'subject' => $message->subject, 'content' => $message->content, 'date_sent' => $message->date_sent ? $message->date_sent : bp_core_current_time()));
if (!$message_id) {
return new WP_Error('bp_json_message_create', __('Error creating new message.', BP_API_PLUGIN_SLUG), array('status' => 500));
}
$this->update_additional_fields_for_object($message, $request);
/**
* Fires after a message is created via the REST API
*
* @param object $message Data used to create message
* @param WP_REST_Request $request Request object.
* @param bool $bool A boolean that is false.
*/
do_action('bp_json_insert_message', $message, $request, false);
$response = $this->get_item(array('id' => $message_id, 'context' => 'view'));
$response = rest_ensure_response($response);
$response->set_status(201);
$response->header('Location', rest_url('/users/' . $message_id));
return $response;
}
示例3: friends_add_friend
function friends_add_friend($initiator_userid, $friend_userid, $force_accept = false)
{
global $bp;
$friendship = new BP_Friends_Friendship();
if ((int) $friendship->is_confirmed) {
return true;
}
$friendship->initiator_user_id = $initiator_userid;
$friendship->friend_user_id = $friend_userid;
$friendship->is_confirmed = 0;
$friendship->is_limited = 0;
$friendship->date_created = bp_core_current_time();
if ($force_accept) {
$friendship->is_confirmed = 1;
}
if ($friendship->save()) {
if (!$force_accept) {
// Add the on screen notification
bp_core_add_notification($friendship->initiator_user_id, $friendship->friend_user_id, $bp->friends->id, 'friendship_request');
// Send the email notification
friends_notification_new_request($friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id);
do_action('friends_friendship_requested', $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id);
} else {
do_action('friends_friendship_accepted', $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id);
}
return true;
}
return false;
}
示例4: __construct
/**
* Constructor.
*
* @param int $id Optional. ID of the message.
*/
public function __construct($id = null)
{
$this->date_sent = bp_core_current_time();
$this->sender_id = bp_loggedin_user_id();
if (!empty($id)) {
$this->populate($id);
}
}
示例5: friends_record_activity
/**
* Record an activity item related to the Friends component.
*
* A wrapper for {@link bp_activity_add()} that provides some Friends-specific
* defaults.
*
* @since 1.0.0
*
* @see bp_activity_add() for more detailed description of parameters and
* return values.
*
* @param array|string $args {
* An array of arguments for the new activity item. Accepts all parameters
* of {@link bp_activity_add()}. The one difference is the following
* argument, which has a different default here:
* @type string $component Default: the id of your Friends component
* (usually 'friends').
* }
* @return bool See {@link bp_activity_add()}.
*/
function friends_record_activity($args = '')
{
if (!bp_is_active('activity')) {
return false;
}
$r = wp_parse_args($args, array('user_id' => bp_loggedin_user_id(), 'action' => '', 'content' => '', 'primary_link' => '', 'component' => buddypress()->friends->id, 'type' => false, 'item_id' => false, 'secondary_item_id' => false, 'recorded_time' => bp_core_current_time(), 'hide_sitewide' => false));
return bp_activity_add($r);
}
示例6: add_notification
/**
*
* @param int $post_id
* @param int $post_author_id
* @param int $user_id
*
* @return int|bool notification id on success or false
*/
function add_notification($post_id, $post_author_id, $user_id)
{
global $rtmedia;
$args_add_noification = array('item_id' => $post_id, 'user_id' => $post_author_id, 'component_name' => $this->component_id, 'component_action' => $this->component_action . $post_id, 'secondary_item_id' => $user_id, 'date_notified' => bp_core_current_time());
if (isset($rtmedia->options['buddypress_enableNotification']) && 0 !== intval($rtmedia->options['buddypress_enableNotification'])) {
return bp_notifications_add_notification($args_add_noification);
}
return false;
}
示例7: create_object
function create_object($args)
{
if (!isset($args['creator_id'])) {
$args['creator_id'] = get_current_user_id();
}
$group_id = groups_create_group($args);
groups_update_groupmeta($group_id, 'total_member_count', 1);
groups_update_groupmeta($group_id, 'last_activity', bp_core_current_time());
return $this->get_object_by_id($group_id);
}
示例8: EnrolledCourse
public static function EnrolledCourse($student_id, $course_id, $status)
{
global $wpdb;
$group_id = get_post_meta($course_id, 'buddypress_id', true);
// Get BuddyPress
$bp = buddypress();
$group = $wpdb->get_row($wpdb->prepare("SELECT g.* FROM {$bp->groups->table_name} g WHERE g.id = %d", $group_id));
groups_invite_user(array('user_id' => $student_id, 'group_id' => $group_id, 'inviter_id' => $group->creator_id, 'date_modified' => bp_core_current_time(), 'is_confirmed' => 1));
$forums = bbp_get_group_forum_ids($group_id);
bbp_add_user_forum_subscription(bbp_get_current_user_id(), $forums[0]);
}
示例9: populate
/**
* Populate necessary variables.
*
* @since 1.0.0
* @access protected
*
* @param int $muted_id The ID of the user to be muted.
* @param int $user_id The ID of the user initiating the mute request.
*/
protected function populate($muted_id, $user_id)
{
$this->muted_id = (int) $muted_id;
$this->user_id = (int) $user_id;
$this->date_recorded = bp_core_current_time();
global $bp, $wpdb;
$id = $wpdb->get_var($wpdb->prepare("SELECT id FROM {$bp->mute->table_name} WHERE muted_id = %d AND user_id = %d", $this->muted_id, $this->user_id));
if ($id) {
$this->id = $id;
}
}
示例10: groups_update_last_activity
function groups_update_last_activity($group_id = 0)
{
global $bp;
if (empty($group_id)) {
$group_id = $bp->groups->current_group->id;
}
if (empty($group_id)) {
return false;
}
groups_update_groupmeta($group_id, 'last_activity', bp_core_current_time());
}
示例11: bp_course_add_notification
function bp_course_add_notification($args = '')
{
global $bp;
if (!bp_is_active('notifications') || !function_exists('bp_notifications_add_notification')) {
return;
}
$defaults = array('user_id' => $bp->loggedin_user->id, 'item_id' => false, 'secondary_item_id' => false, 'component_name' => 'course', 'component_action' => '', 'date_notified' => bp_core_current_time(), 'is_new' => 1);
$r = wp_parse_args($args, $defaults);
extract($r);
return bp_notifications_add_notification(array('user_id' => $user_id, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'component_name' => $component_name, 'component_action' => $component_action, 'date_notified' => $date_notified, 'is_new' => $is_new));
}
示例12: friends_record_activity
function friends_record_activity($args = '')
{
global $bp;
if (!bp_is_active('activity')) {
return false;
}
$defaults = array('user_id' => $bp->loggedin_user->id, 'action' => '', 'content' => '', 'primary_link' => '', 'component' => $bp->friends->id, 'type' => false, 'item_id' => false, 'secondary_item_id' => false, 'recorded_time' => bp_core_current_time(), 'hide_sitewide' => false);
$r = wp_parse_args($args, $defaults);
extract($r, EXTR_SKIP);
return bp_activity_add(array('user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide));
}
示例13: groups_left_group
function groups_left_group($group_id, $user_id = 0)
{
global $bp;
if (empty($user_id)) {
$user_id = bp_loggedin_user_id();
}
// Record this in activity streams
groups_record_activity(array('type' => 'left_group', 'item_id' => $group_id, 'user_id' => $user_id));
// Modify group meta
groups_update_groupmeta($group_id, 'last_activity', bp_core_current_time());
return true;
}
示例14: test_add
/**
* @group add
*/
public function test_add()
{
$time = bp_core_current_time();
$args = array('domain' => 'foo', 'path' => 'bar', 'title' => 'Foo bar', 'user_login' => 'user1', 'user_email' => 'user1@example.com', 'registered' => $time, 'activation_key' => '12345', 'meta' => array('field_1' => 'Foo Bar', 'meta1' => 'meta2'));
$signup = BP_Signup::add($args);
$this->assertNotEmpty($signup);
$s = new BP_Signup($signup);
// spot check
$this->assertSame($signup, $s->id);
$this->assertSame('user1', $s->user_login);
$this->assertSame('12345', $s->activation_key);
}
示例15: bp_media_record_activity
function bp_media_record_activity($args = '')
{
global $bp;
if (!function_exists('bp_activity_add')) {
return false;
}
$defaults = array('id' => false, 'action' => '', 'content' => '', 'component' => BP_MEDIA_SLUG, 'type' => false, 'primary_link' => '', 'user_id' => $bp->loggedin_user->id, 'item_id' => false, 'secondary_item_id' => false, 'recorded_time' => bp_core_current_time(), 'hide_sitewide' => false);
add_filter('bp_activity_allowed_tags', 'bp_media_override_allowed_tags');
$r = wp_parse_args($args, $defaults);
extract($r);
$activity_id = bp_activity_add(array('id' => $id, 'user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide));
return $activity_id;
}