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.

Post Excerpt On Membership Options Page

Home Forums Community Forum Post Excerpt On Membership Options Page

This topic contains 8 replies, has 4 voices. Last updated by  Philly 4 years, 6 months ago.

Topic Author Topic
Posted: Friday Jun 29th, 2012 at 12:38 pm #17868

Currently non-registered members get taken to our membership options page, like this one:

http://www.efficientgov.com/not-subscriber/?_s2member_seekingtype=post&_s2member_seekingpost=3059&_s2member_seeking_uri=L25hbWluZy1yaWdodHMtY29uc2lkZXJlZC1maXJlLXRydWNrLXNwb25zb3JlZC1ieS8%3D&_s2member_reqtype=level&_s2member_reqlevel=1&_s2member_restype=post&s2member_seeking=post-3059&s2member_level_req=1

I’d like to re-design this page so it displays the excerpt for the post on this page along with other marketing language.

How do I do that? Since s2 keeps the postID in the URL, is there a short code that would display the excerpt on the page?

Thanks in advance!

– Frank

List Of Topic Replies

Viewing 8 replies - 1 through 8 (of 8 total)
Author Replies
Author Replies
Posted: Friday Jun 29th, 2012 at 6:20 pm #17892

Hi Frank,

That sound rather complex, I’m sure someone can help you with that but wouldn’t a better way be to do a conditional check within the post like

[s2If is_user_logged_in()]
   
    The full post for logged in users
    
    Note: You can alter this to check that the user is logged in as a paying customer.
    
[/s2If]

[s2If !is_user_logged_in()]

    They're NOT logged in.
    
    The excerpt here.
    
    Then perhaps a login/register link here (You need to login or register to see the rest of this post.)
    
    Marketing speech here?    

[/s2If]
Posted: Saturday Jun 30th, 2012 at 10:34 am #17962

Its easier than I thought.

I got this working (with the php exe plugin enabled)

<?php

$_g = stripslashes_deep ($_GET);


if (isset ($_g["_s2member_seeking"]["post"]))

	$post_id = esc_html ($_g["_s2member_seeking"]["post"]) ;
	
	$post_object = get_post( $post_id );

    echo $post_object->post_excerpt;
	
?>

s2member has some docs here:

Dashboard -› s2Member® -› API / Scripting -› Membership Options Page Variables (MOP Vars).

Posted: Sunday Jul 1st, 2012 at 7:20 am #18010

Philly, this works great, thanks so much!

Posted: Friday Jul 6th, 2012 at 7:43 pm #18504

Hi, Thanks for the code. I used this to get the post_title.

<?php

$_g = stripslashes_deep ($_GET);


if (isset ($_g["_s2member_seeking"]["post"]))

	$post_id = esc_html ($_g["_s2member_seeking"]["post"]) ;
	
	$post_object = get_post( $post_id );

    echo $post_object->post_title;
	
?>

I would like to know how I could alter this code to check if the page is something like this:

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

or

if ( has_media_embed() ) : ?>

I need to pass these “ifs” to make my page work the way I need it to,.

Thanks!

  • This reply was modified 4 years, 6 months ago by  Greg Romero.
Posted: Saturday Jul 7th, 2012 at 6:21 am #18544
Raam Dev
Username: Raam
Staff Member

Hi Greg,

The is_singular() conditional tag checks if a singular page is being displayed. The code above will only ever return a singular page, so there really isn’t any point in checking that.

I’m not sure where the has_media_embed() function comes from (it’s not a WordPress function), but if you needed to add it, you’d do the following:

<?php

$_g = stripslashes_deep ($_GET);


if (isset ($_g&#91;"_s2member_seeking"&#93;&#91;"post"&#93;) && has_media_embed()) {

	$post_id = esc_html ($_g&#91;"_s2member_seeking"&#93;&#91;"post"&#93;) ;
	
	$post_object = get_post( $post_id );

	echo $post_object->post_title;
}
?>
Posted: Saturday Jul 7th, 2012 at 12:56 pm #18563

Thanks, Im actually trying to show this function. I think were close.

<?php

$_g = stripslashes_deep ($_GET);


if (isset ($_g["_s2member_seeking"]["post"]) && has_media_embed()) {

	$post_id = esc_html ($_g["_s2member_seeking"]["post"]) ;
	
	$post_object = get_post( $post_id );

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

More

add_action( 'get_teaser',       'ti_get_teaser', 10, 5 );

Function

function has_media_embed( $post_id = null ) {
	$post_id = ( null === $post_id ) ? get_the_ID() : $post_id;
	
	/* Get global values */
	global $media_embed_mb;
	
	/* Get media embed metabox options */
	$media_embed_mb->the_meta( $post_id ); 
	$media_source     = $media_embed_mb->get_the_value( 'media_source' );
	$media_embed_code = $media_embed_mb->get_the_value( 'media_embed_code' );
	
	$media_embed = ( $media_source || $media_embed_code ) ? true : false;
	
	return $media_embed;
}

Ill add later. Im clueless.on this, thanks for your help.

Posted: Sunday Jul 8th, 2012 at 11:01 am #18614

Thanks Raam, but I still get no results with that code.

Im trying to use the membership page to show my visitors a limited amount of content they intended to see. On this page, I will show them the title, exercpt, video and a thumbnail. Then the paypay form

What Im trying to do is tell s2member to display the video, if there is no video for that post, then show the featured image.

if video
show video (function has_media_embed)

elseif
show featured image

else
show default signup.jpg

Thanks

Posted: Monday Jul 9th, 2012 at 2:28 pm #18685

@ Greg

Perhaps you could make a custom field called ‘video’ in the page/post and put the url to the trailer in that, then adapt the code below to show it on the membership page.

<?php


$_g = stripslashes_deep ($_GET);


if (isset ($_g["_s2member_seeking"]["post"]))

	$post_id = esc_html ($_g["_s2member_seeking"]["post"]) ;
	
	$post_object = get_post( $post_id );
	
	$post_thumb = get_the_post_thumbnail( $post_id );
	
	$title = get_the_title($post_id);
	
	echo $title;
	
	echo $post_object->post_excerpt;
	
	echo $post_thumb;
	
	echo get_post_meta($post_id, 'video', true);
	
	
?>
Viewing 8 replies - 1 through 8 (of 8 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.