|
|
Rank: Advanced Member

Joined: 12/6/2007 Posts: 57 Location: pakistan
|
Hi Jaben, i ve found the bug, when you try to create a new topic in moderated forum, it pass Null to the column "LastPosted" in yaf_topic table against that topic, and then throw an error ("Object cannot be cast from DBNull to other types."  to the line <%# FormatDateTimeTopic( Convert.ToDateTime( DataBinder.Eval( Container.DataItem, "LastPosted" ) ) )%> in forum.ascx file. Kindly advise, i will try to find the solution tomorrow. Best Regards, XeE!
|
|
|
 Rank: YAF Developer

Joined: 1/8/2007 Posts: 1,083 Location: Heart of Europe
|
FP-fixed:Ederon When I post FP:Ederon in a topic, I'm leaving my footprint there so I can track it once I get into coding/supporting.
|
|
|
Rank: Advanced Member

Joined: 12/6/2007 Posts: 57 Location: pakistan
|
?? did you find the solution?
|
|
|
 Rank: YAF Developer

Joined: 1/8/2007 Posts: 1,083 Location: Heart of Europe
|
See my sig. When I post FP:Ederon in a topic, I'm leaving my footprint there so I can track it once I get into coding/supporting.
|
|
|
Rank: Advanced Member

Joined: 12/6/2007 Posts: 57 Location: pakistan
|
Thanks Ed.... As the forums are closed bcoz of this bug, so i would really appreciate if you look into the code bit soon  , CheerS!!!
|
|
|
 Rank: YAF Developer

Joined: 1/8/2007 Posts: 1,083 Location: Heart of Europe
|
What version is it? When I post FP:Ederon in a topic, I'm leaving my footprint there so I can track it once I get into coding/supporting.
|
|
|
Rank: Advanced Member

Joined: 12/6/2007 Posts: 57 Location: pakistan
|
|
|
|
 Rank: YAF Developer

Joined: 1/8/2007 Posts: 1,083 Location: Heart of Europe
|
I don't have that one installed. Try to compare involved code of 1.9.1.6 with 1.9.3. It works well in 1.9.3 afaik. I guess it's stored procedure yaf_topic_save or yaf_message_save. When I post FP:Ederon in a topic, I'm leaving my footprint there so I can track it once I get into coding/supporting.
|
|
|
Rank: Advanced Member

Joined: 12/6/2007 Posts: 57 Location: pakistan
|
as the topic is not approved by moderator, so the null is stored in LastPosted column and when it try to convert it to datetime , it gives error at <%# FormatDateTimeTopic( Convert.ToDateTime( DataBinder.Eval( Container.DataItem, "LastPosted" ) ) )%> , as there is null in that column, well thanks anyway. I will try to solve it.
Regards,
|
|
|
Rank: Advanced Member

Joined: 12/6/2007 Posts: 57 Location: pakistan
|
after the hard work of two weeks, customized registration system, integrated members database, customized everything, and after that i am stucked at this problem, can't move forward coz of this, kindly if there is somebody to help me , i would really appreciate.
|
|
|
Rank: Advanced Member

Joined: 12/6/2007 Posts: 57 Location: pakistan
|
Finally i have removed the bug and yet again i want to thanks Ed...  .. i want to share it with other ppls..... this bug is in moderated forums, as when you try to post new topic in moderated forums, it pass Null to Column "LastPosted" in yaf_topic table, now when you click on forum home page, it try to convert that null into datetime format and then generates an error. Solution: Open sp yaf_topic_save then replace the sp with the following. Note: The addition in this stored procedure is LastPosted, if LastPosted is Null,replace it with current date time. I hope it will help you people as well who want to have some moderated forums. CREATE PROCEDURE [dbo].[yaf_topic_save]( @ForumID INT, @Subject NVARCHAR(12  , @UserID INT, @Message NTEXT, @Priority SMALLINT, @UserName NVARCHAR(50) = NULL, @IP NVARCHAR(15), @PollID INT = NULL, @Posted DATETIME = NULL, @LastPosted DATETIME = NULL, @Flags INT) AS BEGIN DECLARE @TopicID INT DECLARE @MessageID INT IF @Posted IS NULL SET @Posted = Getdate() IF @LastPosted IS NULL SET @LastPosted = Getdate() INSERT INTO yaf_Topic (ForumID, Topic, UserID, Posted, Views, LastPosted, Priority, PollID, UserName, NumPosts) VALUES (@ForumID, @Subject, @UserID, @Posted, 0, @LastPosted, @Priority, @PollID, @UserName, 0) SET @TopicID = Scope_identity() EXEC yaf_message_save @TopicID , @UserID , @Message , @UserName , @IP , @Posted , NULL , @Flags , @MessageID OUTPUT SELECT TopicID = @TopicID, MessageID = @MessageID END GO CheeRS!!! XeE!
|
|
|
 Rank: YAF Forumling
Joined: 1/16/2008 Posts: 7 Location: Dublin
|
Hi I came across the same problem also. The problem for me was line 76 in forum.ascx: <%# FormatDateTimeTopic( Convert.ToDateTime( DataBinder.Eval( Container.DataItem, "LastPosted" ) ) )%> I commented this out (using <%-- --%>  and everything is fine now. The problem seems come from the fact that "Active discussions" shows posts even if moderation is turned on and the post hasn't been approved. I have commented out the "Active discussions" table until this is fixed as i don't want people seeing unapproved posts.
|
|
|
 Rank: YAF Forumling
Joined: 1/16/2008 Posts: 7 Location: Dublin
|
Oops, sorry, I didn't see these new posts! I only saw the first page!
|
|
|
 Rank: YAF Forumling
Joined: 9/19/2006 Posts: 4 Location: Penrith, England, UK
|
I am still getting the same with YAF 1.9.1.
The problem is in pages/forum.ascx around line 76 displaying "LastPosted". For topics that have not been moderated, the output from Stored Procedure yaf_topic_latest (ie table yaf_Topic) contains rows with LastPosted set to Null. Convert.ToDateTime doesn't want to work with DBNull. You'll have to write code that copes DBNull.
You can get going by deleting all the code within the surrounding < td > < /td >
Chris
|
|
|
 Rank: YAF Forumling
Joined: 1/22/2008 Posts: 4
|
I am also having this problem-I;m a total noob at this stuff so I could use some step-by step instructions on how to fix this. I also get teh same error when tryign to set ranks. I have version 1.9.1.2 (NET v2.0).
|
|
|
| Users browsing this topic |
|
Guest
|