YAFLogo

bbobb
  • bbobb
  • 100% (Exalted)
  • YAF Developer Topic Starter
12 years ago
Guests is YAF is a tricky point.

1. Guest group notion.

By design YAF can have one and only one Guest user for each board. Technically the Guest reside in prefix_user table and marked by a special flag.

The guest should be in a role. The roles are in prefix_group tables. Notice, that the table contains roles added from ASP.NET Roles. The roles can be added from the prefix_group by YAF too when you create a new group.

A guest role has a special IsGuest=2 flag set like a User has IsGuest=4 flag set. So in some situations YAF can treat a user added to a Guest group as a guest.

To avoid possible problems be sure that only one user for each board is guest.

The query should not return any records. Run it from Run SQL in YAF admin section.

select u.name from  prefix_user u join prefix_usergroup ug on ug. userid =  u. userid join prefix_group g on g.groupid = ug.groupid where u.boardid =  [insert a boardid here]  and (g.flags & 2) = 2 and (u.flags & 4) <> 4;

2. Be sure that you always have a special guest user and a respective guest group. If YAF can't find a guest user run above a bit modified quiery. It should always return a single guest user for each board

select u.name from  prefix_user u join prefix_usergroup ug on ug. userid =  u. userid join prefix_group g on g.groupid = ug.groupid where u.boardid =  [insert a boardid here]  and (g.flags & 2) = 2;

Keep it in mind again that Guest group is a part of ASP.NET Roles. But Guest user itself is not in ASP.NET Membership. If you change a Guest Role Name you'd better delete an old Guests group as you will have 2 groups which are marked as IsGuest which can lead to confusing.

Sponsor