コード例 #1
0
ファイル: 1.6.php プロジェクト: mawilliamson/wordpress
/**
 * @deprecated 1.6.0
 * @deprecated Renamed to groups_get_id() for greater consistency
 */
function groups_check_group_exists($group_slug)
{
    _deprecated_function(__FUNCTION__, '1.6', 'groups_get_id()');
    return groups_get_id($group_slug);
}
コード例 #2
0
ファイル: events.php プロジェクト: tamriel-foundry/apoc2
 /**
  * Process new event RSVPs
  * @version 2.0
  */
 function new_rsvp()
 {
     $rsvps = $this->rsvps;
     $new_rsvp = array();
     // Clean each field individually
     if (!isset($_POST['attendance'])) {
         $error = 'You must select your expected attendance!';
     } else {
         $new_rsvp['rsvp'] = $_POST['attendance'];
     }
     if ($this->req_role && empty($_POST['rsvp-role']) && $_POST['attendance'] != 'no') {
         $error = 'You must select your preferred role!';
     } elseif ($this->req_role) {
         $new_rsvp['role'] = $_POST['rsvp-role'];
     }
     if (isset($_POST['rsvp-comment'])) {
         $new_rsvp['comment'] = sanitize_text_field($_POST['rsvp-comment']);
     }
     // If there are no errors, we can save the stuff
     if (!isset($error)) {
         // Update the postmeta
         $user_id = get_current_user_id();
         $rsvps[$user_id] = $new_rsvp;
         update_post_meta($this->post_id, 'event_rsvps', $rsvps);
         bp_core_add_message('Thank you for responding!');
         // Clear notifications on each group calendar
         foreach ($this->calendars as $calendar) {
             if (is_group_calendar($calendar->term_id)) {
                 global $bp;
                 $group_id = groups_get_id($calendar->slug);
                 bp_notifications_delete_notifications_by_item_id($user_id, $group_id, $bp->groups->id, 'new_calendar_event', $this->post_id);
             }
         }
         // Redirect
         wp_redirect(get_the_permalink());
         // Otherwise, throw the error message
     } else {
         bp_core_add_message($error, 'error');
     }
 }
コード例 #3
0
/**
 * Get a user's membership status in multiple groups. The group ids should be in provided as post arguments ('grpids').
 *
 * @return string HTML
 * @since BuddyPress (1.2)
 */
function bp_legacy_theme_ajax_get_joinleave_group_status()
{
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    error_log("og joileavegroup " . groups_get_id("students"));
    $myretval = array();
    // Cast gid as integer
    $my_group_ids = $_POST['grpids'];
    error_log("og group status:" . print_r($my_group_ids, true));
    for ($myidx = 0; $myidx < count($my_group_ids); $myidx++) {
        $group_id = (int) $my_group_ids[$myidx];
        //$_POST['gid'];
        error_log("og group id:" . $group_id . " ");
        $bp_loggedin_user_id = bp_loggedin_user_id();
        if (groups_is_user_banned($bp_loggedin_user_id, $group_id)) {
            $myretval[$my_group_ids[$myidx]] = "";
        } else {
            if ($group = groups_get_group(array('group_id' => $group_id, 'populate_extras' => true))) {
                //return;
                //$htmlstrtoreturn = bp_legacy_theme_ajax_get_user_joinleave_group_status($group, $bp_loggedin_user_id);
                $htmlstrtoreturn = bp_legacy_theme_ajax_get_user_joinleave_group_status($group);
                $myretval[$my_group_ids[$myidx]] = $htmlstrtoreturn;
            }
        }
    }
    echo json_encode($myretval);
    exit;
}
コード例 #4
0
ファイル: bp.php プロジェクト: kubens/Snippets
 protected function _get_group()
 {
     $group_id = groups_get_id($this->params['bp_item']);
     $group = groups_get_group(compact('group_id'));
     return $group;
 }