Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * array(
- * 'status' => 'enabled',
- * 'price' => 10,
- * 'button_label' => 'Buy Post',
- * 'expire' => true
- * )
- */
- $post_id = 1;
- // Set a post for sale that has never been set for sale
- add_post_meta( $post_id, 'myCRED_sell_content', array(
- 'status' => 'enabled',
- 'price' => 10,
- 'button_label' => 'Buy This',
- 'expire' => false
- ), true );
- // Re-enable the sale of a post that has been disabled
- $prefs = get_post_meta( $post_id, 'myCRED_sell_content', true );
- $prefs['status'] = 'enabled';
- update_post_meta( $post_id, 'myCRED_sell_content', $prefs );
- // Disable sale of a post that is set to be for sale
- $prefs = get_post_meta( $post_id, 'myCRED_sell_content', true );
- $prefs['status'] = 'disabled';
- update_post_meta( $post_id, 'myCRED_sell_content', $prefs );
- /**
- * If posts are set for sale and must remain for sale but you
- * want to disable it for a particular user without re-saving
- * the settings, you can use the mycred_is_content_for_sale filter.
- * Returns false will pretend the content is not for sale.
- */
- if ( get_current_user_id() === 123 )
- add_filter( 'mycred_is_content_for_sale', '__return_false' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement