Function Reference: geodir_buddypress_post_status_on_listing

Summary

post status on author listing page.

Global Values

$wpdb
(object) (required) WordPress Database object.

Default: None
$post
(object) (required) The current post object.

Default: None

Package

GeoDirectory_BuddyPress_Integration

Change Log

Since: 1.0.0

Source File

geodir_buddypress_post_status_on_listing() is located in geodir_buddypress/includes/gdbuddypress_functions.php [Line: 1256]

Source Code

function geodir_buddypress_post_status_on_listing() {
	global $wpdb, $post;
		
	$html = '';
	if ( get_current_user_id() && !empty( $post ) && isset( $post->post_author ) && $post->post_author == get_current_user_id() && !geodir_is_page('author') ) {
			
		// we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
		$real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
		$status = "(";
		$status_icon = '';
		if ( $real_status == 'publish' ) {
			$status .= __( 'Published', GDBUDDYPRESS_TEXTDOMAIN );
		} else {
			$status .= __( 'Not published', GDBUDDYPRESS_TEXTDOMAIN );
			$status_icon = '';
		}
		$status .= ")";
		
		$html = ''.$status_icon.' ' . __( 'Status: ', GDBUDDYPRESS_TEXTDOMAIN ) . ''.$status.'';
	}
	echo $html;
}