YAFLogo

Posted by: shanugulati - Sunday, 6 June 2010 09:36:09
Hello to everyone, Is there anyway that my website users can start new topic from my website itself (without going to discussion forum)? Has somebody did something similar to my requirements? Eagerly waiting for responses from community users! Thanks

Posted by: Kamyar - Sunday, 6 June 2010 15:53:35
I didn't get what you want exactly. You see, users should start a new topic in a specific forum. does this define what you're willing to do? you have a link in you website labeled: "Start a new topic" When a user clicks on the link, he will be redirected to the "post new topic" page with an additional option to specify the forum (For example from a dropdownlist) and when the user hits the post button, the new topic will be added to the specified forum.

Posted by: shanugulati - Sunday, 6 June 2010 16:34:52
Hi Kamyar, Yes, suppose I have a webpage in my website and at the end of that webpage i want to give link "Discuss this webpage on our discussion forum". This link should create a new topic with the title of the page from where user has started new topic. Also I want to show the discussion below the webpage. So, is it possible to customize YAF in this way? Hope now my requirement is clear.

Posted by: Kamyar - Sunday, 6 June 2010 17:27:15
1- As I mentioned before, each topic is created in a forum. So when a user is trying to create a new topic you have to specify the forum in which that topic is created. You can create a forum ( let's say "[b]Site Discussions[/b]" ) and put every new topic in that forum. 2- when the user clicks on your button, redirect him to "postmessage" page with the specified query strings. (if you have not enabled urlrewriting, the address should be something like: http://www.mysite.com/default.aspx?g=postmessage&f=[b]FORUM_ID[/b] Which the forum id is the id of your "[b]Site Discussions[/b]" forum. 2- If you want to show the discussion in your web page, Well that requires modifying the code behind. I think you should duplicate "posts.ascx" in YAF/pages and name it something like "SiteDiscussionsControl" and modify it thoroughly to be able to show the posts in you page. For example, you have to remove anonymous redirection or else anonymous users will not be able to view your topic. Also you have to assign values to your query strings in code-behind since posts.ascx is embedded in you web page. Surely you will have to do more than I explained.

Posted by: shanugulati - Monday, 7 June 2010 03:24:54
Hi Kamyar, Thanks for all this information. I will try this. Just have 1 more query. Is it possible to pass title in the Query String? e.g. something like this: http://www.mysite.com/default.aspx?g=postmessage&f={$ID}&title={$title}

Posted by: Kamyar - Monday, 7 June 2010 13:57:10
If by title, you mean Topic Subject, you'd have to do it programmatically. pass the query string to postmessage.ascx. in postmessage.ascx.cs assign the title to "Subject" textbox. Something like this in page_load event: [code]if (this.Request.QueryString["title"] != string.Empty) this.Subject.Text = Request.QueryString["title"][/code]