• Hello,

    I’ve been searching around everywhere for a solution to this and unfortunately have not found one yet. It seems a number of other people are also trying to get the paid content module to work on a specific piece of content within a post/page rather then the whole post/page itself. Oddly I havn’t come across the idea of using a shortcode to satisfy this. Would it be possible to create a shortcode to wrap around whatever content you wanted users to pay for? It would go something like this…

    [paid-content] You’re paid content would go here. [/paid-content]

    It would behave exactly the same way as it does now but offer much more flexibility on what content could be paid for. Please somebody can you help with this??

    Thanks

    http://wordpress.org/extend/plugins/cubepoints/

Viewing 15 replies - 1 through 15 (of 23 total)
  • Thread Starter jasnon

    (@jasnon)

    I should also add that I’m looking for a short code parameter of “amount” to be filled in depending on how much you want the paid content to be for. So it would go:

    [paid-content amount=”10″] You’re paid content would go here. [/paid-content]

    This would cost the user 10 points to access the enclosed content.

    Thanks

    I have a module that works exactly like you want. Here is a link to download it.

    Thread Starter jasnon

    (@jasnon)

    J.D. –

    Amazing! Thanks for the module, this is indeed exactly what I was looking for! When I was testing out the shortcode I did however notice a problem when using it on my Home Page. Once I clicked the button to spend points and show the protected content it changed my home page to all my recent posts from my blog. I am using a static Home page instead of my latest posts so maybe there is an issue with this. Oddly this only happened when I was on my admin account (it also removed all my buttons on the admin bar), when I tried the same thing on another subscriber account this did not happen.

    Also, I was hoping to use this in some cases within a Contact Form 7 form – such that a user would need to spend points to access the submit button in order to submit their form. When I tried this, clicking the button to spend points for the protected content actually submitted the CF7 form. Is there a way for this to work?

    Thanks again for posting the module though, this feature is really awesome.

    Sorry, I accidentally left out an ending form tag. I fixed it and it should work for you now, just re-download it. πŸ™‚

    J.D Grimes, How Do I Install your Code?

    Thanks

    You need to unzip the file and upload it to /wp-content/cubepoints/modules folder on the server. You can use FTP, or if you aren’t familiar with that and you have cPanel hosting you can use the file manager to upload it to the right directory. Then you need to activate the module on the CubePoints > Modules page in the admin dashboard. You can configure the defaults on the CubePoints > Configure page.

    hi,J.D. Grimes
    the module is very good,this is indeed what I was looking for too,but i want to use the php code in other plugins ,how can i let it come true?

    @beezeeking – What part of the code are you trying to use? Exactly what are you trying to do? Do you know PHP?

    so quick,thank you!
    i used the plugin “wp user frontend”,i have a front-end post form to users that users can publlish post,and i add a custom field “site_address”,i want to other users must need paying the points to view the “site_address” field.
    In my mind,i use the php code of the protect including the custom field “site_address”,i don’t know if my think is right?thank you for giving directions

    Yes, you could do that. In your PHP code you would do something like this:

    do_shortcode( '[protect points="50"]Content[/protect]' );

    Just replace “Content” with the code for your custom field. If you need more help try pasting your code here.

    haha,very thank you!
    i add the custom text area field “cf_site_address”,but i don’t know how to add the protect code ?i only want to protect the “cf_site_address” field,thank you for giving directions?follow is the part of “wp user frotend” plugin code:

    function wpuf_show_meta_front( $content ) {
        global $wpdb, $post;
    
        //check, if custom field is enabled
        $enabled = wpuf_get_option( 'enable_custom_field' );
        $show_custom = wpuf_get_option( 'cf_show_front' );
        $show_attachment = wpuf_get_option( 'att_show_front' );
    
        if ( $enabled == 'on' && $show_custom == 'on' ) {
            $extra = '';
            $fields = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}wpuf_customfields ORDER BY <code>region</code> DESC", OBJECT );
            if ( $wpdb->num_rows > 0 ) {
                $extra .= '<ul class="wpuf_customs">';
                foreach ($fields as $field) {
                    $meta = get_post_meta( $post->ID, $field->field, true );
                    if ( $meta ) {
                        $extra .= sprintf( '<li><label>%s</label> : %s</li>', $field->label, make_clickable( $meta ) );
                    }
                }
                $extra .= '<ul>';
    
                $content .= $extra;
            }
        }

    Here is a link to modified code. Let me know if it works for you.

    J.D. Grimes
    this link display error,i changed the ip adress,but it also didn’t open, i don’t have the cdn,I’m so sorry?

    Just replace this part:

    if ( $meta ) {
                        $extra .= sprintf( '<li><label>%s</label> : %s</li>', $field->label, make_clickable( $meta ) );
                    }

    With this:

    if ( $meta ) {
    
                    	// If this is the site address.
                    	if ( 'cf_site_address' == $field )
                    		$meta = do_shortcode( '[protect points="50"]' . $meta . '[/protect]' );
                    	else
                    		$meta = make_clickable( $meta );
    
                        $extra .= sprintf( '<li><label>%s</label> : %s</li>', $field->label, $meta );
                    }

    J.D. Grimes
    i think it is great and i used the code like you write,but it dosn’t work?i am very confuse,the protect code dosn’t function?

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘Paid Content Shortcode’ is closed to new replies.