I am having a rather odd issue with getting user data from the logged in user.
What I am trying to do is get the signature of the logged in user from ‘Member Account > (member) > Personal settings > Signature’
I simply want to put that string into a textarea; nothing fancy.
I have turned caching off.
reading the docs I am under the impression this should, by default this tag should give the currently logged in users information. So member_id would be the id of the logged in user… but its not. I am getting the information from the page author, not the logged in user. I have tried specifying the member_id parameter to member_id=”{member_id}” and member_id=”{logged_in_member_id"} but neither work. The parameter seems to be ignored, except for the later which will then display nothing between the tags.
here is the code:
{exp:member:custom_profile_data}
{logged_in_member_id}
{member_id}
{signature}
{/exp:member:custom_profile_data}Now, the output looks like this:
38
17
Stephanie
38 is MY user id, in which I am logged in.
17 is NOT my id, but the author of the original template page
Stephanie is the string in the Signature field under her ID, mine would say ‘Test Signature’.
From what I read in the docs, even {member_id} should default to the logged in user.
now, this part is even weirder…
the form is wrapped in this:
{exp:email:tell_a_friend charset="utf-8" allow_html='n' weblog="print"} {/exp:email:tell_a_friend}inside of this form we have this:
<label for="from">Your Email: </label>
<input type="text" id="from" name="from" size="50" value="{member_email}" /></p>
<label for="name">Your Name: </label>
<input type="text" id="name" name="name" size="50" value="{member_name}" /></p>and this produces MY email and MY username; NOT the authors. Since this works I would assume that just {signature} should also work, but it does not.
I am at a loss of ideas at this point. any suggestions?
—- EDIT——
I have since tried pulling the information using
{exp:query sql="SELECT signature AS s FROM exp_members WHERE member_id = '{logged_in_member_id}' "}
{s}
{/exp:query}however, this does not work. If I replace this query with:
{exp:query sql="SELECT signature AS s FROM exp_members WHERE member_id = '{member_id}' "}
{s}
{/exp:query}I again get the authors information, which is not what I need.
If I hardcode in MY id of ‘38’ like so:
{exp:query sql="SELECT signature AS s FROM exp_members WHERE member_id = '38' "}
{s}
{/exp:query}I of course get the intended result I am looking for, that members signature.
I have also since tried storing the id as a php variable and a JavaScript variable, both of which have stored and printed to the page successfully (as integers in independent outputs), but again do not work in the query.