require "active_record" ## # This class is used for getting the user from the wordpress database # # == Examples: # User.find(1).name # The above will find the user with id of 1 and retrieve their display name class User < ActiveRecord::Base set_table_name :wp_users set_primary_key :ID has_many :settings has_many :pages, :foreign_key => :post_author has_many :posts, :foreign_key => :post_author has_many :comments, :foreign_key => :user_id ## # Grab the name of the selected user def name display_name end ## # Set the name of the selected user def name= name self.display_name = name end ## # Grab the username of the selected user def username user_login end ## # Set the username of the selected user def username= username self.user_login = username end ## # Grab the email of the selected user def email user_email end ## # Set the email of the selected user def email= email self.user_email = email end end