dev11
  •  dev11
  • 54.8% (Neutral)
  • YAF Forumling Topic Starter
2011-10-10T10:17:31Z
how we can get BoardID in code, if we have Board Name
Sponsor
tha_watcha
2011-10-10T11:56:11Z
Originally Posted by: dev11 

how we can get BoardID in code, if we have Board Name



Did you want to get the Current Board ID?

you can simple use

YafContext.Current.PageBoardID

UserPostedImage
dev11
  •  dev11
  • 54.8% (Neutral)
  • YAF Forumling Topic Starter
2011-10-10T13:13:23Z
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
bbobb
  •  bbobb
  • 100% (Exalted)
  • YAF Developer
2011-10-10T22:38:06Z
LegacyDB.board_list(...); then filter it by name.
thienvc
2011-11-02T07:24:50Z
Originally Posted by: tha_watcha 

Originally Posted by: dev11 

how we can get BoardID in code, if we have Board Name



Did you want to get the Current Board ID?

you can simple use

YafContext.Current.PageBoardID



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.

public ThankYouInfo AddThanks([NotNull] object msgID)
        {
            var messageID = msgID.ToType<int>();
            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);
        }


//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;
    }


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)
tha_watcha
2011-11-02T09:44:52Z
Quote:

How i can pass BoardId from current Board to the method in yafAjax or yafWebservice!? (not need using Config.BoardId)



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.
UserPostedImage
thienvc
2011-11-02T09:50:14Z
Originally Posted by: tha_watcha 

Quote:

How i can pass BoardId from current Board to the method in yafAjax or yafWebservice!? (not need using Config.BoardId)



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.



i use the Thanks Button, but error occurs.
i think yafContext.Current in yafAjax is run out of the httpcontext of forum.
thienvc
2011-11-02T13:42:59Z
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!??!
tha_watcha
2011-11-02T13:54:15Z
Originally Posted by: thienvc 

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!??!



Yes i can reproduce this, with the BoardID in the Web.config.

What happens when you remove the Entry from the web.config.

UserPostedImage

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