I can’t for the life of me figure why this is doing this: I have a plug-in that I am working on for Google Checkout. In the plugin, one of the parameters is the member_id of the currently logged in user.
If I return the data within a plugin function, it gives me the id of the member, however, if I try to post that somewhere else, the value that I get is “{member_id}”
To explain further:
This works:
$memberid = $TMPL->fetch_param('member_id');
return $memberid;
This does not:
$memberid = $TMPL->fetch_param('member_id');
setcookie("member", $memberid);
It IS setting a cookie, but the value is the variable name {member_id} instead of the value of the field.
What am I missing?
Thanks! V
Hiya,
Are you trying to set memberid to the ID of the currently logged in member by any chance?
If so you might be better off doing this sort of thing instead :
<?php
global $SESS, $FNS;
$memberid = $SESS->userdata['member_id'];
setcookie("member", $memberid);
?>
Hope that helps a bit.
Best wishes,
Mark
Brilliant. Worked like a charm. (I don’t actually need to set the cookie, but I was using that to test the member_id functionality.)
Question, though… if I wanted to pass a fetch_param to an external PHP file, can I do it? It doesn’t appear that I can. It looks like it just passes the variable name and not the value.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.