latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

File protection – levels with ccaps

Home Forums Community Forum File protection – levels with ccaps

This topic contains 4 replies, has 3 voices. Last updated by  Michael 4 years, 7 months ago.

Topic Author Topic
Posted: Sunday May 13th, 2012 at 1:48 pm #13341
Michael
Username: leopolt001

Hi Everyone.

I wonder is it possible to use ccaps with levels like this:

/s2member-files/access-s2member-level2/test.txt
/s2member-files/access-s2member-level2/access-s2member-ccap-man/test.txt
/s2member-files/access-s2member-level2/access-s2member-ccap-woman/test.txt

It works but I need to be sure.

This doesn’t: (checks only man ccap)

/s2member-files/access-s2member-level2/access-s2member-ccap-man/access-s2member-ccap-music/test.txt

Plus, I don’t even know why it works at all: (files-in.inc.php, line 130)

if(preg_match("/(?:^|\/)access[_\-]s2member[_\-]level([0-9]+)\//", $req["file_download"], $m) && strlen($req_level = $m[1]) && (!is_object($user) || empty($user->ID) || !$user->has_cap("access_s2member_level".$req_level)))
{
	if /* We only need this section when/if we're actually serving. */($serving)
		c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */("file", $req["file_download"], "level", $req_level, $_SERVER["REQUEST_URI"]).exit();
	/**/
	else /* Else return false. */
		return false;
}
/**/
else if(preg_match("/(?:^|\/)access[_\-]s2member[_\-]ccap[_\-](.+?)\//", $req["file_download"], $m) && strlen($req_ccap = preg_replace("/-/", "_", $m[1])) && (!is_object($user) || empty($user->ID) || !$user->has_cap("access_s2member_ccap_".$req_ccap)))
{
	if /* We only need this section when/if we're actually serving. */($serving)
		c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */("file", $req["file_download"], "ccap", $req_ccap, $_SERVER["REQUEST_URI"]).exit();
	/**/
	else /* Else return false. */
		return false;
}

Greetings.

List Of Topic Replies

Viewing 4 replies - 1 through 4 (of 4 total)
Author Replies
Author Replies
Posted: Sunday May 13th, 2012 at 4:49 pm #13351

Hi Michael.

Good question. I’m not sure about this, so I sent Jason an email asking him.

Are you trying to do level OR ccap, or level AND ccap protection for the file?

Posted: Monday May 14th, 2012 at 2:40 am #13366
Michael
Username: leopolt001

Level and ccap. :)

Posted: Monday May 14th, 2012 at 7:02 pm #13428
Staff Member

Thanks for the heads up on this request for support.

This works fine. You CAN nest level/ccap combinations, and s2Member will handle this properly.

/access-s2member-level2/access-s2member-ccap-man/

However, you CANNOT nest more than one Custom Capability. s2Member is not designed to handle this in file downloads. It only looks at one Custom Capability in the path to the file.

Posted: Tuesday May 15th, 2012 at 7:32 am #13511
Michael
Username: leopolt001

Great, that’s what I need. Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.