'',
'page' => '',
'recent' => '',
'header' => '',
'title' => '',
'count' => '',
'random' => '',
'type' => 'manage',
'id' => '',
'noid' => '',
'exclude' => '',
'submit' => '',
'state1' => '',
'state2' => '',
'state3' => '',
);
echo amen_list_requests( $the_amen );
}
/**************************************
* ADD SHORTCODE FOR LISTING REQUESTS
**************************************/
function amen_list_requests( $amen_atts ) {
global $amen_options;
extract( shortcode_atts( array(
'author' => '',
'page' => '',
'recent' => '',
'header' => '',
'title' => '',
'count' => '',
'random' => '',
'type' => 'list',
'id' => '',
'noid' => '',
'exclude' => '',
'submit' => '',
'state1' => '',
'state2' => '',
'state3' => '',
), $amen_atts ) );
// DEFINE SHORTCODE ARG ARRAY
$the_amen = array(
'author' => ' ' . $author,
'page' => $page,
'recent' => $recent,
'header' => $header,
'count' => $count,
'random' => $random,
'type' => $type,
'id' => $id,
'noid' => $noid,
'exclude' => ' ' . $exclude,
'submit' => $submit,
'state1' => $state1,
'state2' => $state2,
'state3' => $state3,
);
'' == $header ? $the_amen['header'] = $title : FALSE;
$the_amen['submit'] = '' == $the_amen['submit'] ? $amen_options['submit_text'] : $the_amen['submit'];
$the_amen['state1'] = '' == $the_amen['state1'] ? $amen_options['submitted_state_one'] : $the_amen['state1'];
$the_amen['state2'] = '' == $the_amen['state2'] ? $amen_options['submitted_state_two'] : $the_amen['state2'];
$the_amen['state3'] = '' == $the_amen['state3'] ? $amen_options['submitted_state_three'] : $the_amen['state3'];
$the_amen['recent'] = $count;
$the_amen['type'] = $type;
$the_amen['id'] = $id;
$amen_request_list = amen_query_requests( $the_amen );
return $amen_request_list;
unset( $the_amen );
}
add_shortcode( 'amen', 'amen_list_requests' );
function amen_query_requests( $the_amen ) {
global $amen_session;
global $amen_options;
global $post;
ob_start();
/**************************************
* INCLUDE TWEET BUTTON JAVASCRIPT
**************************************/
if ( !( strpos( $the_amen['exclude'], 'tweet' ) > 0 ) && $amen_options['tweet_public_requests'] ) {
echo '';
}
?>
0 ? '
Manage Prayer Requests
' : '';
?>
user_login . ')';
break;
case 'displayname':
$amen_author_display = ' (' . wp_get_current_user()->display_name . ')';
break;
default:
$amen_author_display = '';
break;
}
} else {
$amen_author_display = '' != $amen_options['public_user'] ? ' (' . $amen_options['public_user'] . ')' : '';
}
echo $amen_author_display;
}
?>
created_by )->user_login ) > 0 && ( '' != $r->praying_tag && $r->praying_tag == $the_amen['page'] ) ) {
$amen_list_this_request = TRUE;
} else { $amen_list_this_request = FALSE; }
} elseif ( ' ' != $the_amen['author'] && '' == $the_amen['page'] ) {
if ( strpos( $the_amen['author'], get_userdata( $r->created_by )->user_login ) > 0 ) {
$amen_list_this_request = TRUE;
} else { $amen_list_this_request = FALSE; }
} elseif ( ' ' == $the_amen['author'] && '' != $the_amen['page'] ) {
if ( '' != $r->praying_tag && $r->praying_tag == $the_amen['page'] ) {
$amen_list_this_request = TRUE;
} else { $amen_list_this_request = FALSE; }
} elseif ( ' ' == $the_amen['author'] && '' == $the_amen['page'] ) {
$amen_list_this_request = TRUE;
} else {
$amen_list_this_request = FALSE;
}
if ( $amen_list_this_request ) {
if ( '' == $the_amen['recent'] || $i < intval( $the_amen['recent'] ) ) {
$praying = intval($r->praying) == 1;
$active = intval($r->active) == 1;
$urgent = intval($r->urgency) == 1;
$private = intval($r->privacy) == 1;
$approved = intval($r->approved) == 1;
$cssClasses = 'pray_request_wrap';
!$active ? $cssClasses .= $cssClasses .= ' amen-inactive' : '';
!$urgent ? $cssClasses .= '' : $cssClasses .= ' pray_request_urgent';
!$private ? $cssClasses .= '' : $cssClasses .= ' pray_request_private';
$approved ? $cssClasses .= '' : $cssClasses .= ' pray_request_not_approved';
if ($i == 0 && '' != $the_amen['header']) { amen_header( $the_amen['header'] ); }
?>
created_by ) ? get_userdata( $r->created_by )->user_login : $amen_options['public_user'];
$amen_author_display .= ( get_userdata( $r->created_by ) && 'manage' == $the_amen['type'] ) ? ' (' . get_userdata( $r->created_by )->display_name . ')' : FALSE;
$amen_author_display .= ': ';
} else {
$amen_author_display = '';
}
break;
case 'username':
if ( !( strpos( $the_amen['exclude'], 'author' ) > 0 ) ) {
$amen_author_display = get_userdata( $r->created_by ) ? get_userdata( $r->created_by )->user_login : $amen_options['public_user'];
if ( current_user_can( 'delete_users' ) ) {
$amen_author_display .= ( get_userdata( $r->created_by ) && 'manage' == $the_amen['type'] ) ? ' (' . get_userdata( $r->created_by )->display_name . ')' : FALSE;
}
$amen_author_display .= ': ';
}
break;
case 'displayname':
if ( !( strpos( $the_amen['exclude'], 'author' ) > 0 ) ) {
$amen_author_display = get_userdata( $r->created_by ) ? get_userdata( $r->created_by )->display_name : $amen_options['public_user'];
if ( current_user_can( 'delete_users' ) ) {
$amen_author_display .= ( get_userdata( $r->created_by ) && 'manage' == $the_amen['type'] ) ? ' (' . get_userdata( $r->created_by )->user_login . ')' : FALSE;
}
$amen_author_display .= ': ';
}
break;
default:
$amen_author_display = '';
break;
}
if ( current_user_can( 'delete_users' ) && 'manage' == $the_amen['type'] ) { $amen_id = '
[Amen-ID: ' . $r->id . '] '; } else { $amen_id = ''; }
if ( 'manage' == $the_amen['type'] ) {
$amen_id .= $private ? 'Privately ' : 'Publicly ';
$amen_id .= $active ? 'Active' : 'Inactive
';
}
echo '
' . $amen_id . $amen_author_display . $r->prayer_item;
if ( 'manage' == $the_amen['type'] ) {
?>
';
if ( !( strpos( $the_amen['exclude'], 'counter' ) > 0 ) && $amen_options['enable_submit_count'] && $r->approved ) {
echo '
';
}
if ( !$r->approved ) {
echo '
Pending Approval
';
} elseif ( !( strpos( $the_amen['exclude'], 'tweet' ) > 0 ) && !$r->privacy && $r->approved && $amen_options['tweet_public_requests'] ) {
echo '
';
$amen_options['prepend_name_to_tweet'] ? $amen_add_name = $amen_author_display : FALSE;
if ( 'hashtag' == $amen_options['tweet_type'] ) {
$amen_options['hashtag_in_button'] ? $amen_display_hashtag = '?button_hashtag=' . $amen_options['custom_hashtag'] : $amen_display_hashtag = '';
$amen_options['custom_hashtag'] ? $amen_custom_hashtag = ' #' . $amen_options['custom_hashtag'] : $amen_custom_hashtag = '';
echo '';
} elseif ( 'share_count' == $amen_options['tweet_type'] ) {
echo '';
}
echo '
';
} elseif ( $r->privacy ) {
echo '
Private Request
';
}
echo '
';
if ( '' != $r->prayer_updated ) {
echo '
' . $r->prayer_updated . '
';
}
if ( ( is_user_logged_in() || $amen_options['allow_public_requests'] ) && 'manage' == $the_amen['type'] ) {
?>
user_login ) === FALSE ) || current_user_can( 'delete_users' ) ) {
$tagged_pages = $wpdb->get_results(
"
SELECT meta_value, post_id
FROM $wpdb->postmeta
WHERE meta_key = 'praying'
"
);
foreach ( $tagged_pages as $tagged_page ) {
if ( $tagged_page->meta_value == get_userdata( $r->created_by )->user_login ) {
echo get_the_title( $tagged_page->post_id ) . ', ';
}
}
echo $r->praying_tag ? ' On Pages: ' . get_the_title( $r->praying_tag ) . ' | ' : '';
}
?>
[created_at; ?>]
created_by ) ) ) { ?>
| |
|
|
1 || $count == 0 ) ? $amen_text = str_replace( '{s}', 's', $amen_text ) : $amen_text = str_replace( '{s}', '', $amen_text );
$count == 1 ? $amen_text = str_replace( '{1s}', 's', $amen_text ) : $amen_text = str_replace( '{1s}', '', $amen_text );
return $amen_text;
unset($amen_text);
}
?>