Posted by: dev11 - Monday, 10 October 2011 12:17:31
how we can get BoardID in code, if we have Board Name
Posted by: tha_watcha - Monday, 10 October 2011 13:56:11
[quote=dev11;51417]how we can get BoardID in code, if we have Board Name [/quote]
Did you want to get the Current Board ID?
you can simple use
[code=csharp]YafContext.Current.PageBoardID[/code]
Posted by: dev11 - Monday, 10 October 2011 15:13:23
No actually i have board name and i want to get boardID by passing this or using this boardName information.
is there any method or function of YAF API which returns boardID if we supply boardname ?
Thanks
Posted by: bbobb - Tuesday, 11 October 2011 00:38:06
LegacyDB.board_list(...); then filter it by name.
Posted by: thienvc - Wednesday, 2 November 2011 08:24:50
[quote=tha_watcha;51420][quote=dev11;51417]how we can get BoardID in code, if we have Board Name [/quote]
Did you want to get the Current Board ID?
you can simple use
[code=csharp]YafContext.Current.PageBoardID[/code][/quote]
im using yafDNN, im create 3 boards. and using the board with id = 3 (BoardId = 3).
an error occurs when do addThank. im debug and see BoardID in AddThanks in webservice is not same current boardid of forum.
[code=csharp]public ThankYouInfo AddThanks([NotNull] object msgID)
{
var messageID = msgID.ToType();
string username =
LegacyDb.message_AddThanks(
UserMembershipHelper.GetUserIDFromProviderUserKey(Membership.GetUser().ProviderUserKey), messageID);
// if the user is empty, return a null object...
return username.IsNotSet()
? null
: YafThankYou.CreateThankYou(username, "BUTTON_THANKSDELETE", "BUTTON_THANKSDELETE_TT", messageID);
}[/code]
[code=csharp]//UserMemberShipHelper
public static int GetUserIDFromProviderUserKey(object providerUserKey)
{
int boardID = YafContext.Current.PageBoardID; //PageBoardID in here is not valid
int userID = LegacyDb.user_get(boardID, providerUserKey.ToString());
return userID;
}
[/code]
The YafContext.Current object in yafAjax is diffirence in another place?
How i can pass BoardId from current Board to the method in yafAjax or yafWebservice!? (not need using Config.BoardId)
Posted by: tha_watcha - Wednesday, 2 November 2011 10:44:52
[quote]How i can pass BoardId from current Board to the method in yafAjax or yafWebservice!? (not need using Config.BoardId)[/quote]
Are You trying to use the Thank Function from the Webservice Manually, or did you use the Thanks Button? This Function will ONLY work from the Thanks Button.
Posted by: thienvc - Wednesday, 2 November 2011 10:50:14
[quote=tha_watcha;51744][quote]How i can pass BoardId from current Board to the method in yafAjax or yafWebservice!? (not need using Config.BoardId)[/quote]
Are You trying to use the Thank Function from the Webservice Manually, or did you use the Thanks Button? This Function will ONLY work from the Thanks Button.[/quote]
i use the Thanks Button, but error occurs.
i think yafContext.Current in yafAjax is run out of the httpcontext of forum.
Posted by: thienvc - Wednesday, 2 November 2011 14:42:59
i have quesion, is yafDNN module can run with multi board in multi portal!?
if i change BoardID = 9999 in web.config, error occurs when click Thanks button for all forum instance if have boardID > 1.
i try debug then see BoardID in yafContext.Current has value 9999 from web.config. Why not getting BoardID from ModuleSetting!??!
Posted by: tha_watcha - Wednesday, 2 November 2011 14:54:15
[quote=thienvc;51752]i have quesion, is yafDNN module can run with multi board in multi portal!?
if i change BoardID = 9999 in web.config, error occurs when click Thanks button for all forum instance if have boardID > 1.
i try debug then see BoardID in yafContext.Current has value 9999 from web.config. Why not getting BoardID from ModuleSetting!??![/quote]
Yes i can reproduce this, with the BoardID in the Web.config.
What happens when you remove the Entry from the web.config.