/** * $RCSfile: userProfile.jsp,v $ * $Revision: 1.2 $ * $Date: 2002/03/24 23:45:32 $ */ %> java.net.*, com.jivesoftware.forum.*, com.jivesoftware.forum.util.*" 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.getModifiedDate(); int numPosts = userManager.userMessageCount(user); %> User ID: Name: Email Address: Account Created: Last Updated: Number of Posts: Extended Properties for : Iterator properties = user.propertyNames(); %> 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: