Jump to content

How push user's member group to cookie?


asigno

Recommended Posts

Posted

Hi,

IPB currently sets a cookie which has the ips4_member_id stored, I would like to also set the member group? 

Does anyone know how I'd do this?

Thanks

Posted

I want to use an ad platform which works behind their DNS, they dynamically intercept the request, edit and serve. I want to stop the serving of ads to a certain user group which they'd be able to lookup from a cookie.

Posted

Hi Nathan, the ad system (Ezoic) sits entirely outside of my server and code. The code isn't touched at all. The original server request is intercepted.

Posted

If you want to put the user's group into a cookie, you have a few things to consider.

1) You'd need to write a plugin to do this, as it doesn't happen out of the box. It's not difficult to do so, but it would be necessary.

2) Users can belong to multiple groups, so you'd want to set all of those groups and be sure your ad platform can read all of them. Whether that's a comma separated list or some other format though, you'd have to check with the ad platform.

 

Posted
On 5/15/2018 at 7:54 PM, Nathan Explosion said:

Would they be able to pick up the group from a javascript variable in the html instead?

Good idea @Nathan Explosion, will check, hadn't thought to ask that.

On 5/15/2018 at 11:17 PM, bfarber said:

If you want to put the user's group into a cookie, you have a few things to consider.

1) You'd need to write a plugin to do this, as it doesn't happen out of the box. It's not difficult to do so, but it would be necessary.

2) Users can belong to multiple groups, so you'd want to set all of those groups and be sure your ad platform can read all of them. Whether that's a comma separated list or some other format though, you'd have to check with the ad platform.

 

Thanks @bfarber, seems like I've got a lot to learn then. Thought it might be as easy as adding a line of code to the existing method of setting the cookie.

  • 2 weeks later...
Posted

In a template to use just the primary group:

<script>
  var groupId = {expression="\IPS\Member::loggedIn()->member_group_id"};
</script>

or for all group ids (comma-separated):

<script>
  var groupIds = "{expression="implode( ',', \IPS\Member::loggedIn()->groups )"}";
</script>

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...