Description
Returns the integer value of the specified attribute, e.g. "id", of the user who's holding in use the specified object, or 0.
You can use it in Page.vb.
Syntax
dim iAttrib as Integer = GetObjCurEditor(iObjId, bMeIncluded, attrib) |
iObjId
Id of the object you want to know who's using it
bmeIncluded
If True, it will return your ID as well, if you're the user of the object iObjId.; if False, it will return 0 if you're the user of the object iObjId.
attrib
Typically, "id", but it can be other attribute that returns integer.
Code
Public Function GetObjCurEditor(ByVal iObjId As Integer, ByVal bMeIncluded As Boolean, ByVal attrib As String) As Integer
' returns the attrib of the object's current user - possibly excluding the logged user (you)
Dim objlist = New List(Of Integer)
Dim userlist As List(Of Integer)
objlist.Add(iObjId) ' txtlist.Add(article.GetTxtNode(iCurTxt).Id) - that would be for the current
userlist = EditorialLogin.Get().ObjIsCheckedOut(objlist, CheckOutCode.Content)
Dim userid = userlist(0)
' if nobody is using it, return ""
If userid = 0 And attrib = "id" Then Return 0
If userid = 0 Then Return CInt("")
' if you are excluded, and you're using it, return ""
If Not bMeIncluded And userid = EditorialLogin.GetLogin.GetContext().UserId Then Return CInt(IIf(attrib = "id", 0, ""))
' return specified attrib
Return CInt(UtilsBase.GetObjAttrValue(userid, attrib))
End Function
See also
GetObjCurEditorName Script, GetObjCurEditorId Script