/** * $RCSfile: userProfile.jsp,v $ * $Revision: 1.2 $ * $Date: 2002/09/25 13:31:31 $ */ %> java.net.*, com.jivesoftware.forum.*, com.jivesoftware.forum.util.*, com.jivesoftware.util.ParamUtils" errorPage="error.jsp" %> // No permission check required. // get parameters String username = ParamUtils.getParameter(request,"user"); long userID = ParamUtils.getLongParameter(request,"user",-1L); String propName = ParamUtils.getParameter(request,"propName"); String propValue = ParamUtils.getParameter(request,"propValue"); // Get a user manager to get and set user properties UserManager userManager = forumFactory.getUserManager(); // Load the user User user = null; try { user = userManager.getUser(userID); } catch (Exception e) { try { user = userManager.getUser(username); } catch (Exception e2) {} } // Throw an error if the user was not loaded. if (user == null) { throw new UserNotFoundException("User " + request.getParameter("user") + " not found."); } if ("true".equals(request.getParameter("saveProperty"))) { if (propName != null && propValue != null) { user.setProperty(propName, propValue); response.sendRedirect("userProfile.jsp?user=" + userID); return; } } if ("true".equals(request.getParameter("delete"))) { if (propName != null) { user.deleteProperty(propName); response.sendRedirect("userProfile.jsp?user=" + userID); return; } } %> String title = "User Profile"; String[][] breadcrumbs = { {"Main", "main.jsp"}, {title, "userProfile.jsp?user=" + user.getID()} }; %> Profile for user : (edit user settings) Jump to user (enter user ID or username): userID = user.getID(); String name = user.getName(); String email = user.getEmail(); Date creationDate = user.getCreationDate(); Date modifiedDate = user.getModificationDate(); int numPosts = 0; //userManager.userMessageCount(user); %> User ID: Name: Email Address: Account Created: Last Updated: Number of Posts: Extended Properties for : Iterator properties = user.getPropertyNames(); %> PROPERTY NAME PROPERTY VALUE DELETE No Extended Properties String propertyName = (String)properties.next(); String propertyValue = user.getProperty(propertyName); %> title="Click to delete property" > Add Extended Property: Property Name: Property Value: