What can we do to make it easier to design with Wild Apricot?

Passing Member ID to and External Site

Some clients have want to the ability to link to another site with their Member ID in the URL. Just could be for a number of reasons, such as for referral credits, or some type of basic authentication. Using some clever JavaScript it is possible to grab the member ID and pass it on to another site.

Since Wild Apricot does not yet have an API, it isn't possible to simple pass the member ID over, we would need to read it off the page. Since the member ID is only found on the member profile page, we would need to first redirect to them to their profile and then automatically redirect them to the external site. This JavaScript is a bit complex, do not try to modify it unless you know what you're doing. If you need help with this script, please contact one of our partners http://www.wildapricot.com/partners . <script type="text/javascript">

var ExternalSite = "http://lmgtfy.com/?q=";

try {
function GetMemberID () {
var spans = document.getElementsByTagName('span');
for (var i = 0; i < spans.length;){
if (spans[i].innerHTML == "Member ID") {
var MemberID = spans[i+1].innerHTML;
var chkAdr = window.location.href;
if (chkAdr.indexOf("?getID") != -1) {
window.location = ExternalSite + MemberID;
if (window.BonaPage) BonaPage.addPageStateHandler(BonaPage.PAGE_PARSED, GetMemberID);
} catch(err) {}

This code goes into Settings > Global Javascript. Change the line that says ExternalSite to include the URL you want to redirect your members to, including the variable name for the member ID since the member ID will be appended to the end of the address.

To add a link to your external site while passing the member ID, simply link to this page: "/Content/Members/MemberProfile.aspx?getID"

0 votes
Sign in
Sign in with: facebook google
Signed in as (Sign out)

We’ll send you updates on this idea

Matthieu shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →


Sign in
Sign in with: facebook google
Signed in as (Sign out)
  • meldrum commented  ·   ·  Flag as inappropriate

    Seems like if WA added a hidden variable with the member id in all of the pages. that would solve this problem and be big help to us. Not a security problem because you have to be a logged in member for there to be an id. Or how about a Gadget that contained the member id. That would reduce any security concerns since it would take an admin to add the gadget to a page. If the user is not a logged in member, the member id would be null or zero.

    We need it for event registration where our events are too complex for WA. You must be a member to register for our event, and this would enable our registration to get name, address etc via the api. It would only work for current members.

  • Leon Webster commented  ·   ·  Flag as inappropriate

    ++1 to some javascript globals that keep some member information -- their id, maybe their name, and their email address.

    We are a small bicycle club, and would like to show a page with the miles the member has ridden with our club, the number of rides they have been on, etc. all compared to last year. We get that information from a separate program that manages ride statistics, but we use the Wild Apricot Member ID as the member's id in the ride stats program. I finally figured out how to build an iframe with a dynamic URL to show the member's page. but right now I need a way to get the member id. Neither of the above two methods seems to work for us.

  • bajagoodlife commented  ·   ·  Flag as inappropriate

    None of the above methods seem to work as of Dec 2014. Here is how we did it:

    <script type="text/javascript">

    var chkAdr = window.location.href;

    if (chkAdr.indexOf("?getID") != -1) {

    var ExternalSite = "https://www.mysite.com/?contactID=";

    var contactID = $('span:contains("User ID")').parent().next().find('span').text();

    console.log('member set' + contactID);

    window.location = ExternalSite + contactID;



    Link to redirect to external site with contactID: http://www.ourwildapricotsite.com/Sys/Profile?getID

    ps. All of this seems very "hacky", and it seems that there would be no security issue with offering a members contact/user ID as a javascript global when the member is logged in. Does anyone know of a better way?

  • billsinc commented  ·   ·  Flag as inappropriate

    I would also like to get the member's email address and name. Can you help with that?

  • polaris commented  ·   ·  Flag as inappropriate


    I believe that this is what I've been looking for. What I need to do is to be able to add a link to the home page of our WA site and when the user clicks the link, it will direct them to an external site with the member ID in the link.

    So, I'm assuming the javascript you have provided does this. Actually, what I assume is that when the user clicks the link, they will be sent to the Member Profile page, which will then call that javascript code and automatically send them to the external URL with the member ID in tow. I added the code, unchanged except for the following:

    window.location = ExternalSite + MemberID;

    to window.location = "http://www.polaris-associates.com/?q=&quot; + MemberID;

    I have also added the following link to the home page of our WA site at http://polarisassociatesinc.shuttlepod.org/ <a href=http://polarisassociatesinc.shuttlepod.org/Content/Members/MemberProfile.aspx?getID&quot; style="font-family: Arial; font-size: 16px; color: rgb(0, 0, 0);">Do Reports</a>

    When I click the link on my home page, it does send me to the member profile page, but it just stays there.

    Thinking that you may have meant to put GetMemberID in the link instead of getID, I tried that and there was no difference.

    So, first, can I do what I'm expecting? Are my assumptions correct? If so, what am I missing?

    Thank you.

    Tim Dietz

  • Dmitry Buterin commented  ·   ·  Flag as inappropriate

    To clarify: This applies in situation when you want to give members ability to go to an external site and pass on current memberID to that site. Here's a scenario:

    - you are a member

    - you are logged into a WA-based site

    - admin has created a special link using the code above and inserted it somewhere on the site

    - now when you click on that link, you will be taken to that external site and your memberID will be included in that link.

Feedback and Knowledge Base