Community Support Forums — WordPress® ( Users Helping Users ) — 2011-09-14T17:12:50-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=14930 2011-09-14T17:12:50-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14930&p=37226#p37226 <![CDATA[Re: Verify Users via PHP or Actionscript]]>
The script works very good. I appreciate all the help.

Statistics: Posted by CincyPlanet — September 14th, 2011, 5:12 pm


]]>
2011-09-13T20:17:52-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14930&p=35923#p35923 <![CDATA[Re: Verify Users via PHP or Actionscript]]> I will let you know if it works out.

Statistics: Posted by CincyPlanet — September 13th, 2011, 8:17 pm


]]>
2011-09-13T19:53:00-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14930&p=35920#p35920 <![CDATA[Re: Verify Users via PHP or Actionscript]]> Great, thanks for reporting back on this for me.

Here is a modified version that returns the Level number. Remember that Levels begin at Level#0 ( i.e. a Free Subscriber ), so the return value in this case is either a numeric value, or just a hyphen; indicating the Username/Password is invalid here in this modified version.
Code:
<?php
add_action 
("init", "s2_user_pass_ok");
function s2_user_pass_ok ()
    {
        if (isset ($_GET[__FUNCTION__]) && $_GET[__FUNCTION__] === "xxxxx-something-secret-xxxxx")
            {
                status_header (200); header ("Content-Type: text/plain; charset=utf-8"); while (@ob_end_clean ());
                /**/
                if (user_pass_ok ($_GET["s2_username"], $_GET["s2_password"]))
                    {
                        $user = new WP_User ($_GET["s2_username"]);
                        $role = c_ws_plugin__s2member_user_access::user_access_role ($user);
                        $level = c_ws_plugin__s2member_user_access::user_access_level ($user);
                        exit ((string)$level); /* 0-4, or up to the number of configured Levels. */
                    }
                else
                    exit 
("-"); /* Not a valid Username/Password combination. */
            }
    }
?>
Not a way to log them in though, not through ActionScript ( I don't think ), because cookies must be set in the client's browser upon login. Anyway, let me know if the above works out for you. They don't need to be logged-in for this to work as expected.

Statistics: Posted by Jason Caldwell — September 13th, 2011, 7:53 pm


]]>
2011-09-13T18:39:59-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14930&p=35912#p35912 <![CDATA[Re: Verify Users via PHP or Actionscript]]>
I got it. It must have been the copy and paste problem, I hand typed it in and it looks to be working.
Is there a way to have it return the member's level instead of the 0-1, like 0 if not registered or their level if they are even if they are not logged in? or a way to log them in and return it without going to the site?

Statistics: Posted by CincyPlanet — September 13th, 2011, 6:39 pm


]]>
2011-09-13T15:00:48-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14930&p=35901#p35901 <![CDATA[Re: Verify Users via PHP or Actionscript]]> Thanks for the follow-up.

I would check again to be sure you don't have any leading/trailing whitespace, like spaces/tabs/line breaks before or after the opening/closing <?php ?> tags. Introducing whitespace ( some text editors do this inadvertently ) outside PHP tags can cause strange issues, and usually results in blank pages, or errors regarding "Headers already being sent".

If the problem continues, please post your local copy of the code that you've implemented, just to be sure nothing got mangled between the time I posted it and when you copied it. We'll review it for you.

Statistics: Posted by Jason Caldwell — September 13th, 2011, 3:00 pm


]]>
2011-09-12T18:54:15-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14930&p=34632#p34632 <![CDATA[Re: Verify Users via PHP or Actionscript]]> Statistics: Posted by CincyPlanet — September 12th, 2011, 6:54 pm


]]>
2011-09-12T16:56:00-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14930&p=34611#p34611 <![CDATA[Re: Verify Users via PHP or Actionscript]]> Thanks for the follow-up.
What is the error that you're seeing on the login page exactly?
This file, s2-hacks.php with the code I provided should not conflict. Do you have any spaces/tabs/line breaks before or after the <?php ?> tags in that file perhaps?

Statistics: Posted by Jason Caldwell — September 12th, 2011, 4:56 pm


]]>
2011-09-12T06:50:59-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14930&p=34590#p34590 <![CDATA[Re: Verify Users via PHP or Actionscript]]> Statistics: Posted by CincyPlanet — September 12th, 2011, 6:50 am


]]>
2011-09-10T19:52:13-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14930&p=34530#p34530 <![CDATA[Re: Verify Users via PHP or Actionscript]]> Statistics: Posted by CincyPlanet — September 10th, 2011, 7:52 pm


]]>
2011-09-10T13:08:38-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14930&p=34506#p34506 <![CDATA[Re: Verify Users via PHP or Actionscript]]>
Thanks a bunch! It looks like, from a few quick tests, that it works great.

Statistics: Posted by CincyPlanet — September 10th, 2011, 1:08 pm


]]>
2011-09-10T07:12:03-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14930&p=34482#p34482 <![CDATA[Re: Verify Users via PHP or Actionscript]]>
Thanks that's what I was looking for. I will try and set up a test site this weekend and give it a try.

Statistics: Posted by CincyPlanet — September 10th, 2011, 7:12 am


]]>
2011-09-09T19:10:57-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14930&p=34427#p34427 <![CDATA[Re: Verify Users via PHP or Actionscript]]> Thanks for the heads-up on this thread.

Yes, please create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
Code:
<?php
add_action 
("init", "s2_user_pass_ok");
function s2_user_pass_ok ()
    {
        if (isset ($_GET[__FUNCTION__]) && $_GET[__FUNCTION__] === "xxxxx-something-secret-xxxxx")
            {
                if (user_pass_ok ($_GET["s2_username"], $_GET["s2_password"]))
                    exit ("1");
                else
                    exit 
("0");
            }
    }
?>
Now you can do something like this in your 3rd-party app.
Code:
http://example.com/?s2_user_pass_ok=xxxxx-something-secret-xxxxx&s2_username=johndoe&s2_password=password
If the script returns 1, it's a valid Username/Password. Else if it returns 0, it is not.

Change xxxxx-something-secret-xxxxx to some secret key that your app will use, just to avoid having this script wide open for hackers to potentially abuse.

Related article:
http://codex.wordpress.org/Function_Ref ... er_pass_ok

Statistics: Posted by Jason Caldwell — September 9th, 2011, 7:10 pm


]]>
2011-09-09T16:51:02-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14930&p=34415#p34415 <![CDATA[Re: Verify Users via PHP or Actionscript]]> Statistics: Posted by CincyPlanet — September 9th, 2011, 4:51 pm


]]>
2011-09-09T01:56:13-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14930&p=34382#p34382 <![CDATA[Re: Verify Users via PHP or Actionscript]]>

Statistics: Posted by Cristián Lávaque — September 9th, 2011, 1:56 am


]]>
2011-09-08T19:09:59-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14930&p=34348#p34348 <![CDATA[Verify Users via PHP or Actionscript]]>
Thanks for any help in advance.

Statistics: Posted by CincyPlanet — September 8th, 2011, 7:09 pm


]]>