內容簡介
BuddyPress在預設情況下會自動將使用者資料中的某些單字和片語轉換成連結,當使用者點擊時,會搜尋其他也包含這些詞語的使用者資料,同時也會移除任何換行符號造成的排版問題。
當啟用這個外掛後,使用者可以透過以下方式更精確地控制這些連結:
關閉自動產生的連結。
在使用者的資訊欄位中,可以使用大括號來指定需要轉換成連結的單字或片語。例如在「興趣」欄位中,我可以寫上「關於狗的卡通」,但如果沒有啟用這個外掛,Buddypress會將整個片語轉換成連結,以搜尋其他喜歡「有關貓咪的卡通」的使用者。但如果我改寫成「{卡通}關於{貓咪}」,那麼括號中的兩個單字會分別轉換成獨立的連結。
如果安裝了「bbPress2 shortcode whitelist」外掛,使用者可以在自己的資訊欄位中使用管理員核准過的短代碼。
管理員可以指定某些資訊欄位轉換為社交網路連結。例如,如果我在標示為「Twitter」的欄位中輸入我的twitter帳號「antonchanning」,這個外掛會繞過預設的BuddyPress搜尋連結,改為連結到http://twitter.com/antonchanning。(目前這個名單是硬編碼的,但未來的版本計畫新增一個管理員頁面。現在,你可以參考buddypress-custom-profile-filters-bp-functions.php設置這個功能。)
此外掛是從紐約大學學術社群的一個類似外掛中分支出來的。
注意事項
如果使用者資料中有大括號,此外掛將會啟用。如果安裝了「bbPress2 shortcode whitelist」外掛,管理員核准的任何短代碼都可以在使用者資料中使用。例如,「bbPress BBCode」外掛中的代碼。
你可能想在你的BP個人資訊編輯模板(/wp-content/bp-themes/[你的會員佈景主題]/profile/edit.php)中插入一個小提示,告訴網站使用者如何使用這些大括號。例如:
「你的個人資訊中的單字或片語可以連結到其他成員的資料,只要其他成員的資料也包含這些片語。如果要指定需要連結的單字或片語,請加上大括號:例如「[b]生命就像一個沙灘![/b]我愛{冰淇淋}和{游泳}。」」
未來的功能包括:管理員選項頁面;調整BP的自動個人資訊篩選方式(例如,解析用分號分隔的列表而非逗號)。
外掛標籤
開發者團隊
② 後台搜尋「Custom Profile Filters for BuddyPress」→ 直接安裝(推薦)
原文外掛簡介
Out of the box, BuddyPress automatically turns some words and phrases in the fields of a user’s profile into links that, when clicked, search the user’s community for other profiles containing those phrases. It also removes any attempts at formatting with new lines.
When activated, this plugin allows users to have more control over these links, in the following ways:
Auto generated links are completely disabled.
By using curly brackets in a profile field, users can specify which words or phrases in their profile turn into links. For example: under Interests, I might list “Cartoons about dogs”. Without this plugin, Buddypress will turn the entire phrase into a link that searches the community for others who like ‘cartoons about cats’. If I instead type “{Cartoons} about {cats}”, then the two words in brackets will turn into independent links.
If the ‘bbPress2 shortcode whitelist’ plugin is activated, then users can also apply admin approved shortcodes to their profile fields.
Administrators can specify certain profile fields that link to social networking profiles. If I enter my Twitter handle ‘antonchanning’ into a field labeled ‘Twitter’, for example, this plugin will bypass the default link to a BuddyPress search on ‘antonchanning’ and instead link to http://twitter.com/antonchanning. (Currently this list is hardcoded, but I plan to add an admin screen in future versions. See buddypress-custom-profile-filters-bp-functions.php to configure this setting for now).
This plugin is forked from a similar plugin from CUNY Academic Commons of the City University of New York.
Notes
The plugin checks each profile for curly brackets and activates if it finds any. If the ‘bbPress2 shortcode whitelist’ plugin
is installed, any shortcodes approved by admin can be used in profile fields. For example, codes from the ‘bbPress BBCode’
plugin.
You might want to insert a small explanation into your BP profile edit template (/wp-content/bp-themes/[your-member-theme]/profile/edit.php that tells your site’s users how to use these brackets. For example:
“Words or phrases in your profile can be linked to the profiles of other members that contain the same phrases. To specify which words or phrases should be linked, add square brackets: e.g. “[b]Life’s a beach![/b] I love {icecream} and {swimming}.”.”
Future features include: admin tab with toggle switch; ability to tweak BP’s automatic profile filter (e.g. to parse semi-colon separated lists in addition to commas).
