Hi Tammy,
Application Craft rocks! I’d not heard of it before, so thanks for sharing :-)
So…
To get the user ID from S2, use the PHP constant S2MEMBER_CURRENT_USER_ID
You’ll need to expose that to the HTML so you can embed the code from Application Craft:
<script src="http://ayb.applicationcraft.com//live/userlive.js" type="text/javascript"></script>
<script type="text/javascript">
waInitForm("APP_CODE_GOES_HERE",
757, 811, "id=ID_GOES_HERE");
</script>
The only way I know of doing that in WP is to use a plugin like Allow PHP in Posts and Pages, Shortcode Exec PHP, or Shortcode Exec PHP
Which will end up like this
<script src="http://ayb.applicationcraft.com//live/userlive.js" type="text/javascript"></script>
<script type="text/javascript">
waInitForm("APP_CODE_GOES_HERE",
757, 811, "user_id=<?php echo S2MEMBER_CURRENT_USER_ID; ?>");
</script>
Then, in Application Craft, go to the Code view and you can get the user id like this:
var user_id = app.getInputParameters("user_id");
After that, it’s up your specific app what it does with the ID, so i can’t help with that bit, sorry.
One thing to think about – what’s to stop me using that same HTML and just swapping the ID’s about until I find someone else’s data? The answer is “nothing” at the moment, so it might be worth thinking about an additional key that is passed between S2Member and ApplicationCraft, and use AC’s SSJ (Server-side Javascript) to validate that key.
Hope that helps,
Any