Hi, Tom W.
Are you trying to do this in a Theme file? The usual method is to use do_shortcode() like this:
$protected = '<div class="submit_button_wrapper">
<button class="button cbrp-button cbrp-button-form-' . $ratingFormArray['id'] . '" data-hash = "'.$user_hash.'" data-buddypress-post = "'.$buddypress_post.'" id="submit-rating" type="submit" name="op" value=""><span id="cbrp-button-label">' . __( 'Submit', 'cbratingsystem' ) . '</span></button>
<div style="display: none;" class="cbrp_load_more_waiting_icon cbrp_load_more_waiting_icon_form-' . $ratingFormArray['id'] . '_post-' . $post_id . '"><img alt="' . __( 'Loading', 'cbratingsystem' ) . '" src="' . CB_RATINGSYSTEM_PLUGIN_DIR_URL . 'images/ajax-loader.gif" /></div>
</div>';
echo do_shortcode( '[content_protector password="pw"]' . $protected . '[/content_protector]' );
You can also check the “Shortcode in Template” sticky topic for more info.
Thread Starter
Tom W
(@thomaswillfahrt)
Hello,
thanks a lot.
I try it in a plugin but it doesnt work.
$display .= ‘
<div style=”clear:both;”></div>
</div>
<div style=”clear:both;”></div>
<div class=”submit_button_wrapper”>
<button class=”button cbrp-button cbrp-button-form-‘ . $ratingFormArray[‘id’] . ‘” data-hash = “‘.$user_hash.'” data-buddypress-post = “‘.$buddypress_post.'” id=”submit-rating” type=”submit” name=”op” value=””><span id=”cbrp-button-label”>’ . __( ‘Submit’, ‘cbratingsystem’ ) . ‘</span></button>
<div style=”display: none;” class=”cbrp_load_more_waiting_icon cbrp_load_more_waiting_icon_form-‘ . $ratingFormArray[‘id’] . ‘_post-‘ . $post_id . ‘”><img alt=”‘ . __( ‘Loading’, ‘cbratingsystem’ ) . ‘” src=”‘ . CB_RATINGSYSTEM_PLUGIN_DIR_URL . ‘images/ajax-loader.gif” /></div>
</div>
<div style=”clear:both;”></div>
</div>
<div class=”ratingFormStatus ratingFormStatus-form-‘ . $ratingFormArray[‘id’] . ‘”></div>
‘;
}
$display .='</div>’;
TW
Thread Starter
Tom W
(@thomaswillfahrt)
The submit button is not included in the form … so i cant send the form
$display .= ‘
<div style=”clear:both;”></div>
</div>
<div style=”clear:both;”></div>’;
$protected = ‘<div class=”submit_button_wrapper”>
<button class=”button cbrp-button cbrp-button-form-‘ . $ratingFormArray[‘id’] . ‘” data-hash = “‘.$user_hash.'” data-buddypress-post = “‘.$buddypress_post.'” id=”submit-rating” type=”submit” name=”op” value=””><span id=”cbrp-button-label”>’ . __( ‘Submit’, ‘cbratingsystem’ ) . ‘</span></button>
<div style=”display: none;” class=”cbrp_load_more_waiting_icon cbrp_load_more_waiting_icon_form-‘ . $ratingFormArray[‘id’] . ‘_post-‘ . $post_id . ‘”><img alt=”‘ . __( ‘Loading’, ‘cbratingsystem’ ) . ‘” src=”‘ . CB_RATINGSYSTEM_PLUGIN_DIR_URL . ‘images/ajax-loader.gif” /></div>
</div>’;
echo do_shortcode( ‘[content_protector password=”pw”]’ . $protected . ‘[/content_protector]’ );’
</div>
<div style=”clear:both;”></div>
</div>
When you say “I try it in a plugin”, do you mean you’re actually writing a plugin and you’re trying to use Content Protector as a part of your plugin?
Thread Starter
Tom W
(@thomaswillfahrt)
No. I try to integrate the password protection in an existing plugin.
I can not create a plugin itself . . .
😉