{"id":20158,"date":"2012-10-01T14:41:25","date_gmt":"2012-10-01T14:41:25","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/user-object-framework\/"},"modified":"2012-10-01T14:42:22","modified_gmt":"2012-10-01T14:42:22","slug":"user-object-framework","status":"publish","type":"plugin","link":"https:\/\/sr.wordpress.org\/plugins\/user-object-framework\/","author":2343,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"0.1","stable_tag":"0.1","tested":"3.4.2","requires":"3.4","requires_php":"","requires_plugins":"","header_name":"User Object Framework","header_author":"Jennifer M. Dodd","header_description":"","assets_banners_color":"","last_updated":"2012-10-01 14:42:22","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"","header_author_uri":"http:\/\/uncommoncontent.com\/","rating":0,"author_block_rating":0,"active_installs":0,"downloads":3555,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","changelog"],"tags":[],"upgrade_notice":{"0.1":"<ul>\n<li>Initial release.<\/li>\n<\/ul>"},"ratings":{"1":0,"2":0,"3":0,"4":0,"5":0},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["0.1"],"block_files":[],"assets_screenshots":[],"screenshots":[]},"plugin_section":[],"plugin_tags":[3002,2994,13333,2219,2153],"plugin_category":[],"plugin_contributors":[77543],"plugin_business_model":[],"class_list":["post-20158","plugin","type-plugin","status-publish","hentry","plugin_tags-framework","plugin_tags-metadata","plugin_tags-object","plugin_tags-relationship","plugin_tags-user","plugin_contributors-jmdodd","plugin_committers-jmdodd"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/user-object-framework.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>This plugin creates a user-object relationship table and a user-object relationship metadata\ntable. Relationships between a user (logged-in or IP) are created and added to the relationship\ntable; metadata (ex. votes, flags, and ratings) is attached to that particular relationship\nvia the metadata table. This is a framework; it is intended for use in voting, flagging,\nand similar user applications where a user-affiliated metadata is attached to an object.\nSupported object tables include wp_posts, wp_comments, wp_users, and wp_bp_activity.<\/p>\n\n<p>Functions are provided to add\/get\/delete relationships; metadata is added via the native WordPress\nmetadata-handling functions.\nFunctions provided by this framework include:<\/p>\n\n<ul>\n<li><code>ucc_uof_object_reference()<\/code> returns an array of object-integer assignments. Use this to look up the \nappropriate value for $object_ref based on the object table (wp_posts, wp_comments, wp_users, \nwp_bp_activity are currently supported) to which you are attaching a user relationship.<\/li>\n<li><code>ucc_uof_add_relationship( $user_id = 0, $user_ip = 0, $object_id, $object_ref )<\/code> adds a relationship\nto the relationship table if none exists and returns the relationship id for that user\/object pairing.<\/li>\n<li><code>ucc_uof_delete_relationship( $user_id = 0, $user_ip = 0, $object_id, $object_ref )<\/code> will delete a \nrelationship if there are no metadata entries left for that relationship.<\/li>\n<li><code>ucc_uof_get_relationship()<\/code> returns the relationship id for that user\/object pairing.<\/li>\n<li><code>ucc_uof_get_user_id()<\/code> returns the current user id or 0 if not logged in.<\/li>\n<li><code>ucc_uof_get_user_ip()<\/code> returns 0 if the current user is logged in, or an ip2long() if anonymous.<\/li>\n<\/ul>\n\n<p>Example code:<\/p>\n\n<pre><code>\/\/ Create or get the user-object relationship.\n$relationship = ucc_uof_get_relationship( $user_id, $user_ip, $object_id, $object_ref );\nif ( empty( $relationship ) )\n    $relationship = ucc_uof_add_relationship( $user_id, $user_ip, $object_id, $object_ref );\n\n\/\/ Add user_object_meta.\nif ( $mode == 'delete' )\n    delete_metadata( 'uof_user_object', $relationship, '_your_meta_key' );\nelse\n    update_metadata( 'uof_user_object', $relationship, '_your_meta_key', 'your meta key value' );\n<\/code><\/pre>\n\n<!--section=installation-->\n<ol>\n<li>Upload the directory <code>user-object-framework<\/code> and its contents to the <code>\/wp-content\/plugins\/<\/code> directory.<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress.<\/li>\n<\/ol>\n\n<!--section=changelog-->\n<h4>0.1<\/h4>\n\n<ul>\n<li>Initial release.<\/li>\n<\/ul>","raw_excerpt":"Provide a framework for assignment of user-object relationship metadata.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/sr.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/20158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sr.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/sr.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/sr.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=20158"}],"author":[{"embeddable":true,"href":"https:\/\/sr.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/jmdodd"}],"wp:attachment":[{"href":"https:\/\/sr.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=20158"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/sr.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=20158"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/sr.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=20158"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/sr.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=20158"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/sr.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=20158"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/sr.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=20158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}