开发者 | Detective |
---|---|
更新时间 | 2009年4月16日 08:59 |
捐献地址: | 去捐款 |
PHP版本: | 2.7.1 及以上 |
WordPress版本: | 2.7.1 |
user_meta
table./wp-content/plugins/
directory (make sure that the directory 'el-aleph' is created).users.php
and profile.php
. Modify them according to your needs.Copy the files users.php and profile.php to your template directory. Edit those files, adding the HTML markup needed so they match your template.
Next, you need to tweak the parameters to the aleph_*
functions used in those templates. I think they are pretty self-explanatory. Here is an example taken from my customized
version of users.php:
`
aleph_users_list(
array(
'before_list' => '
',
'after_list' => '',
'before_list_meta' => '
',
'after_list_meta' => '',
'before_found_users' => '
',
'after_found_users' => '',
'before_title' => '
',
'after_title' => '',
'show_avatars' => false,
'show_navigation' => false,
'list_attributes' => 'id="user-list" style="padding-left: 0; margin-left: 0; list-style-type: none;"',
'before_avatar' => '
',
'after_avatar' => ''
)
);
users_nav_links('
', '');
`
You can see that i removed the navigation from the aleph_users_list and then called it directly. This allows me to add even more extra markup in case it is needed :)
In a profile the parameters are similar:
aleph_user_profile( array( 'before_profile_data' => '<div class="format_text">', 'after_profile_data' => '</div>', 'before_meta' => '<div class="headline_area">', 'after_meta' => '</div>', 'before_found_users' => '<p class="headline_meta">', 'after_found_users' => '</p>', 'before_title' => '<h1>', 'after_title' => '</h1>', 'before_avatar' => '<div style="width: 100px;" class="wp-caption alignright"">', 'after_avatar' => '</div>', 'avatar_size' => 96 ) );
Please check the files inside the lib folder to see the full list of parameters and available functions.
You can use special hooks defined by Aleph. Those hooks are:
aleph_user_list_before_user
, aleph_user_list_user_fields_before_details
, aleph_user_list_user_fields_after_details
, aleph_user_list_after_user
.aleph_before_user_profile
, aleph_user_profile_fields
, aleph_after_user_profile
.After the plugin is loaded, you can add new lists/views using a special function called aleph_register_view
:
`
add_action('init', 'my_aleph_views', 100);
function my_aleph_views() {
aleph_register_user_view('view_slug', 'My User List', 'user_key=some_meta_key');
}
`
The first parameter is the slug of the view, i.e., you can reach the view through http://example.com/searching/people/view_slug
.
The second parameter is the name of the view, displayed in the document title, the list header and the user lists widget.
The third parameter is the "user query", in this case, we are querying for users that have a custom user_meta of key some_meta_key
.
Currently, there are no planned "new" features, just improve what has already been done. Of course I would like to make the plugin easier to use, so I guess feedback is really needed. However, there are some unresolved things:
Well, in that case, Aleph is not (anymore) for you. I recommend BuddyPress, which will soon be available for single WP.
Yes! In fact, i use it on a MU installation. Care must be taken in where you install the plugin... it needs some tweaking, but it works. The "user things" code shown earlier comes from a plugin that lists user blogs.
If you have a field named "Gender":
`
add_action('aleph_user_profile_fields', 'display_user_cimy_field');
function display_user_cimy_field() {
$gender = aleph_get_user_cimy_field("Gender");
if ($gender) {
echo '
Gender';
echo '
' . $gender . '';
}
}
`
You don't need the user ID, because the function aleph_get_user_cimy_field
works on the "current" user.
If this happened to you, you probably did one of the following actions: