guest
  •  guest
  • Rank: Guest
  • Posts: 448
  • Joined: 18/03/2003
I was the happiest camper on earth. So I found this great forum YAF (woo hoo)........but didnt have a way to make it work with my existing ASP.NET member based photo / friends site that I had compeletely built from scratch. I searched and I searched and i figured I would just try to make my own. Now bear with me this is a work in progress. The details are below:

YAFblend 1.3.8 (Updated 12.27.2006)

Download Here: YAFblend 1.3.8 
Example Here: YAFblend.YAFuser Sample 


Fixes

If some users were getting this error when using yafblend.

Quote:

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.



Here is the solution. The error was occuring due to the way I was checking for Private Messages. Any user who had more than one PM would get this error on any page that contained a YAFuser instance. Rookie mistake. This problem has been addressed in the above version.

What is it?

YAFblend is an ASP.NET DLL that retrieves the settings/authentication status of the user currently signed into YetAnotherForum allowing for seamless integration of YAF into an existing ASP.NET site. Now bear with me, YAFblend is still in the very early stages but is powerful enough to be used safely on a live site. I will be working on it alot so be sure to check back for updates.

How do i use it?

1. Drop YAFblend.dll into your ASP.NET Website's ~/Bin directory
2. Import the YAFblend Namespace on any page you wish to retrieve user information
3. To access the current YAF user use the YAFuser class:

Usage:

Dim _yu as New YAFuser(WebConfigAppSettingKey)

WebConfigAppSettingKey = Your db connection string OR AppSetting Key in the web.config file that contains the DB connection string to your YAF database.

web.config (Optional)

<appSettings>
<add key="YAFConnectionString" value="CONNECTION_STRING_GOES_HERE" />
</appSettings>

page.aspx.vb OR page.aspx.cs

Dim _yu as New YAFuser( "YAFConnectionStringAppSettingsWebConfigKey" )


YAFblend.YAFuser Structure

New(strYAFConnectionStringKey as string, Optional blnGetAvaterImage as boolean = False)

Booleans
YAFblend.YAFuser.Authenticated 'Is a user logged in
YAFblend.YAFuser.NewMail 'Does the user have any new Private messages
YAFblend.YAFuser.PMNotification 'Does the user want to be notified of PM's thru email
YAFblend.YAFuser.GotExtras 'Whether the Current YAF user extra information Datatable has been filled

Strings
YAFblend.YAFuser.AIM
YAFblend.YAFuser.Avatar
YAFblend.YAFuser.Email
YAFblend.YAFuser.HomePage
YAFblend.YAFuser.ICQ
YAFblend.YAFuser.Interests
YAFblend.YAFuser.IP
YAFblend.YAFuser.LanguageFile
YAFblend.YAFuser.Location
YAFblend.YAFuser.MSN
YAFblend.YAFuser.Name 'YAF Username (very helpful)
YAFblend.YAFuser.Occupation
YAFblend.YAFuser.RealName
YAFblend.YAFuser.Signature
YAFblend.YAFuser.ThemeFile
YAFblend.YAFuser.Weblog
YAFblend.YAFuser.YIM

Integers
YAFblend.YAFuser.BoardID
YAFblend.YAFuser.Gender
YAFblend.YAFuser.Flags
YAFblend.YAFuser.NumPosts
YAFblend.YAFuser.Points
YAFblend.YAFuser.RankID
YAFblend.YAFuser.TimeZone
YAFblend.YAFuser.UserID

Dates
YAFblend.YAFuser.Joined
YAFblend.YAFuser.LastVisit
YAFblend.YAFuser.Suspended

Byte()
YAFblend.YAFuser.AvatarImage

Datatables
YAFblend.YAFuser.Extras

Methods
Sub Touch() - Updates users active status outside the forum. Automatically executed when an instance is created. No custom update stored procedure needed anymore.

Sub GetExtras(strSQL) - Fills the YAFblend.YAFuser.Extras DataTable with the records returned from the strSQL line that gets executed.
*NOTE* Use @UserID in the strSQL string where you want the YAFuser Instance UserID substituted. ie: strSQL = "Select * from ExtraUserInfo where UserID=@UserID"

Coming Soon

Profile Updating right from the YAFuser instance
Ability to log in from a blank instance [Credits: Blackwater]
test2005
  • Posts: 761
  • Joined: 12/02/2005
  • Medals:Medal of Honor Key: Given to pillars of the community who are key players in the YAF community and project.
You have been a bussy bee ;)

I'll have a look and let ya know how I get on.


.....the man in black fled across the desert..........and the gunslinger followed.....
Mek
  • Posts: 892
  • Joined: 12/07/2005
  • Medals:Medal of Honor Key: Given to pillars of the community who are key players in the YAF community and project.Medal of Honor for the Support King: Given to a community member who tirelessly answers tons of support questions.
Said in PM, and I'll say it here. Exceptionally well done.

UserPostedImage 

"It's a case of RTFM.. the only problem being we don't have a manual!"

When I post FP:Mek in a topic, I'm leaving my footprint there so I can track it once I get into coding/supporting. (Yes I stole this off Ederon 🙂 )
guest
  •  guest
  • Rank: Guest
  • Posts: 448
  • Joined: 18/03/2003
Needs some coke to work apparently. It requires an assembly Cizzle when I tried to test it that it couldnt load.
guest
  •  guest
  • Rank: Guest
  • Posts: 448
  • Joined: 18/03/2003
MindPhaze wrote:

Needs some coke to work apparently. It requires an assembly Cizzle when I tried to test it that it couldnt load.



Whoops. I am a true amateur. I forgot about my other DLL. Will fix immediately.
Mek
  • Posts: 892
  • Joined: 12/07/2005
  • Medals:Medal of Honor Key: Given to pillars of the community who are key players in the YAF community and project.Medal of Honor for the Support King: Given to a community member who tirelessly answers tons of support questions.
Happens to us all 😉
UserPostedImage 

"It's a case of RTFM.. the only problem being we don't have a manual!"

When I post FP:Mek in a topic, I'm leaving my footprint there so I can track it once I get into coding/supporting. (Yes I stole this off Ederon 🙂 )
zyenite
  • Posts: 5
  • Joined: 08/12/2006
Great work! Thanks a lot :d
test2005
  • Posts: 761
  • Joined: 12/02/2005
  • Medals:Medal of Honor Key: Given to pillars of the community who are key players in the YAF community and project.
This is a great peice of work dude!!!

If your an amateur, then I must be uber-amateur-zilla!! Your solution "blends" better than mine does!!

Great work!

:)


.....the man in black fled across the desert..........and the gunslinger followed.....
uticket
  • Posts: 13
  • Joined: 09/12/2006
Hi, YAFaddict:

Can you give me a little more hints on how to use your dll? I can comply after adding your dll, but still can not get the user informaiton from YAF. I put both my own web site project and YAF under same directory same solution.

Thanks!
guest
  •  guest
  • Rank: Guest
  • Posts: 448
  • Joined: 18/03/2003
uticket wrote:

Hi, YAFaddict:

Can you give me a little more hints on how to use your dll? I can comply after adding your dll, but still can not get the user informaiton from YAF. I put both my own web site project and YAF under same directory same solution.

Thanks!



Hey uticket,

Sure..here is a sample page. Make sure you change the "YAFConnectionString" parameter to whatever app settings key that you have defined in your web.config file.


<%@ Page Language="VB" %>
<%@ Import Namespace="YAFblend" %>

<script runat="server">
    Private Const PRINT_FOR_HTML = True
    
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim CurrentYAFuser As New YAFuser("YAFConnectionString")
        
        lblYAFname.Text = CurrentYAFuser.Name
        lblYAFdetails.Text = CurrentYAFuser.PrintMe(PRINT_FOR_HTML) 'True parameter uses <br /> instead of normal carriage returns
        
        If CurrentYAFuser.NewMail Then
            lblYAFmail.Text = "You've got mail!"
        Else
            lblYAFmail.Text = "You do not have mail!"
        End If
    End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        Username: <asp:Label ID="lblYAFname" runat="server"></asp:Label><br />
        <br />
        User Details:<br />
        <asp:Label ID="lblYAFdetails" runat="server"></asp:Label><br />
        <br />
        Mail Status:<br />
        <asp:Label ID="lblYAFmail" runat="server"></asp:Label>        
    </form>
</body>
</html>




guest
  •  guest
  • Rank: Guest
  • Posts: 448
  • Joined: 18/03/2003
Hi YAFaddict,
Nice work! Am I right in thinking that your DLL allows you to get the currently logged in user to the YAF forum and then use that to authenticate the user with the rest of your ASP.NET app?

What if you've already authenticated your user with the ASP.NET membership provider (I think that's what it is) and want to then automatically sign them into the forum? I guess this is the reverse of what your DLL does.

What I'd really like to do is have the user log into my site and then automatically log them into the forum. Do you know if this is possible?

Many thanks,
Blackwater
guest
  •  guest
  • Rank: Guest
  • Posts: 448
  • Joined: 18/03/2003
Blackwater wrote:

Hi YAFaddict,
Nice work! Am I right in thinking that your DLL allows you to get the currently logged in user to the YAF forum and then use that to authenticate the user with the rest of your ASP.NET app?

What if you've already authenticated your user with the ASP.NET membership provider (I think that's what it is) and want to then automatically sign them into the forum? I guess this is the reverse of what your DLL does.

What I'd really like to do is have the user log into my site and then automatically log them into the forum. Do you know if this is possible?

Many thanks,
Blackwater



Hi Blackwater:

Thx! Yes you are right. It just reads the current ASP.NET membership profile of the authenticated/unauthenticated user and queries the YAF database to pull the user information and extra information from any cooresponding records that you might have in your database. As of now there is nothing that does any automatic login however I can look into this. Once this thing is really solid I will release the source code. Some more updates are coming this week.

-YAFaddict
guest
  •  guest
  • Rank: Guest
  • Posts: 448
  • Joined: 18/03/2003
YAFaddict wrote:


Hi Blackwater:

Thx! Yes you are right. It just reads the current ASP.NET membership profile of the authenticated/unauthenticated user and queries the YAF database to pull the user information and extra information from any cooresponding records that you might have in your database. As of now there is nothing that does any automatic login however I can look into this. Once this thing is really solid I will release the source code. Some more updates are coming this week.

-YAFaddict



Thanks for the info YAFaddict. I'm really looking forward to the updates, source and if you feel like looking into a single sign-on to the forums from the "main" application (with it's own .NET 2.0 membership stuff) that would be awesome.

Cheers,
Blackwater
guest
  •  guest
  • Rank: Guest
  • Posts: 448
  • Joined: 18/03/2003
I'll put something together by the end of the week that allows you to login from a blank instance. Be sure to check it out Friday for updates.
Mek
  • Posts: 892
  • Joined: 12/07/2005
  • Medals:Medal of Honor Key: Given to pillars of the community who are key players in the YAF community and project.Medal of Honor for the Support King: Given to a community member who tirelessly answers tons of support questions.
Slow down your putting us to shame 🙂 haha
UserPostedImage 

"It's a case of RTFM.. the only problem being we don't have a manual!"

When I post FP:Mek in a topic, I'm leaving my footprint there so I can track it once I get into coding/supporting. (Yes I stole this off Ederon 🙂 )
Forum Jump  
  • You cannot post new topics in this forum.
  • You cannot reply to topics in this forum.
  • You cannot delete your posts in this forum.
  • You cannot edit your posts in this forum.
  • You cannot create polls in this forum.
  • You cannot vote in polls in this forum.

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved