Changeset 7428
- Timestamp:
- 10/15/2013 03:07:44 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-avatars.php
r7404 r7428 110 110 * 111 111 * @type int|bool $item_id The numeric ID of the item for which you're 112 * requesting an avatar (eg, a user ID). If no 113 * 'item_id' is present, the function attempts to 114 * infer an ID from the 'object' + the current 115 * context: if 'object' is 'user' and the current 116 * page is a user page, 'item_id' will default to 117 * the displayed user ID; if 'group' and on a group 118 * page, to the current group ID; if 'blog', to the 119 * current blog's ID. If no 'item_id' can be 120 * determined in this way, the function returns 121 * false. Default: false. 112 * requesting an avatar (eg, a user ID). If no 'item_id' is present, 113 * the function attempts to infer an ID from the 'object' + the 114 * current context: if 'object' is 'user' and the current page is a 115 * user page, 'item_id' will default to the displayed user ID; if 116 * 'group' and on a group page, to the current group ID; if 'blog', 117 * to the current blog's ID. If no 'item_id' can be determined in 118 * this way, the function returns false. Default: false. 122 119 * @type string $object The kind of object for which you're getting an 123 * avatar. BuddyPress natively supports three options: 124 * 'user', 'group', 'blog'; a plugin may register more. 125 * Default: 'user'. 120 * avatar. BuddyPress natively supports three options: 'user', 121 * 'group', 'blog'; a plugin may register more. Default: 'user'. 126 122 * @type string $type When a new avatar is uploaded to BP, 'thumb' and 127 * 'full' versions are saved. This parameter specifies 128 * whether you'd like the 'full' or smaller 'thumb' 129 * avatar. Default: 'thumb'. 123 * 'full' versions are saved. This parameter specifies whether you'd 124 * like the 'full' or smaller 'thumb' avatar. Default: 'thumb'. 130 125 * @type string|bool $avatar_dir The name of the subdirectory where the 131 * requested avatar should be found. If no 132 * value is passed, 'avatar_dir' is inferred 133 * from 'object': 'user' becomes 'avatars', 134 * 'group' becomes 'group-avatars', 'blog' 135 * becomes 'blog-avatars'. Remember that this 136 * string denotes a subdirectory of BP's 137 * main avatar directory (usually based on 138 * {@link wp_upload_dir()}); it's a string 139 * like 'group-avatars' rather than the full 140 * directory path. Generally, it'll only be 141 * necessary to override the default value if 142 * storing avatars in a non-default location. 143 * Defaults to false (auto-detected). 126 * requested avatar should be found. If no value is passed, 127 * 'avatar_dir' is inferred from 'object': 'user' becomes 'avatars', 128 * 'group' becomes 'group-avatars', 'blog' becomes 'blog-avatars'. 129 * Remember that this string denotes a subdirectory of BP's main 130 * avatar directory (usually based on {@link wp_upload_dir()}); it's a 131 * string like 'group-avatars' rather than the full directory path. 132 * Generally, it'll only be necessary to override the default value if 133 * storing avatars in a non-default location. Defaults to false 134 * (auto-detected). 144 135 * @type int|bool $width Requested avatar width. The unit is px. This value 145 * is used to build the 'width' attribute for the 146 * <img> element. If no value is passed, BP uses the 147 * global avatar width for this avatar type. Default: 148 * false (auto-detected). 149 * @type int|bool $height Requested avatar height. The unit is px. This value 150 * is used to build the 'height' attribute for the 151 * <img> element. If no value is passed, BP uses the 152 * global avatar height for this avatar type. Default: 153 * false (auto-detected). 136 * is used to build the 'width' attribute for the <img> element. If 137 * no value is passed, BP uses the global avatar width for this 138 * avatar type. Default: false (auto-detected). 139 * @type int|bool $height Requested avatar height. The unit is px. This 140 * value is used to build the 'height' attribute for the <img> 141 * element. If no value is passed, BP uses the global avatar height 142 * for this avatar type. Default: false (auto-detected). 154 143 * @type string $class The CSS class for the <img> element. Note that BP 155 * uses the 'avatar' class fairly extensively in its 156 * default styling, so if you plan to pass a custom 157 * value, consider appending it to 'avatar' (eg 158 * 'avatar foo') rather than replacing it altogether. 159 * Default: 'avatar'. 144 * uses the 'avatar' class fairly extensively in its default styling, 145 * so if you plan to pass a custom value, consider appending it to 146 * 'avatar' (eg 'avatar foo') rather than replacing it altogether. 147 * Default: 'avatar'. 160 148 * @type string|bool $css_id The CSS id for the <img> element. 161 * 149 * Default: false. 162 150 * @type string $title The title attribute for the <img> element. 163 * 151 * Default: false. 164 152 * @type string $alt The alt attribute for the <img> element. In BP, this 165 * value is generally passed by the wrapper functions, 166 * where the data necessary for concatenating the string 167 * is at hand; see {@link bp_get_activity_avatar()} for an 168 * example. Default: ''. 153 * value is generally passed by the wrapper functions, where the data 154 * necessary for concatenating the string is at hand; see 155 * {@link bp_get_activity_avatar()} for an example. Default: ''. 169 156 * @type string|bool $email An email to use in Gravatar queries. Unless 170 * otherwise configured, BP uses Gravatar as a 171 * fallback for avatars that are not provided 172 * locally. Gravatar's API requires using a hash of 173 * the user's email address; this argument 174 * provides it. If not provided, the function 175 * will infer it: for users, by getting the user's 176 * email from the database, for groups/blogs, by 177 * concatenating "{$item_id}-{$object}@{bp_get_root_domain()}". 178 * The user query adds overhead, so it's 179 * recommended that wrapper functions provide a 180 * value for 'email' when querying user IDs. 181 * Default: false. 157 * otherwise configured, BP uses Gravatar as a fallback for avatars 158 * that are not provided locally. Gravatar's API requires using a hash 159 * of the user's email address; this argument provides it. If not 160 * provided, the function will infer it: for users, by getting the 161 * user's email from the database, for groups/blogs, by concatenating 162 * "{$item_id}-{$object}@{bp_get_root_domain()}". The user query adds 163 * overhead, so it's recommended that wrapper functions provide a 164 * value for 'email' when querying user IDs. Default: false. 182 165 * @type bool $no_grav Whether to disable the default Gravatar fallback. 183 * By default, BP will fall back on Gravatar when it 184 * cannot find a local avatar. In some cases, this may 185 * be undesirable, in which case 'no_grav' should be 186 * set to true. To disable Gravatar fallbacks globally, 187 * see the 'bp_core_fetch_avatar_no_grav' filter. 188 * Default: false. 166 * By default, BP will fall back on Gravatar when it cannot find a 167 * local avatar. In some cases, this may be undesirable, in which 168 * case 'no_grav' should be set to true. To disable Gravatar 169 * fallbacks globally, see the 'bp_core_fetch_avatar_no_grav' filter. 170 * Default: false. 189 171 * @type bool $html Whether to return an <img> HTML element, vs a raw URL 190 * to an avatar. If false, <img>-specific arguments (like191 * 'css_id')will be ignored. Default: true.172 * to an avatar. If false, <img>-specific arguments (like 'css_id') 173 * will be ignored. Default: true. 192 174 * } 193 * @return string Formatted HTML <img> element, or raw avatar URL based on $html arg 175 * @return string Formatted HTML <img> element, or raw avatar URL based on $html arg. 194 176 */ 195 177 function bp_core_fetch_avatar( $args = '' ) {
Note: See TracChangeset
for help on using the changeset viewer.