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.

External access to protected content

Home Forums Community Forum External access to protected content

This topic contains 6 replies, has 2 voices. Last updated by  Cristián Lávaque 4 years, 6 months ago.

Topic Author Topic
Posted: Monday Jun 18th, 2012 at 6:46 am #16764

I’ve a wordpress site with S2 members pro and I use a third-party service that generates a pdf version of any post. My problem is that when I make a post restricted this service can’t access to the post to generate the PDF file. How can I allow this online service access to all my posts even if they are restricted?

The third-party service is this: http://www.convertapi.com/api/web-pdf-api

Thanks.

List Of Topic Replies

Viewing 6 replies - 1 through 6 (of 6 total)
Author Replies
Author Replies
Posted: Monday Jun 18th, 2012 at 6:56 am #16765

I think it would be usefull to have some way to login using get parameters.

For example:

If I want to access to a protected post with the url: http://www.website.com/blog/post_name
With the user: bloguser and pass: passuser
It would be great to have the option to do something like this:

http://www.website.com/blog/post_name?action=login&user=bloguser&pass=passuser

Doing this we can provide to third-party apis an url with his own user to access to protected content.

Posted: Tuesday Jun 19th, 2012 at 5:39 am #16859

Hi Antonio.

Thanks for the suggestion. We’re planning to add an access key that can be used in the URL to load protected content. It will be in the new s2Member we’re developing. :)

Posted: Tuesday Jun 19th, 2012 at 6:46 am #16869

Thanks Cristian. Is there any temporal fix that I can improbe until the next release be done?

Posted: Tuesday Jun 19th, 2012 at 5:55 pm #16927

Hmm… I don’t know…

Only thing that comes to mind is to create a hack that checks for a secret key in the URL, that when present authenticates the person as a user you created for this, with the access you need it to have to see the content.

You’ll need to find what WP function/method will let you auntenticate that service you’re trying to use. A quick search of the WP functions found me wp_signon, not sure if it does what you need, but it’s a start. http://codex.wordpress.org/Function_Reference/wp_signon

I hope that helps.

Posted: Wednesday Jun 20th, 2012 at 10:09 am #17016

I’ve implemented a temporal fix for this. This is what i have done, usefull if someone needs something like this…

First, create an user with the necesary access level on wp backend panel and get his user id. For this example supose that user’s id is 5.

Now edit on file posts.inc.php:

Near line 50, after:

$user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty ($user->ID)) ? $user : false; /* Current User's object. */

Add:

if ((!$user) && (isset($_GET['key'])) && ($_GET['key'] == md5(date("Ymd")."yourstring"))){
	$userid = 5;
	$user = get_userdata( $userid );
	}
										

Now you have to provide add the key parameter to the address that you have to give to the thrid-party service.

For example, if the url of your post is http://www.website.com/blog/post_name/ , you have to give the url: http://www.website.com/blog/post_name/?key= followed with the md5 key that you want to generate (in my case is date(“Ymd”) + “yourstring”)

Maybe this is not the best solution, but is a solution until the s2team give us a better fix.

Posted: Thursday Jun 21st, 2012 at 7:11 am #17092

Cool hack. Thanks for sharing it. :)

You should remember that this will be lost when you update WordPress, so remember to reapply it.

Viewing 6 replies - 1 through 6 (of 6 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.