• Resolved vitviz

    (@vitviz)


    I’ve been looking at this code to tweak it to auto default to always be protected using the file “class.simple-wp-membership.php”:

    // The actual fields for data entry
            echo '<h4>' . __("Do you want to protect this content?", 'swpm') . '</h4>';
            echo '<input type="radio" ' . ((!$is_protected) ? 'checked="checked"' : "") .
                    '  name="swpm_protect_post" value="1" /> No, Do not protect this content. <br/>';
            echo '<input type="radio" ' . (($is_protected) ? 'checked' : "") .
                    '  name="swpm_protect_post" value="2" /> Yes, Protect this content.<br/>';
            echo '<h4>' . __("Select the membership level that can access this content:", 'swpm') . "</h4>";
            $query = "SELECT * FROM " . $wpdb->prefix . "swpm_membership_tbl WHERE  id !=1 ";
            $levels = $wpdb->get_results($query, ARRAY_A);
            foreach ($levels as $level) {
                echo '<input type="checkbox" ' . (BPermission::get_instance($level['id'])->is_permitted($id) ? "checked='checked'" : "") .
                        ' name="swpm_protection_level[' . $level['id'] . ']" value="' . $level['id'] . '" /> ' . $level['alias'] . "<br/>";

    I can’t seem to get this to work regardless if I move the !$is_protected with the exclamation to protected and many other variations. Is there a way to modify the code to allow for a protective default?

    We are just using on membership level, free and active.

    Great plug-in. Totally do love the easy of the interface. Thanks!!

    https://wordpress.org/plugins/simple-membership/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support mbrsolution

    (@mbrsolution)

    Hi vitviz did you manage to resolve your question?

    amijanina

    (@amijanina)

    hi VitViz,
    the way you are trying to do it, will complicate whole process.

    instead open classes/class.bAccessControl.php and replace line 26 with this code:

    if (!$protected->is_protected($id)){
       $this->lastError = BUtils:_("This content is protected");
       return false;
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How do you Default All Pages to be Protected?’ is closed to new replies.