We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Issue with member_id...

Development and Programming

RonBurgundy's avatar
RonBurgundy
12 posts
17 years ago
RonBurgundy's avatar RonBurgundy

I’m in the process of learning how to code a plugin and ran into a problem. I’m not quite sure why this is happening. I think it has something to do with member_id being passed to the plugin as a string and not an integer. So here’s my problem…

{exp:my_class:my_function aff_id="{member_id}"}

If I pass the member_id like this to a custom DB query in the plugin, it doesn’t pull the correct results. BUT, if I replace the {member_id} with say “2”, it works perfectly. I’ve also confirmed that the logged in member_id is currently “2”.

Any suggestions? Have I missed something obvious here?

       
Robin Sowell's avatar
Robin Sowell
13,160 posts
17 years ago
Robin Sowell's avatar Robin Sowell

I’ll probably shift this down to the plugin development forum where it’s a better fit. But I’m fuzzy on why you need to pass the member id at all if it’s for whoever is viewing the page- couldn’t you use the session class and grab it via the plugin?

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

I’d definitely go with Robin on this one and use the session class to grab the value.

All you’d need is something like this to return the value you are after :

$plugin_member_id = $SESS->userdata['member_id'];

That should give you the correct value inside your plugin that you can then use as you see fit.

Let us know if that is any good for you?

Best wishes,

Mark

       
RonBurgundy's avatar
RonBurgundy
12 posts
17 years ago
RonBurgundy's avatar RonBurgundy

HA! I knew I was missing something obvious. LOL, thanks for the quick help.

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

No problem! Although I think you are referring to Robin’s post and not mine, I don’t think you would have had chance to read mine yet judging by the post times 😉

Let us know if you have any problems though.

Best wishes,

Mark

       
RonBurgundy's avatar
RonBurgundy
12 posts
17 years ago
RonBurgundy's avatar RonBurgundy

Yes, in this case I was referring to Robin’s post. But I’ve learnt a lot from your older post’s Mark. So thanks for those 😉

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen
Yes, in this case I was referring to Robin’s post. But I’ve learnt a lot from your older post’s Mark. So thanks for those 😉

Well thank you for the very kind words. That was very nice to hear.

If you need any more help just holler across though.

Best wishes,

Mark

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.