[WordPress] 外掛分享: User Object Framework

前言介紹

  • 這款 WordPress 外掛「User Object Framework」是 2012-09-30 上架。
  • 目前尚無安裝啟用數,是個很新的外掛。如有要安裝使用,建議多測試確保功能沒問題!
  • 上一次更新是 2012-10-01,距離現在已有 4598 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 3.4 以上版本才可以安裝。
  • 尚未有人給過這款外掛評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

jmdodd |

外掛標籤

user | object | metadata | framework | relationship |

內容簡介

此外掛會創建一個使用者對象關係表以及使用者對象關係元數據表。
使用者(已登錄或IP)之間的關係會被創建並新增到關係表中,該關係
的元數據(例如投票,標誌和評級)通過元數據表附加到該特定關係。
該框架用於投票,標記和類似的使用者應用程序,其中將使用者關聯的元數據附加到對象上。
支持的對象表包括wp_posts、wp_comments、wp_users和wp_bp_activity。

提供函數以添加/獲取/刪除關係,元數據是通過原生的WordPress
元數據處理函數添加的。
此框架提供的函數包括:

ucc_uof_object_reference() 返回對象整數分配的數組。使用它來查找基於物件表(wp_posts、wp_comments、wp_users、wp_bp_activity目前被支援)
你要附加使用者關係的正確值。
ucc_uof_add_relationship( $user_id = 0, $user_ip = 0, $object_id, $object_ref ) 添加一個關係到關係表,如果沒有關係,則返回該使用者/對象配對的關係ID。
ucc_uof_delete_relationship( $user_id = 0, $user_ip = 0, $object_id, $object_ref ) 如果該關係沒有元數據條目,則會刪除一個關係。
ucc_uof_get_relationship() 返回該使用者/對象配對的關係ID。
ucc_uof_get_user_id() 返回當前使用者ID或如果未登錄則為0。
ucc_uof_get_user_ip() 如果當前的使用者已登錄,則返回0,否則返回ip2long()。

代碼示例:

// 創建或獲取使用者對象關係。
$relationship = ucc_uof_get_relationship( $user_id, $user_ip, $object_id, $object_ref );
if ( empty( $relationship ) )
$relationship = ucc_uof_add_relationship( $user_id, $user_ip, $object_id, $object_ref );

// 新增使用者對象元數據。
if ( $mode == 'delete' )
delete_metadata( 'uof_user_object', $relationship, '_your_meta_key' );
else
update_metadata( 'uof_user_object', $relationship, '_your_meta_key', 'your meta key value' );

原文外掛簡介

This plugin creates a user-object relationship table and a user-object relationship metadata
table. Relationships between a user (logged-in or IP) are created and added to the relationship
table; metadata (ex. votes, flags, and ratings) is attached to that particular relationship
via the metadata table. This is a framework; it is intended for use in voting, flagging,
and similar user applications where a user-affiliated metadata is attached to an object.
Supported object tables include wp_posts, wp_comments, wp_users, and wp_bp_activity.
Functions are provided to add/get/delete relationships; metadata is added via the native WordPress
metadata-handling functions.
Functions provided by this framework include:

ucc_uof_object_reference() returns an array of object-integer assignments. Use this to look up the
appropriate value for $object_ref based on the object table (wp_posts, wp_comments, wp_users,
wp_bp_activity are currently supported) to which you are attaching a user relationship.
ucc_uof_add_relationship( $user_id = 0, $user_ip = 0, $object_id, $object_ref ) adds a relationship
to the relationship table if none exists and returns the relationship id for that user/object pairing.
ucc_uof_delete_relationship( $user_id = 0, $user_ip = 0, $object_id, $object_ref ) will delete a
relationship if there are no metadata entries left for that relationship.
ucc_uof_get_relationship() returns the relationship id for that user/object pairing.
ucc_uof_get_user_id() returns the current user id or 0 if not logged in.
ucc_uof_get_user_ip() returns 0 if the current user is logged in, or an ip2long() if anonymous.

Example code:
// Create or get the user-object relationship.
$relationship = ucc_uof_get_relationship( $user_id, $user_ip, $object_id, $object_ref );
if ( empty( $relationship ) )
$relationship = ucc_uof_add_relationship( $user_id, $user_ip, $object_id, $object_ref );

// Add user_object_meta.
if ( $mode == 'delete' )
delete_metadata( 'uof_user_object', $relationship, '_your_meta_key' );
else
update_metadata( 'uof_user_object', $relationship, '_your_meta_key', 'your meta key value' );

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「User Object Framework」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


0.1 | trunk |

延伸相關外掛(你可能也想知道)

  • Unfiltered MU 》Unfiltered MU 提供給管理者和編輯者 unfiltered_html 功能。這可避免 WordPress MU/WordPress 3.0 多站點從這些使用者的文章中刪除