PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Passing User ID to Script

s2Member Plugin. A Membership plugin for WordPress®.

Passing User ID to Script

Postby terrylad » May 17th, 2010, 3:53 pm

I am sure this is something simple but I just can't seem to get passed it. I need to pass the User ID in a Java Script url but I keep getting the IP address instead. Here is the code:

<script type="text/javascript" src="http://xxxxxxxx?pub=xxxxx&subid="> & <?php echo S2MEMBER_CURRENT_USER_ID; ?> & <"></script>

I know nothing of javascript so I have no idea how exactly to do this. But it should be basic for someone out there who may know? I need to pass the &subid variable with the S2_MEMBER_CURRENT_USER_ID I am sure it's my sytax but I don't know the proper way. Any assistance would be greatly appreciated. Thanks

Terry Ladouceur
terrylad
Guest User
Guest User
 

Re: Passing User ID to Script

Postby DrMac » May 17th, 2010, 6:12 pm

Hi

I think your syntax should be
Code: Select all
<script type="text/javascript" src="http://xxxxxxxx?pub=xxxxx&subid=<?php echo S2MEMBER_CURRENT_USER_ID; ?>"></script>


hope this helps

DrMac
DrMac
Guest User
Guest User
 

Re: Passing User ID to Script

Postby terrylad » May 17th, 2010, 6:18 pm

Hi DrMac,

That is what I had originally tried as well but unfortunately this is what it outputs:

&subid=<%3Fphp+echo+S2MEMBER_CURRENT_USER_ID%3B+%3F>

It's like it's not running the actual php or something and if I do it outside of the quotes it send the IP address as the &subid. Still stumped. TTYL

Terry Ladouceur
terrylad
Guest User
Guest User
 

Re: Passing User ID to Script

Postby Jason Caldwell » May 19th, 2010, 4:27 am

It looks to me like your code is being mangled by the WordPress® Visual Editor, or by internal WordPress® filters. You'll probably need to put this into your theme, and not paste it into a Post/Page. Check your theme directory for the header.php file. The code should be inserted like this:
Code: Select all
<?php echo S2MEMBER_CURRENT_USER_ID; ?>
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA


Return to s2Member Plugin

Who is online

Users browsing this forum: Exabot [Bot] and 2 guests

cron