2012-07-11 16:28:51 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
function bp_dedication_slug() {
|
|
|
|
|
echo bp_get_dedication_slug();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function bp_get_dedication_slug() {
|
|
|
|
|
global $bp;
|
|
|
|
|
|
|
|
|
|
$dedication_slug = isset( $bp->dedications->slug ) ? $bp->dedications->slug : BP_DEDICATION_SLUG;
|
|
|
|
|
|
|
|
|
|
return apply_filters( 'bp_get_dedication_slug', $dedication_slug );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function bp_dedication_get_dedications_from_user( $user_id ) {
|
|
|
|
|
if ( !$user_id )
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
$args = array(
|
2012-09-07 11:45:02 +00:00
|
|
|
'post_status' => array('publish', 'private'),
|
2012-10-11 17:04:11 +00:00
|
|
|
'numberposts' => -1,
|
2012-07-13 15:46:22 +00:00
|
|
|
'category' => get_cat_id('dedication'),
|
2012-07-11 16:28:51 +00:00
|
|
|
'author' => $user_id
|
|
|
|
|
);
|
|
|
|
|
$posts_array = get_posts( $args );
|
|
|
|
|
|
|
|
|
|
return maybe_unserialize( $posts_array );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function bp_dedication_get_dedications_to_user( $user_id ) {
|
|
|
|
|
if ( !$user_id )
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
$args = array(
|
2012-09-07 11:45:02 +00:00
|
|
|
'post_status' => array('publish', 'private'),
|
2012-10-11 17:04:11 +00:00
|
|
|
'numberposts' => -1,
|
2012-07-11 16:28:51 +00:00
|
|
|
'category' => 'dedication',
|
2012-07-18 14:35:38 +00:00
|
|
|
'meta_key' => 'ghostpool_destination_user_id',
|
2012-07-17 10:34:42 +00:00
|
|
|
'meta_value' => $user_id
|
2012-07-11 16:28:51 +00:00
|
|
|
);
|
|
|
|
|
$posts_array = get_posts( $args );
|
|
|
|
|
|
|
|
|
|
return maybe_unserialize( $posts_array );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function bp_is_dedication_component() {
|
|
|
|
|
$is_dedication_component = bp_is_current_component( BP_DEDICATION_SLUG );
|
|
|
|
|
|
|
|
|
|
return apply_filters( 'bp_is_dedication_component', $is_dedication_component );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function bp_dedication_new_dedication_form_action() {
|
|
|
|
|
echo wp_nonce_url(bp_dedication_get_new_dedication_form_action(), 'bp_dedication_create_new_dedication');
|
|
|
|
|
}
|
|
|
|
|
function bp_dedication_get_new_dedication_form_action() {
|
|
|
|
|
global $bp;
|
|
|
|
|
return apply_filters( 'bp_dedication_new_dedication_form_action', bp_get_loggedin_user_link() . bp_get_dedication_slug() . '/new-dedication/create' );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Crea una lista de amigos para mandar la invitacion */
|
|
|
|
|
function bp_new_dedication_invite_member_list() {
|
|
|
|
|
echo bp_get_new_dedication_invite_member_list();
|
|
|
|
|
}
|
|
|
|
|
function bp_get_new_dedication_invite_member_list( $args = '' ) {
|
|
|
|
|
global $bp;
|
|
|
|
|
|
|
|
|
|
$defaults = array(
|
|
|
|
|
'group_id' => false,
|
|
|
|
|
'separator' => 'li'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$r = wp_parse_args( $args, $defaults );
|
|
|
|
|
extract( $r, EXTR_SKIP );
|
|
|
|
|
|
|
|
|
|
$user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id;
|
|
|
|
|
$friends = friends_get_alphabetically( $user_id );
|
|
|
|
|
|
|
|
|
|
$items = array();
|
|
|
|
|
foreach ($friends["users"] as $friend) {
|
|
|
|
|
$items[] = '<' . $separator . '><input type="checkbox" name="friends[] id="f-' . $friend->id . '" value="' .
|
|
|
|
|
esc_html( $friend->id ) . '" /> ' . $friend->fullname . '</' . $separator . '>';
|
|
|
|
|
}
|
|
|
|
|
return implode( "\n", (array)$items );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function bp_dedication_options() {
|
|
|
|
|
global $iaoptions;
|
|
|
|
|
|
|
|
|
|
// We set our own options cache because of some stupid limitations in the way that page
|
|
|
|
|
// loads work
|
|
|
|
|
if ( !empty( $iaoptions ) ) {
|
|
|
|
|
$options = $iaoptions;
|
|
|
|
|
} else {
|
|
|
|
|
if ( function_exists( 'bp_update_option' ) ) {
|
|
|
|
|
$options = bp_get_option( 'bp_dedication' );
|
|
|
|
|
} else {
|
|
|
|
|
$options = get_option( 'bp_dedication' );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( !$options )
|
|
|
|
|
$options = array();
|
|
|
|
|
|
|
|
|
|
$defaults_array = array();
|
|
|
|
|
/*$defaults_array = array(
|
|
|
|
|
'max_invites' => 5,
|
|
|
|
|
'allow_email_invitations' => 'all',
|
|
|
|
|
'message_is_customizable' => 'yes',
|
|
|
|
|
'subject_is_customizable' => 'no',
|
|
|
|
|
'can_send_group_invites_email' => 'yes',
|
|
|
|
|
'bypass_registration_lock' => 'yes',
|
|
|
|
|
'email_visibility_toggle' => 'nolimit',
|
|
|
|
|
'email_since_toggle' => 'no',
|
|
|
|
|
'days_since' => 0,
|
|
|
|
|
'email_role_toggle' => 'no',
|
|
|
|
|
'minimum_role' => 'subscriber',
|
|
|
|
|
'email_blacklist_toggle' => 'no',
|
|
|
|
|
'email_blacklist' => '',
|
|
|
|
|
'group_invites_can_admin' => 'anyone',
|
|
|
|
|
'group_invites_can_group_admin' => 'anyone',
|
|
|
|
|
'group_invites_can_group_mod' => 'anyone',
|
|
|
|
|
'group_invites_can_group_member' => 'anyone',
|
|
|
|
|
'cloudsponge_enabled' => 'off',
|
|
|
|
|
'email_limit_invites_toggle' => 'no',
|
|
|
|
|
'limit_invites_per_user' => 10
|
|
|
|
|
);*/
|
|
|
|
|
|
|
|
|
|
foreach ( $defaults_array as $key => $value ) {
|
|
|
|
|
if ( !isset( $options[$key] ) )
|
|
|
|
|
$options[$key] = $value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$iaoptions = $options;
|
|
|
|
|
|
|
|
|
|
return apply_filters( 'bp_dedication_options', $options );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|