butlerblog
1/28/2017 - 2:17 AM

blocking filters

blocking filters

<?php

// Example of wpmem_settings array contents.

Array
(
    [version] => 3.1.7.a.1
    [notify] => 0
    [mod_reg] => 1
    [captcha] => 0
    [use_exp] => 1
    [use_trial] => 0
    [warnings] => 0
    [user_pages] => Array
        (
            [profile] => 
            [register] => 
            [login] => 
        )

    [cssurl] => http://yoursite.com/wp-content/plugins/wp-members/css/generic-no-float.css
    [style] => http://yoursite.com/wp-content/plugins/wp-members/css/generic-no-float.css
    [attrib] => 0
    [post_types] => Array
        (
        )

    [form_tags] => Array
        (
            [default] => Registration Default
        )

    [email] => Array
        (
            [from] => 
            [from_name] => 
        )

    [block] => Array
        (
            [post] => 1
            [page] => 0
        )

    [show_excerpt] => Array
        (
            [post] => 0
            [page] => 0
        )

    [show_login] => Array
        (
            [post] => 1
            [page] => 1
        )

    [show_reg] => Array
        (
            [post] => 1
            [page] => 1
        )

    [autoex] => Array
        (
            [post] => Array
                (
                    [enabled] => 0
                    [length] => 0
                    [text] => 
                )

            [page] => Array
                (
                    [enabled] => 0
                    [length] => 0
                    [text] => 
                )

        )

)
<?php // ignore this line

add_filter( 'wpmem_settings', 'my_wpmem_settings' );
function my_wpmem_settings( $settings ) {
  
  // Change values in the $settings array as needed.
  
  return $settings;
}
<?php // ignore this line.

add_filter( 'wpmem_securify', 'my_securify_filter' );

function my_securify_filter( $content ) {

	/*
	 * This filter can filter the content that is returned.
	 * 
	 * If you have additional criteria you want to set to 
	 * block content, such as a custom post type, or a user 
	 * level, this is the filter you want to use.
 	 */

	 return $content;
}
<?php

add_filter( 'wpmem_regchk', 'my_regchk' );
function my_regchk( $wpmem_regchk ) {
	/**
	 * you can programmatically test for criteria and
	 * change the value of wpmem_regchk and return
	 * filtered value.
	 */
	
	return $wpmem_regchk;
}
<?php // ignore this line

add_filter( 'wpmem_block', 'my_block_function' );
function my_block_function( $block ) {
	
	/*
	 * The plugin tests for pages and posts
	 * to be blocked or unblocked based on 
	 * the plugin's settings, then tests for
	 * custom field overrides, then sends the
	 * $block value to the wpmem_block filter.
	 *
	 * You can return the value unchanged, or
	 * test for any number of criteria and
	 * return that result.
	 *
	 * The value comes in as a true/false
	 * boolean and you must return a true/false
	 * boolean.
 	 */
	
	return $block;
}