latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Membership Page

Home Forums Community Forum Membership Page

This topic contains 7 replies, has 3 voices. Last updated by  Eduan 4 years, 5 months ago.

Topic Author Topic
Posted: Tuesday Jul 24th, 2012 at 10:00 am #20081

Hi s2member experts. Im trying to use this code on my membership landing page but its not pulling any content due to the “join” page not pulling post ID.

Can somebody help me implement this code into the large block of code below?

Thanks so much. I have a awesome site in the build stages focusing on s2members functions.

<?php $_g = stripslashes_deep ($_GET);

if (isset ($_g["_s2member_seeking"]["post"]) ) : ?>

	<?php $post_id = esc_html ($_g["_s2member_seeking"]["post"]) ;
	
	$post_object = get_post( $post_id ); 
 ?>
<?php  
/**
 * This template file determines how to display the post thumbnail,
 * video, or gallery. Used across multiple files.
 *
 * @package    WordPress
 * @subpackage Debut
 * @since      2.0
 */

// Used to detect page template type, in which place the $is_page var is set
global $is_page;

// Get theme options
$of_disable_post_attributes = ti_get_option( 'disable_post_attributes', 0 );

// Returns an array with a href and class. The link and class are generated
// depending upon if "Instant View" is enabled in theme options
$link = ti_get_instant_view_link();

// Set post thumbnail
$the_post_thumbnail = '';
if ( has_post_thumbnail() ) {
	if ( isset( $is_page ) && $is_page == 'home' || $is_page == 'template-post-gallery' )
	  $the_post_thumbnail = get_the_post_thumbnail( $post->ID, 'thumbnail-wide' );
	
	elseif ( isset( $is_page ) && $is_page == 'template-full' )
	  $the_post_thumbnail = get_the_post_thumbnail( $post->ID, 'full-image' );
	
	elseif( is_singular() )
		if ( ! ti_has_sidebar() )
	  	$the_post_thumbnail = get_the_post_thumbnail( $post->ID, 'full-image' );
	  else
	  	$the_post_thumbnail = get_the_post_thumbnail( $post->ID, 'singular-image' );
	else
	  $the_post_thumbnail = get_the_post_thumbnail( $post->ID, 'thumbnail-wide' ); 
}

?>

	
	
<?php 
/**
 * Media Embed Setup
 *
 * Check for media embed option. If the page is singular,
 * check to see that the media embed has not been disabled
 * via the Theme Options.
 *
 * If not singular, check to see if the post has a thumbnail.
 * If the post does in fact have a thumbnail, add a link to
 * the media embed. Depending upon the Theme Options, the media
 * embed may link to the post or display in a modal box. Those
 * options were determined above.
 */
 
 

 
if ( has_media_embed() ) : ?>
	
	<?php if ( is_singular() ) : ?>
	
	

	
	
	
		<?php if ( $of_disable_post_attributes['media_embed'] == 0 ) : ?>
		
			<figure class="entry-thumbnail">
			
				<?php
				/* Determine page type and set video size */
				if ( isset( $is_page ) && $is_page == 'template-full' ) :
				  $video_width = 840;
				  $video_height = 473;
				elseif ( isset( $is_page ) && $is_page == 'template-centered' ) :
				  $video_width = 530;
				  $video_height = 298;
				elseif ( is_page() && ! ti_has_sidebar() ) :
				  $video_width = 840;
				  $video_height = 473;
				elseif ( is_single() && ! ti_has_sidebar() ) :
				  $video_width = 840;
				  $video_height = 473;
				else :
				  $video_width = 530;
				  $video_height = 298;
				endif;
				?>
				
				<?php do_action( 'get_media', $post->ID, absint( $video_width ),  absint( $video_height ) );	?>
			
			</figure><!-- .entry-thumbnail -->
			
		<?php endif; ?>
	
	
	<?php elseif ( $the_post_thumbnail ) : ?>
	
	
	

		
		
		
		<figure class="entry-thumbnail">
		
			<div class="entry-media">
			
				<a href="<?php echo esc_url( $link['href'] ) ?>" class="<?php echo esc_attr( $link['class'] ) ?>" title="<?php ti_the_title_attribute(); ?>"><!-- nothing to see here --></a>
			 
			 <div onclick="location.href='<?php the_permalink() ?>';" title="<?php ti_the_title_attribute(); ?>" style="cursor:pointer;">
				<?php echo $the_post_thumbnail; ?>
			 
			 </div>
			</div><!-- .entry-media -->
		
		</figure><!-- .entry-thumbnail -->
	
	<?php endif; ?>

<?php 
/**
 * Post Thumbnail Setup
 * 
 * Check for featured post thumbnail. If the page is singular
 * check to see that the post thumbnail has not been disabled
 * via the Theme Options.
 *
 * If not singular, make the post thumbnail a link to the post.
 */
elseif ( $the_post_thumbnail ) : ?>
		
	<?php if ( is_singular() ) : ?>
	
		<?php if ( $of_disable_post_attributes['post_thumbnail'] == 0 ) : ?>
	
			<figure class="entry-thumbnail">
	  			
	  			<?php echo $the_post_thumbnail ?>
	  		
			</figure>
	  	
		<?php endif; ?>
	
	<?php else : ?>
	  
		<figure class="entry-thumbnail">
	  
	  
			<a href="<?php echo esc_url( $link['href'] ) ?>" class="<?php echo esc_attr( $link['class'] ) ?> " title="<?php ti_the_title_attribute(); ?>">
	  	
				<?php echo $the_post_thumbnail ?>
	  	
			</a>
	  	
		</figure>
	
	<?php endif; ?>
		
<?php endif; ?>

List Of Topic Replies

Viewing 7 replies - 1 through 7 (of 7 total)
Author Replies
Author Replies
Posted: Tuesday Jul 24th, 2012 at 3:28 pm #20096

Hi Greg,

but its not pulling any content due to the “join” page not pulling post ID.

I’ve not looked at the large code, but a problem you might be having is grabbing the ID if its a page referring rather than post? I think those are different in this case.

<?php

if (isset ($_g["_s2member_seeking"]["page"]))
    echo 'You were trying to access Page ID #' . esc_html ($_g["_s2member_seeking"]["page"]) . '.';

else if (isset ($_g["_s2member_seeking"]["post"]))
    echo 'You were trying to access Post ID #' . esc_html ($_g["_s2member_seeking"]["post"]) . '.';

?>
Posted: Tuesday Jul 24th, 2012 at 4:11 pm #20100

Thanks, let me look at that option

Posted: Tuesday Jul 24th, 2012 at 5:51 pm #20103

Philly, The way I have the code below works for the do_action. But when there is no “has_media_embed_1” in the post, the code wont show the thumbnail. Can anyone see any problems in my code? Thanks

<?php $_g = stripslashes_deep ($_GET);

if (isset ($_g["_s2member_seeking"]["post"]) ) : ?>

<?php  $post_id = esc_html ($_g["_s2member_seeking"]["post"]) ; 

$post_object = get_post( $post_id ); 
 
 ?>
	
<?php if ( has_media_embed_1($post_object->ID) ) : ?>

		
			
			
<?php do_action( 'get_teaser', $post_object->ID, absint( $video_width ),  absint( $video_height ) );	?>
			
			
<?php endif; ?>
	
<?php else : ?>
	  
	  	
 <?php echo get_the_post_thumbnail($post_object->ID, array(320,302)); ?>	  	
		
	
<?php endif; ?>
Posted: Tuesday Jul 24th, 2012 at 5:55 pm #20104

Please disregard. This code below works, although there might be a better way. Thanks

<?php $_g = stripslashes_deep ($_GET);

if (isset ($_g["_s2member_seeking"]["post"]) ) : ?>

<?php  $post_id = esc_html ($_g["_s2member_seeking"]["post"]) ; 

$post_object = get_post( $post_id ); 
 ?>	<?php endif; ?>

	
	<?php if ( has_media_embed_1($post_object->ID) ) : ?>

		
			
			<?php do_action( 'get_teaser', $post_object->ID, absint( $video_width ),  absint( $video_height ) );	?>
			
			

<?php else : ?>
	  
	  	
 <?php echo get_the_post_thumbnail($post_object->ID, 'large' ); ?>	  	
		
	
	<?php endif; ?>
		
Posted: Tuesday Jul 24th, 2012 at 10:45 pm #20134
Eduan
Username: Eduan
Moderator

Hello Greg,

Here’s a much smaller and cleaner version of the code:

<?php
$var = stripslashes_deep($_GET);

if(isset ($var["_s2member_seeking"]["post"])) {
	$post_id = esc_html($var["_s2member_seeking"]["post"]);
	$post_object = get_post($post_id);
}

if(has_media_embed_1($post_object->ID))
	do_action('get_teaser', $post_object->ID, absint($video_width), absint($video_height));
else
	echo get_the_post_thumbnail($post_object->ID, 'large');

Please tell me if you find any problems with it. ;)

Hope this helps. :)

Posted: Thursday Jul 26th, 2012 at 1:16 am #20279

Eduan,

Outstanding! How do you guys figure this stuff out? That worked perfectly.. Thanks!

Posted: Thursday Jul 26th, 2012 at 8:45 am #20311
Eduan
Username: Eduan
Moderator

Glad I was able to help Greg. :)

It’s actually just the same code, just another coding style, didn’t change anything except for one thing, I renamed the variable $_g with $var, otherwise it could cause problems with PHP itself, because PHP uses the $_ to start it’s variables.

Hope this helps. :)

Viewing 7 replies - 1 through 7 (of 7 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.