Last post Mar 11, 2008 08:49 PM by phamster
Mar 11, 2008 04:08 PM|phamster|LINK
I am trying to create a new label that will only show up if the user is in the right group
As you can see the "BMW MOFO Member" label shows up on all members. I've have already create a membership role call "bmwmofoMember". Right now what it looks like it's doing is it's checking the current user login and if the user is in the "bmwmofoMember"
role than it will display the label on the member list.
Here's the code I have so far:
How would I do this?
Mar 11, 2008 04:58 PM|MaineOne|LINK
What yo have now only checks to see if the user is authenticated any role will show it. To check which role they are in you need to use
If user.IsInRole("BMW MOFO MEMBER") then
Mar 11, 2008 05:42 PM|phamster|LINK
I tried that and samething. I think what I need to do is pass the UserName through and then it should check to see if the user is in the "bmwmofoMember" group. But I don't know how to write the function to do that. Any other suggestions?
Mar 11, 2008 07:42 PM|MaineOne|LINK
Sorry read it wrong.
Try this. I have not verified it, but it should get you in the right direction.
change call to function to
Change function to
Mar 11, 2008 07:51 PM|MaineOne|LINK
If that works the only flaw I do know will happen is if your membership is not set up as
requiresUniqueEmail="true" then it you could end up with a false showing if there are 2 members with the same
email but not the same roles.
Mar 11, 2008 08:49 PM|phamster|LINK
It worked! I'm not to worry about the email part. It won't let you sign up for membership if the input of their email address already exist. Thanks for everything!